aboutsummaryrefslogtreecommitdiffstats
path: root/chapters/1-Introduction.scm
diff options
context:
space:
mode:
Diffstat (limited to 'chapters/1-Introduction.scm')
-rw-r--r--chapters/1-Introduction.scm103
1 files changed, 103 insertions, 0 deletions
diff --git a/chapters/1-Introduction.scm b/chapters/1-Introduction.scm
new file mode 100644
index 0000000..38beba8
--- /dev/null
+++ b/chapters/1-Introduction.scm
@@ -0,0 +1,103 @@
+
+(define ((Lfree mass) state)
+ (* 1/2 mass (square (velocity state))))
+
+; geometric transform of spherical coordinates to 3D coordinates
+; 'R' is radius
+(define ((sphere->R3 R) state)
+ (let ((q (coordinate state)))
+ (let ((theta (ref q 0))
+ (phi (ref q 1)))
+ (up (* R (sin theta) (cos phi)) ; x
+ (* R (sin theta) (sin phi)) ; y
+ (* R (cos theta)))))) ; z
+
+; apply a coordinate transform to a function over states (?)
+(define ((F->C F) state)
+ (up (time state)
+ (F state)
+ (+ (((partial 0) F) state)
+ (* (((partial 1) F) state)
+ (velocity state)))))
+
+(define (Lsphere m R)
+ (compose (Lfree m) (F->C (sphere->R3 R))))
+
+((Lsphere 'm 'R)
+ (up 't (up 'theta 'phi) (up 'thetadot 'phidot)))
+; (+ (* 1/2 (expt R 2) m (expt phidot 2) (expt (sin theta) 2)) (* 1/2 (expt R 2) m (expt thetadot 2)))
+; -> 1/2 m R^2 phidot^2 sin(theta)^2 + 1/2 R^2 m thetadot^2
+; -> 1/2 m R^2 ( phidot^2 sin(theta)^2 + thetadot^2 )
+
+; this is kinetic energy of a particle on a sphere in spherical coordinates, as expected
+
+(define ((L2 mass metric) place velocity)
+ (* 1/2 mass ((metric velocity velocity) place)))
+
+
+; (metric velocity velocity) here is the magniture of velocity ("weighted sum of squares")
+; 'Lc' is "Lagrangian in coordinate representation"
+(define ((Lc mass metric coordsys) state)
+ (let ((x (coordinates state))
+ (v (velocities state))
+ (e (coordinate-system->vector-basis coordsys)))
+ ((L2 mass metric) ((point coordsys) x) (* e v))))
+
+(define the-metric (literal-metric 'g R2-rect))
+
+(define L (Lc 'm the-metric R2-rect))
+
+(L (up 't (up 'x 'y) (up 'vx 'vy)))
+; (+ (* 1/2 m (expt vx 2) (g_00 (up x y)))
+; (* m vx vy (g_01 (up x y)))
+; (* 1/2 m (expt vy 2) (g_11 (up x y))))
+
+; same as 1.3, assuming g_01 and g_10 are the same (?)
+
+; going to define a path on a 2D manifold
+
+(define gamma (literal-manifold-map 'q R1-rect R2-rect))
+
+; ahhh!
+; ``((point R1-rect 't))` creates a point on the real like (R1-rect), based on coordinate 't.
+; `((chart R2-rect) m)` takes a point m and returns coordinates
+
+((chart R2-rect) (gamma ((point R1-rect) 't)))
+; (up (q^0 t) (q^1 t))
+
+(define coordinate-path
+ (compose (chart R2-rect) gamma (point R1-rect)))
+
+(coordinate-path 't)
+; (up (q^0 t) (q^1 t))
+
+(define Lagrange-residuals
+ (((Lagrange-equations L) coordinate-path) 't))
+
+Lagrange-residuals
+; big mess
+
+(define-coordinates t R1-rect)
+
+(define Cartan
+ (Christoffel->Cartan
+ (metric->Christoffel-2 the-metric
+ (coordinate-system->basis R2-rect))))
+
+(define geodesic-equation-residuals
+ (((((covariant-derivative Cartan gamma) d/dt)
+ ((differential gamma) d/dt))
+ (chart R2-rect))
+ ((point R1-rect) 't)))
+
+(define metric-components
+ (metric->components the-metric
+ (coordinate-system->basis R2-rect)))
+
+(- Lagrange-residuals
+ (* (* 'm (metric-components (gamma ((point R1-rect) 't))))
+ geodesic-equation-residuals))
+; (down 0 0)
+
+; so the Lagrange equations correspond to the Christoffel coefficients
+