Skip to content

Instantly share code, notes, and snippets.

@howardjp
Last active August 22, 2023 22:28
Show Gist options
  • Save howardjp/9dd26c532d682624109b18e3ef29554b to your computer and use it in GitHub Desktop.
Save howardjp/9dd26c532d682624109b18e3ef29554b to your computer and use it in GitHub Desktop.
Some light quantum mechanics in Emacs Lisp

Quantum Mechanics for Engineers

Problem 1

Find the fringe spacing in double-slit experiment where a particle is an electron at 1 MeV, and other values included below.

(setq planck-constant     6.62607015e-34)  ;; J / Hz
(setq light-speed         299792458)       ;; m / s
(setq eV                  1.602176634e-19) ;; J, kg m2 / s2
(setq MeV                 (* eV 1e6))      ;; J, kg m2 / s2

(setq wavelength
      (/ planck-constant
         (/ MeV light-speed)))

(setq D   1)      ; m
(setq d   5e-10)  ; m

(/ (* wavelength D) d)

Answer:

0.0024796839686640052

Problem 2

Now, a neutron beam at 1 MeV.

(setq neutron-mass        1.6749e-27)     ;; kg

(setq neutron-velocity                    ;; I don't really need this.
      (sqrt (/ (* (/ MeV) 2) neutron-mass)))

(setq wavelength
      (/ planck-constant
         (sqrt
          (* 2 neutron-mass MeV))))
(/ (* wavelength D) d)

Answer:

5.720334025105121e-05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment