There is no excerpt because this is a protected post.
Criticality and hysteresis in the 2-D Ising model
The two dimensional Ising model possesses all of the features that we expect of a true ferromagnetic system: spontaneous magnetization, critical behavior, and hysteresis. A Monte Carlo simulation illustrates all of this quite graphically. I use common lisp in this
Protected: Physics 711: Lecture 31
There is no excerpt because this is a protected post.
Protected: Programming HOWTOs
There is no excerpt because this is a protected post.
Using LAPACK in C, julia, lisp, and python
LAPACK and BLAS are two very highly optimized code libraries for linear algebra. There is almost no way that you can write linear algebra code that can compete with them in speed, accuracy or economy. Julia, R, python (and practically
Using libc and gsl in julia and lisp (and python too)
Don’t reinvent the wheel. Your computer system libraries probably contain routines to efficiently calculate almost any function that you might need to use. You can install a wrapper package for these libraries (such as libc, gsl, …) or simply use
Code managment: Using git
A large collaboration (well, any collaboration) may maintain a code-base for the in-house software that the group has written for their research. Each collaborator needs to be able to pull down the code-base development branch, make contributions, and commit them
Libraries, packages, and namespaces
I have already illustrated how to create packages or libraries in R, let’s have a look at the process in lisp and C.All computer language implementations and installations include many libraries or collections of ready-to-use functions and data types. These
Root finding
#include<stdio.h> float a,b,c; float func(float (*pf)(float x), float x, float y); float f( float z); main(){ a=2.0; b=3.0; c=func(f,a,b); printf("%f\n",c); } float func(float(*pf)(float x), float x, float y){ float c; c=(*pf)(x); c=y*c; return(c); } float f(float z){ return(1.0/(z*z)); } (defun
Protected: Autodifferentiation with dual numbers
There is no excerpt because this is a protected post.
Smart recursions: tail-call and Miller recursion
long f(long x){ return(faux(x,1)); } long faux(long x, long y){ /* here is simple iteration */ while (x != 0){ y=x*y; x=x-1;} return(y); } (defun binomial (n k) "Binomial coefficient" (if (or (< n k) (< k 0)) nil (binomaux
Integer relations-I. Brun’s algorithm
; common lisp ; Brun's method for integer relations ; Make sure you use double-floats! (defun Brun (lst iters) (setf foo (copy-list lst)) (setf n (1- (length foo))) (setf b (loop for i from 0 to n collect (loop for
Very fast recursions with memoization
;; lisp again.... (defvar *facttable* (make-hash-table :test 'equal)) (setf (gethash 3 *facttable*) 6) (defun factl (n) "Memoized factorial function" (cond ((= n 0) 1) ((equal (gethash n *facttable*) nil) (let* ((x (* n (factl (- n 1))))) (setf (gethash n
Algorithms for numerical integration.
(defpackage :quadrature (:use :common-lisp) (:nicknames "quadr") (:documentation "Basic numerical integration functions (JRS 2015)") (:export :Trapezoid :Romberg :Clenshaw :Gaussian :LagGauss)) ; ;; to use, make it the current package (in-package :quadrature) (defun Trapezoid (fcn n a b) "Trapezoid rule integration n