Advertisement
Guest User

Untitled

a guest
Jan 12th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 1.05 KB | None | 0 0
  1. (defun xfga-wavefunction (x0 p0 a-sub-n epsilon epsilon-derivative phi-sub-u)
  2.   "Returns the XFGA wavefunction for the given parameters per Garraway 2000."
  3.  
  4.  #'(lambda (x)
  5.       (let* ((epsilon-magnitude (abs epsilon))
  6.              (sum-length (length a-sub-n))
  7.              (prefactor (* (/ 1 (sqrt (* (sqrt pi) epsilon)))
  8.                            (exp (* #C (0.0 1.0)
  9.                                    (+ (/ (* 0.5 epsilon-derivative
  10.                                             (expt (- x x0) 2)) epsilon)
  11.                                       (* x p0)
  12.                                       (* -0.5 x0 p0)
  13.                                       (* -1 phi-sub-U)))))))
  14.         (loop for n from 0 below sum-length
  15.            collecting (* (expt (/ epsilon-magnitude (* (sqrt 2) epsilon)) n)
  16.                          (hermite n (/ (- x x0) epsilon-magnitude))
  17.                          (/ 1 (sqrt (factorial n)))) into coefficients
  18.            finally (return (* prefactor
  19.                               (reduce '+ (mapcar '* a-sub-n coefficients))))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement