Skip to content

Commit a47290c

Browse files
authored
LaTeX for beginning of SICM-Ch01 (#311)
1 parent 66ad351 commit a47290c

File tree

5 files changed

+6736
-200
lines changed

5 files changed

+6736
-200
lines changed

site/_quarto.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,13 @@ website:
3838
- href: mentat_collective/emmy/fdg_ch01.qmd
3939
text: "FDG Chapter 1"
4040
- href: mentat_collective/emmy/fdg_ch01_ys.qmd
41-
text: "FDG Chapter 1 Infix"
42-
- href: mentat_collective/emmy/sicm_ch01.qmd
41+
text: "FDG Ch01 Infix"
42+
- href: mentat_collective/emmy/sicm_original_ch01.qmd
4343
text: "SICM Chapter 1"
44+
- href: mentat_collective/emmy/sicm_ch01.qmd
45+
text: "SICM Ch01 Graphics"
46+
- href: mentat_collective/emmy/debroglie.qmd
47+
text: "deBroglie Waves"
4448
- href: mentat_collective/emmy/silcm_ch01.qmd
4549
text: "Lorentz Covariant"
4650

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
^{:kindly/hide-code true
2+
:clay {:title "Emmy, the Algebra System: deBroglie wavelength"
3+
:quarto {:author :kloimhardt
4+
:type :draft
5+
:description "A particle riding its wave whose length depends on the former's momentum"
6+
:sidebar "emmy-fdg"
7+
:date "2026-01-27"
8+
:category :libs
9+
:tags [:emmy :physics]}}}
10+
11+
(ns mentat-collective.emmy.debroglie
12+
(:refer-clojure :exclude [+ - * / zero? compare divide numerator denominator
13+
time infinite? abs ref partial =])
14+
(:require [scicloj.kindly.v4.api :as kindly]
15+
[scicloj.kindly.v4.kind :as kind]
16+
[mentat-collective.emmy.scheme :refer [define-1 let-scheme lambda]]
17+
[civitas.repl :as repl]))
18+
19+
^:kindly/hide-code
20+
(def prod true) #_"used to check Emmy in Scittle kitchen"
21+
22+
^:kindly/hide-code
23+
(kind/hiccup
24+
[:div
25+
[:script {:src "https://cdn.jsdelivr.net/npm/scittle-kitchen@0.7.28-59/dist/scittle.js"}]
26+
[:script {:src "https://cdn.jsdelivr.net/npm/scittle-kitchen@0.7.28-59/dist/scittle.emmy.js"}]
27+
[:script {:src "https://cdn.jsdelivr.net/npm/scittle-kitchen@0.7.28-59/dist/scittle.cljs-ajax.js"}]
28+
[:script {:src "https://cdn.jsdelivr.net/npm/react@18/umd/react.production.min.js", :crossorigin ""}]
29+
[:script {:src "https://cdn.jsdelivr.net/npm/react-dom@18/umd/react-dom.production.min.js", :crossorigin ""}]
30+
[:script {:src "https://cdn.jsdelivr.net/npm/scittle-kitchen@0.7.28-59/dist/scittle.reagent.js"}]
31+
[:script {:type "application/x-scittle" :src "scheme.cljc"}]])
32+
33+
^:kindly/hide-code
34+
(defmacro define [& b]
35+
(list 'do
36+
(cons 'mentat-collective.emmy.scheme/define b)
37+
(list 'kind/scittle (list 'quote (cons 'define b)))))
38+
39+
^:kindly/hide-code
40+
(define emmy-env
41+
'[emmy.env :refer :all :exclude [Lagrange-equations r->p]])
42+
43+
^{:kindly/hide-code true :kindly/kind kind/hidden}
44+
(do
45+
(require emmy-env))
46+
47+
^:kindly/hide-code
48+
(kind/scittle
49+
'(do
50+
(require emmy-env)))
51+
52+
^:kindly/hide-code
53+
(define string-exp (comp str simplify))
54+
55+
^:kindly/hide-code
56+
(defn reag-comp [b]
57+
(let [server-erg (string-exp (eval b))]
58+
(list 'kind/reagent
59+
[:div (list 'quote
60+
(list 'let ['a (list 'string-exp b)]
61+
[:div
62+
(when (not prod)
63+
[:div
64+
[:tt 'a]
65+
[:p (list 'str (list '= server-erg 'a))]])
66+
[:tt server-erg]]))])))
67+
68+
^:kindly/hide-code
69+
(def show-tex-fn (comp kind/tex emmy.expression.render/->TeX))
70+
71+
^:kindly/hide-code
72+
(defmacro show-tex [e]
73+
(if prod
74+
(list 'show-tex-fn e)
75+
(reag-comp e)))
76+
77+
^:kindly/hide-code
78+
(kind/scittle
79+
'(defn show-tex [e]
80+
(->infix e)))
81+
82+
^:kindly/hide-code
83+
(defmacro is-equal [a b]
84+
(list 'if (list '= (list 'simplify (list '- a b)) 0)
85+
(list 'show-tex a)
86+
"not equal"))
87+
88+
^:kindly/hide-code
89+
(kind/scittle
90+
'(defn is-equal [a b]
91+
(if (= (simplify (- a b)) 0)
92+
(show-tex a)
93+
"not equal")))
94+
95+
^:kindly/hide-code
96+
(defmacro solves [a f]
97+
(list 'if (list '= (list 'simplify (list f a)) 0)
98+
(list 'show-tex (list '* (list 'symbol "root:") a))
99+
"does not solve"))
100+
101+
^:kindly/hide-code
102+
(kind/scittle
103+
'(defn solves [a f]
104+
(if (= (simplify (f a)) 0)
105+
(show-tex (* (symbol "root:") a))
106+
"does not solve")))
107+
108+
;; In the following I follow deBroglies arguments. There is also a [version with infix notation](https://kloimhardt.github.io/blog/hamiltonmechanics/2024/09/13/debroglie.html).
109+
110+
;; ### Internal Vibrations
111+
;;as always with Einstein, we start with E = mc^2
112+
113+
(define (E0 m) (* m (square 'c)))
114+
115+
(show-tex
116+
(E0 'm))
117+
118+
;; deBroglies first hypothesis was to assume that every particle has a hypothetical internal vibration at frequency nu0 which relates to the rest energy in rest frame of particle (only there this energy-frequency relation holds)
119+
120+
(define (nu_naught E0) (/ E0 'h))
121+
122+
;; particle travels at velocity vp
123+
124+
(define (vp beta) (* beta 'c))
125+
126+
(define (beta v) (/ v 'c))
127+
128+
(define (gamma beta) (/ 1 (sqrt (- 1 (square beta)))))
129+
130+
;; time dilation: internal vibration is slower for observer. so the frequency-energy relation does not hold: the frequency indeed decreases instead of increasing with energy. this is the conundrum deBroglie solved. so hang on.
131+
132+
(define (nu_one nu_naught gamma) (/ nu_naught gamma))
133+
134+
;; sine formula for internal vibration. we do not know what exactly vibrates so we set the amplitude to one
135+
136+
(define ((internal-swing nu_one) t)
137+
(sin (* 2 'pi nu_one t)))
138+
139+
(show-tex
140+
((internal-swing 'nu_one) 't))
141+
142+
;; calculate the phase of the internal swing at particle point x = v * t
143+
144+
(define ((internal-phase nu_one v) x)
145+
(asin ((internal-swing nu_one) (/ x v))))
146+
147+
(is-equal (* 2 'pi 'nu_one (/ 'x 'v))
148+
((internal-phase 'nu_one 'v) 'x))
149+
150+
;; personal note: to me, this is the sine-part of a standing wave, the standing vibration.
151+
152+
;;### A general Wave
153+
154+
;; now for something completely different: general definition of a wave
155+
156+
(define ((wave omega k) x t)
157+
(sin (- (* omega t) (* k x))))
158+
159+
;; with the usual definition of omega
160+
161+
(define (omega nu) (* 2 'pi nu))
162+
163+
;; and the simplest possible definition for the wave-vector k: a dispersion free wave traveling at phase-velocity V
164+
165+
(define (k omega V) (/ omega V))
166+
167+
;; calculate the phase of the wave
168+
169+
(define ((wave-phase nu V) x t)
170+
(asin ((wave (omega nu) (k (omega nu) V)) x t)))
171+
172+
(is-equal (* 2 'pi 'nu (- 't (/ 'x 'V)))
173+
((wave-phase 'nu 'V) 'x 't))
174+
175+
;; ### Phase difference
176+
;; calculate the phase difference between the vibration and some wave at time t = x / v as a function of the ratio of the frequencies
177+
178+
(define ((phase-difference x v nu V) ratio)
179+
(- ((internal-phase (* ratio nu) v) x)
180+
((wave-phase nu V) x (/ x v))))
181+
182+
(is-equal (* 2 'pi 'nu (+ (* (- 'ratio 1) (/ 'x 'v)) (/ 'x 'V)))
183+
((phase-difference 'x 'v 'nu 'V) 'ratio))
184+
185+
;; state the general ratio of frequencies that keeps the vibration of the particle in phase with some wave of velocity V in terms of the velocity of the particle
186+
187+
(define (phase-ratio v V) (- 1 (/ v V)))
188+
189+
(solves (phase-ratio 'v 'V)
190+
(phase-difference 'x 'v 'nu 'V))
191+
192+
;; the Energy of the particle for the observer
193+
194+
(define (Ev E0 gamma) (* E0 gamma))
195+
196+
;; we assume the deBroglie wave has the frequency: energy divided by Planck's constant. reminder: this relation holds in every frame of reference, especially for the observer who is not in the rest frame.
197+
198+
(define (nu Ev) (/ Ev 'h))
199+
200+
;; now that nu is set, calculate the physically viable ratio of the frequencies in terms of beta
201+
202+
(define (physical-ratio beta)
203+
(/ (nu_one (nu_naught 'E0) (gamma beta))
204+
(nu (Ev 'E0 (gamma beta)))))
205+
206+
(is-equal (- 1 (square 'beta))
207+
(physical-ratio 'beta))
208+
209+
;; state, in terms of the particle velocity beta, the value of the physical phase-velocity V that keeps the vibration and the deBroglie wave in phase
210+
211+
(define (phase-velocity beta) (/ 'c beta))
212+
213+
(solves (phase-velocity 'beta)
214+
(lambda (V) (- (physical-ratio 'beta)
215+
(phase-ratio (vp 'beta) V))))
216+
217+
;; note: the phase-velocity is always greater than the speed of light. It is independent of the position x and the mass of the particle
218+
219+
;; the relativistic momentum is defined as
220+
221+
(define (p m v gamma)
222+
(* m v gamma))
223+
224+
;; calculate the deBroglie wavelength (by dividing the phase-velocity by the frequency) and show that it indeed is h divided by the momentum
225+
226+
(define de-broglie-wavelength
227+
(/ (phase-velocity (beta 'v))
228+
(nu (Ev (E0 'm) 'gamma))))
229+
230+
(is-equal (/ 'h (p 'm 'v 'gamma))
231+
de-broglie-wavelength)
232+
233+
(repl/scittle-sidebar)

src/mentat_collective/emmy/sicm_ch01.clj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,10 @@
295295
(make-path-tz (lambda (t) (- (cos t) (harmonic-path t)))
296296
0 pi-half 35))))
297297

298+
;; *Figure 1.1* The difference between the polynomial
299+
;; approximation with minimum action and the actual trajectory taken by the
300+
;; harmonic oscillator. The abscissa is the time and the ordinate is the error.
301+
298302
(md "Calculate the Lagrange equation of the harmonic oszillator.")
299303

300304
(show-tex-expression

0 commit comments

Comments
 (0)