Differences between sicmutils and scmutils in Functional Differential Geometry #380
Replies: 16 comments 28 replies
-
PrologueRemarks
Questions
|
Beta Was this translation helpful? Give feedback.
-
1. PrologueRemarks
(def geodesic-equation-residuals
(let-coordinates [t R1-rect]
(((((covariant-derivative Cartan gamma) d:dt)
((differential gamma) d:dt))
(chart R2-rect))
((point R1-rect) 't)))) Questions
|
Beta Was this translation helpful? Give feedback.
-
2. ManifoldsQuestions
The discussion after |
Beta Was this translation helpful? Give feedback.
-
2. Manfolds (Added)Remarks
;;; For (x (R2-rect-chi-inverse (up 'x0 'y0)))
(let-coordinates
[(up x y) R2-rect]
(x (R2-rect-chi-inverse (up 'x0 'y0)))) Edited: due to a commet. We can write a somewhat simple code. ;;; For (x (R2-rect-chi-inverse (up 'x0 'y0)))
(let-coordinates
[[x y] R2-rect]
(x (R2-rect-chi-inverse (up 'x0 'y0)))) The followings are the same. ;;; For (x (R2-polar-chi-inverse (up ’r0 ’theta0)))
(let-coordinates
[(up x y) R2-rect
(up r theta) R2-polar]
(x (R2-polar-chi-inverse (up 'r0 'theta0)))) ;;; For (r (R2-polar-chi-inverse (up ’r0 ’theta0)))
(let-coordinates
[(up r theta) R2-polar]
(r (R2-polar-chi-inverse (up 'r0 'theta0)))) ;;; For (r (R2-rect-chi-inverse (up ’x0 ’y0)))
(let-coordinates
[(up r theta) R2-polar]
(r (R2-rect-chi-inverse (up 'x0 'y0)))) ;;; For (theta (R2-rect-chi-inverse (up ’x0 ’y0)))
(let-coordinates
[(up r theta) R2-polar]
(theta (R2-rect-chi-inverse (up 'x0 'y0)))) ;;; For (h R2-rect-point)
(let-coordinates
[(up x y) R2-rect
(up r theta) R2-polar]
(let [h (+ (* x (square r)) (cube y))]
(h R2-rect-point))) ;;; For (h (R2-polar-chi-inverse (up ’r0 ’theta0)))
(let-coordinates
[(up x y) R2-rect
(up r theta) R2-polar]
(let [h (+ (* x (square r)) (cube y))]
(render (h (R2-polar-chi-inverse (up 'r0 'theta0))))))
(let-coordinates
[(up r theta) R2-polar]
(render ((- r (* 2 'a (+ 1 (cos theta))))
((point R2-rect) (up 'x 'y))))) |
Beta Was this translation helpful? Give feedback.
-
03. Vector Fields and One-form FieldsRemarks
(remarks '[sicmutils.env :as e :refer :all])
(require '[sicmutils.operator :as o])
(defn coordinatize
[v coordsys]
(defn coordinatize-v
[f]
(fn [x]
(let [b (compose (v (chart coordsys))
(point coordsys))]
(* ((D f) x) (b x)))))
(o/make-operator coordinatize-v `(~'coordinatized ~(o/name v))))
(let-coordinates [(up x y) R2-rect]
(let [circular (- (* x d:dy) (* y d:dx))]
(take 6
(seq
(((exp (* 't circular)) (chart R2-rect))
((point R2-rect) (up 1 0)))))))
(let-coordinates [(up x y) R2-rect]
(let [circular (- (* x d:dy) (* y d:dx))]
(map render
(take 6
(seq
(((exp (* 't circular)) (chart R2-rect))
((point R2-rect) (up 1 0))))))))
(defn evolution
"P.31, This is defined in `sicmutils.calculus.vector-field`."
[order]
(fn [delta-t v]
(fn [f]
(fn [m]
(series/sum (((exp (* delta-t v)) f) m)
order)))))
(let-coordinates [(up x y) R2-rect]
(let [circular (- (* x d:dy) (* y d:dx))]
(render
((((evolution 6) 'delta-t circular)
(chart R2-rect))
((point R2-rect) (up 1 0))))))
(let-coordinates [(up x y) R2-rect]
((dx d:dy) R2-rect-point))
(let-coordinates [(up x y) R2-rect]
((dx d:dx) R2-rect-point))
;;;((dx circular) R2-rect-point)
(let-coordinates [(up x y) R2-rect]
(let [circular (- (* x d:dy) (* y d:dx))]
((dx circular) R2-rect-point))) |
Beta Was this translation helpful? Give feedback.
-
04. Basis FieldsRemark
(let-coordinates [[x y z] R3-rect
[theta phi psi] Euler-angles]
(let [e_x (+ (* (cos phi) d:dtheta)
(* -1 (/ (* (sin phi) (cos theta)) (sin theta)) d:dphi)
(* (/ (sin phi) (sin theta)) d:dpsi))
e_y (+ (/ (* (cos phi) (cos theta) d:dphi) (sin theta))
(* (sin phi) d:dtheta)
(* -1 (/ (cos phi) (sin theta)) d:dpsi))
e_z d:dphi
f (literal-manifold-function 'f-Euler Euler-angles)
SO3-point ((point Euler-angles) (up 'theta 'phi 'psi))]
(list
(render (((+ (commutator e_x e_y) e_z) f) SO3-point))
(render (((+ (commutator e_y e_z) e_x) f) SO3-point))
(render (((+ (commutator e_z e_x) e_y) f) SO3-point))))) Edited: We can write the code as follows. See also the reply of this comment. (let-coordinates [[x y z] R3-rect
[theta phi psi] Euler-angles]
(let [e_x (+ (* (cos phi) d:dtheta)
(* -1 (/ (* (sin phi) (cos theta)) (sin theta)) d:dphi)
(* (/ (sin phi) (sin theta)) d:dpsi))
e_y (+ (/ (* (cos phi) (cos theta) d:dphi) (sin theta))
(* (sin phi) d:dtheta)
(* -1 (/ (cos phi) (sin theta)) d:dpsi))
e_z d:dphi
f (literal-manifold-function 'f-Euler Euler-angles)
SO3-point ((point Euler-angles) (up 'theta 'phi 'psi))]
(render
[(((+ (commutator e_x e_y) e_z) f) SO3-point)
(((+ (commutator e_y e_z) e_x) f) SO3-point)
(((+ (commutator e_z e_x) e_y) f) SO3-point)]))) (let-coordinates [[x y z] R3-rect
[theta phi psi] Euler-angles]
(let [e_x (+ (* (cos phi) d:dtheta)
(* -1 (/ (* (sin phi) (cos theta)) (sin theta)) d:dphi)
(* (/ (sin phi) (sin theta)) d:dpsi))
e_y (+ (/ (* (cos phi) (cos theta) d:dphi) (sin theta))
(* (sin phi) d:dtheta)
(* -1 (/ (cos phi) (sin theta)) d:dpsi))
e_z d:dphi
f (literal-manifold-function 'f-Euler Euler-angles)
SO3-point (typical-point Euler-angles)]
(render
((up
((+ (commutator e_x e_y) e_z) f)
((+ (commutator e_y e_z) e_x) f)
((+ (commutator e_z e_x) e_y) f))
SO3-point)))) |
Beta Was this translation helpful? Give feedback.
-
05. IntegrationRemark
(def render (comp ->infix simplify))
(def R3-rect-point ((point R3-rect) (up 'x0 'y0 'z0)))
(def a (literal-manifold-function 'alpha R3-rect))
(def b (literal-manifold-function 'beta R3-rect))
(def c (literal-manifold-function 'gamma R3-rect))
(def X (literal-vector-field 'X-rect R3-rect))
(def Y (literal-vector-field 'Y-rect R3-rect))
(let-coordinates [(up x y z) R3-rect]
(let [theta (+ (* a dx) (* b dy) (* c dz))]
(render
(((- (d theta)
(+ (wedge (d a) dx)
(wedge (d b) dy)
(wedge (d c) dz)))
X Y)
R3-rect-point))))
(def Z (literal-vector-field 'Z-rect R3-rect))
(let-coordinates [(up x y z) R3-rect]
(let [omega (+ (* a (wedge dy dz))
(* b (wedge dz dx))
(* c (wedge dx dy)))]
(render
(((- (d omega)
(+ (wedge (d a) dy dz)
(wedge (d b) dz dx)
(wedge (d c) dx dy)))
X Y Z)
R3-rect-point))))
(def a (literal-manifold-function 'a-rect R3-rect))
(def b (literal-manifold-function 'b-rect R3-rect))
(def c (literal-manifold-function 'c-rect R3-rect))
(def X (literal-vector-field 'X-rect R3-rect))
(def Y (literal-vector-field 'Y-rect R3-rect))
(def Z (literal-vector-field 'Z-rect R3-rect))
(let-coordinates [(up x y z) R3-rect]
(let [flux-through-boundary-element (+ (* a (wedge dy dz))
(* b (wedge dz dx))
(* c (wedge dx dy)))
production-in-volume-element (* (+ (d:dx a) (d:dy b) (d:dz c))
(wedge dx dy dz))]
(render
(((- production-in-volume-element
(d flux-through-boundary-element))
X Y Z)
R3-rect-point)))) |
Beta Was this translation helpful? Give feedback.
-
06. Over a MapRemarks
(let-coordinates [t R1-rect]
(render
(((basis->oneform-basis S2-basis-over-mu)
(basis->vector-basis S2-basis-over-mu))
((point R1-rect) 't0))))
(let-coordinates [t R1-rect]
(render
(((basis->oneform-basis S2-basis-over-mu)
((differential mu) d:dt))
((point R1-rect) 't0))))
Questions
|
Beta Was this translation helpful? Give feedback.
-
07. Directional DerivativesRemarks
(let-coordinates [[x y z] R3-rect]
(let [Jz (- (* x d:dy) (* y d:dx))]
(render
(take 5
((((exp (* 'a (Lie-derivative Jz))) d:dy)
(literal-manifold-function 'f-rect R3-rect))
((point R3-rect) (up 1 0 0)))))))
(require '[sicmutils.calculus.form-field :as ff])
(require '[sicmutils.util.aggregate :as ua])
(require '[sicmutils.generic :as g])
(require '[sicmutils.value :as v])
(defn fdg-covariant-derivative-form
[Cartan]
(fn [V]
(fn [tau]
(let [k (ff/get-rank tau)
nabla_V ((covariant-derivative-vector Cartan) V)
op (fn [& vectors]
(let [vectors (into [] vectors)]
(assert (= k (count vectors)))
(g/- (V (apply tau vectors))
(ua/generic-sum
(fn [i]
(let [xs (update vectors i nabla_V)]
(apply tau xs)))
0 k))))
name `((~'nabla ~(v/freeze V))
~(v/freeze tau))]
(ff/procedure->nform-field op k name)))))
(def states
(coordinate-system-at state-space :rectangular :origin)) Questions
(ns functional-differential-geometry.tmp
(:gen-class)
(:require [sicmutils.env :as e :refer :all]))
(def sphere (make-manifold S2-type 2 3))
(def S2-basis (coordinate-system->basis S2-spherical))
(defn make-S2-Christoffel
"P.107, See `sicmutils.test.sicmutils.calculus.curvature-tests`."
[basis theta]
(let [zero zero-manifold-function
symbols (down (down
(up zero zero)
(up zero (/ 1 (tan theta))))
(down
(up zero (/ 1 (tan theta)))
(up (- (* (sin theta)
(cos theta)))
zero)))]
(make-Christoffel symbols basis)))
(defn transform
"P.109"
[tilt]
(fn [coords]
(let [colat (ref coords 0)
long (ref coords 1)
x (* (sin colat) (cos long))
y (* (sin colat) (sin long))
z (cos colat)
vp ((rotate-x tilt) (up x y z))
colatp (acos (ref vp 2))
longp (atan (ref vp 1) (ref vp 0))]
(up colatp longp))))
(defn tilted-path
"P.110"
[tilt]
(defn coords [t]
((transform tilt) (up (/ pi 2) t)))
(compose (point S2-spherical)
coords
(chart R1-rect)))
;;; P.110: ERROR!
(let-coordinates [(up theta phi) S2-spherical
t R1-rect]
(let [S2-Christoffel (make-S2-Christoffel S2-basis theta)
sphere-Cartan (Christoffel->Cartan S2-Christoffel)
g (fn [gamma Cartan]
(let [omega ((Cartan->forms (Cartan->Cartan-over-map Cartan gamma))
((differential gamma) d:dt))]
(defn the-state-derivative []
(fn [state]
(prn state)
(let [t ((point R1-rect) (ref state 0))
u (ref state 1)]
(up 1 (* -1 (omega t) u)))))
the-state-derivative))]
((state-advancer (g (tilted-path 1) sphere-Cartan))
(up 0 (* ((D (transform 1)) (up (/ pi 2) 0)) (up 1 0)))
(/ pi 2)))) |
Beta Was this translation helpful? Give feedback.
-
Chap08Remarks
(let-coordinates [[r theta phi] R3-spherical]
;; From `sicmutils.test.fdg.ch8_test.cljc`
(let [spherical-Gamma (make-Christoffel
(let [O (fn [x] 0)]
(down
(down (up O O O)
(up O (/ 1 r) O)
(up O O (/ 1 r)))
(down (up O (/ 1 r) O)
(up (* -1 r) O O)
(up O O (/ (cos theta) (sin theta))))
(down (up O O (/ 1 r))
(up O O (/ (cos theta) (sin theta)))
(up (* -1 r (expt (sin theta) 2))
(* -1 (sin theta) (cos theta))
O))))
(coordinate-system->basis R3-spherical))
spherical-Cartan (Christoffel->Cartan spherical-Gamma)]
(render (((Riemann (covariant-derivative spherical-Cartan))
dphi d:dtheta d:dphi d:dtheta)
((point R3-spherical) (up 'r0 'theta0 'phi0))))))
(defn S2-Christoffel
"From `sicmutils.test.sicmutils.calculus.curvature_test`."
[basis theta]
(let [zero zero-manifold-function
symbols (down (down
(up zero zero)
(up zero (/ 1 (tan theta))))
(down
(up zero (/ 1 (tan theta)))
(up (- (* (sin theta)
(cos theta)))
zero)))]
(make-Christoffel symbols basis)))
;;; P.124
(let-coordinates [[theta phi] S2-spherical]
(let [S2-basis (coordinate-system->basis S2-spherical)
S2C (S2-Christoffel S2-basis theta)
sphere-Cartan (Christoffel->Cartan S2C)]
(render
(for [x [d:dtheta d:dphi]
y [d:dtheta d:dphi]]
((((torsion-vector (covariant-derivative sphere-Cartan))
x y)
(literal-manifold-function 'f S2-spherical))
((point S2-spherical) (up 'theta0 'phi0))))))) QuestionsNothing now. |
Beta Was this translation helpful? Give feedback.
-
Chap09Since sritchie is writing new tests and implementations in this pull-request, I only write a memo. Remarks
QuestionsWaiting (TODO)
|
Beta Was this translation helpful? Give feedback.
-
Chap10RemarksQuestions
(let [SR R4-rect]
(let-coordinates [[ct x y z] SR]
(let [an-event ((point SR) ['ct0 'x0 'y0 'z0])
a-vector (+ (* (literal-manifold-function 'v-hat-t SR) d:dct)
(* (literal-manifold-function 'v-hat-x SR) d:dx)
(* (literal-manifold-function 'v-hat-y SR) d:dy)
(* (literal-manifold-function 'v-hat-z SR) d:dz))
g-Minkowski (fn [u v]
(+ (* -1 (dct u) (dct v))
(* (dx u) (dx v))
(* (dy u) (dy v))
(* (dz u) (dz v))))
SR-vector-basis (coordinate-system->vector-basis SR)
p (literal-manifold-function 'phi SR)]
(myutil/render
(((Laplacian g-Minkowski SR-vector-basis) p) an-event))))) |
Beta Was this translation helpful? Give feedback.
-
Chap10, Question Added
(let [SR R4-rect]
(let-coordinates [[ct x y z] SR]
(let [an-event ((point SR) ['ct0 'x0 'y0 'z0])
g-Minkowski (fn [u v]
(+ (* -1 (dct u) (dct v))
(* (dx u) (dx v))
(* (dy u) (dy v))
(* (dz u) (dz v))))
Faraday (fn [Ex Ey Ez Bx By Bz]
(+ (* Ex (wedge dx dct))
(* Ey (wedge dy dct))
(* Ez (wedge dz dct))
(* Bx (wedge dy dz))
(* By (wedge dz dx))
(* Bz (wedge dx dy))))
Maxwell (fn [Ex Ey Ez Bx By Bz]
(+ (* -1 Bx (wedge dx dct))
(* -1 By (wedge dy dct))
(* -1 Bz (wedge dz dct))
(* Ex (wedge dy dz))
(* Ey (wedge dz dx))
(* Ez (wedge dx dy))))
F (Faraday (literal-manifold-function 'Ex SR)
(literal-manifold-function 'Ey SR)
(literal-manifold-function 'Ez SR)
(literal-manifold-function 'Bx SR)
(literal-manifold-function 'By SR)
(literal-manifold-function 'Bz SR))
;; Not explicitly defined in the book
eta-inverse (fn [u v]
(invert (g-Minkowski u v)))
SR-basis (coordinate-system->basis SR)
Force (fn [charge F four-velocity component]
(* -1 charge
(contract
(fn [a b]
(contract
(fn [e w]
(* (w four-velocity)
(F e a)
(eta-inverse b component)))
SR-basis))
SR-basis)))
Ux (fn [beta]
(+ (* (/ 1 (sqrt (- 1 (square beta)))) d:dct)
(* (/ beta (sqrt (- 1 (square beta)))) d:dx)))]
((Force 'q F d:dct dx) an-event))))
|
Beta Was this translation helpful? Give feedback.
-
@sritchie Thank you for your a lot of helpful comments! |
Beta Was this translation helpful? Give feedback.
-
@phasetr I wrote up a full set of errata for FDG that I'll include here. Thanks again!! Errata for FDGChapter 1Page 9: Chapter 3Page 24: the definition of The listing at the bottom of the page assumes Page 38: Note that Chapter 4Page 44: Note that you need to install the (define-coordinates (up x y) R2-rect) Chapter 5Page 60: This page restates: (define-coordinates (up x y z) R3-rect) But assumes that the (define R3-rect-point ((point R3-rect) (up 'x0 'y0 'z0))) Page 60: I was concerned that (define-coordinates (up r theta z) R3-cyl) installs (define-coordinates (up r theta z-cyl) R3-cyl) would be more pedantic, and, maybe, more correct? Or maybe this affects Page 67: the definitions of Page 67 uses (define R2-rect-point ((point R2-rect) (up 'x0 'y0))) Chapter 6Page 75: the definition of (define S2 (make-manifold S^2 2 3)) Chapter 7On page 92, the result at the top of the page is not correct, and ((((partial 1) f-rect) (up 1 0 0))
(* a (((partial 0) f-rect) (up 1 0 0)))
(* -1/2 (expt a 2) (((partial 1) f-rect) (up 1 0 0)))
(* -1/6 (expt a 3) (((partial 0) f-rect) (up 1 0 0)))
(* 1/24 (expt a 4) (((partial 1) f-rect) (up 1 0 0)))) While the book shows: ((((partial 0) f-rect) (up 1 0))
(* -1 a (((partial 1) f-rect) (up 1 0)))
(* -1/2 (expt a 2) (((partial 1) f-rect) (up 1 0)))
(* 1/6 (expt a 3) (((partial 0) f-rect) (up 1 0)))
(* 1/24 (expt a 4) (((partial 1) f-rect) (up 1 0)))) The Page 103: I believe the code listing at the end of the page subs in (((((covariant-derivative R2-polar-Cartan) d/dx) J) f) R2-rect-point) The correct version is: (((((covariant-derivative R2-polar-Cartan) d/dx) circular) f) R2-rect-point) Page 107: the definition of (define-coordinates (up theta phi) S2-spherical) Page 107: The definition of Chapter 8Page 116: The code beginning here requires the (define-coordinates (up theta phi) S2-spherical) Page 127 states "Where (define omega (literal-oneform-field 'omega S2-spherical)) The torsion example on page 127 uses an (let ((X (literal-vector-field ’X-sphere S2-spherical))
(Y (literal-vector-field ’Y-sphere S2-spherical)))
((((torsion-vector nabla) X Y) f) m)) This can be fixed by adding the following to footnote 8's setup instructions: (define f (literal-manifold-function f S2-spherical)) Chapter 9Page 135: I'm not sure if it causes any problems, but Page 136: The code beginning here requires the (define-coordinates (up theta phi) S2-spherical)
(define S2-basis (coordinate-system->basis S2-spherical)) Page 141: The simplifier in the current build of Page 146: The code in section 9.3 requires the (define-coordinates (up t x y z) spacetime-rect)
(define spacetime-rect-basis (coordinate-system->basis spacetime-rect)) Page 147: (define V (literal-function ’V (-> (UP Real Real Real) Real))) Page 147: the expression after "If we evaluate the right-hand side expression (+ (* 1/2 (expt :c 4) rho)
(* 2 (expt :c 2) rho (V (up x y z)))
(* 2 rho (expt (V (up x y z)) 2))) instead of the stated return value: (* 1/2 (expt :c 4) rho) Maybe the shown value is meant to be just the leading term, but this is worth Chapter 10Page 159: the setup block should define (define SR-basis (coordinate-system->basis SR)) If the setup block defined (define SR-vector-basis (basis->vector-basis SR-basis)) Page 159: the Minkowski metric is written with a Including the ;; page 159
(define (g-Minkowski u v)
(+ (* -1 (square ':c) (dct u) (dct v))
(* (dx u) (dx v))
(* (dy u) (dy v))
(* (dz u) (dz v))))
;; page 160
(define SR-vector-basis (down (* (/ 1 ':c) d/dct) d/dx d/dy d/dz))
(define SR-1form-basis (up (* ':c dct) dx dy dz))
(define SR-basis (make-basis SR-vector-basis SR-1form-basis))
(define (Faraday Ex Ey Ez Bx By Bz)
(+ (* Ex ':c (wedge dx dct))
(* Ey ':c (wedge dy dct))
(* Ez ':c (wedge dz dct))
(* Bx (wedge dy dz))
(* By (wedge dz dx))
(* Bz (wedge dx dy))))
;; page 161
(define (Maxwell Ex Ey Ez Bx By Bz)
(+ (* -1 ':c Bx (wedge dx dct))
(* -1 ':c By (wedge dy dct))
(* -1 ':c Bz (wedge dz dct))
(* Ex (wedge dy dz))
(* Ey (wedge dz dx))
(* Ez (wedge dx dy))))
(define (J charge-density Ix Iy Iz)
(- (* (/ 1 ':c) (+ (* Ix dx) (* Iy dy) (* Iz dz)))
(* charge-density 'c dct)))
;; page 163
(((d F) (* (/ 1 ':c) d/dct) d/dy d/dz) an-event)
(((d F) (* (/ 1 ':c) d/dct) d/dz d/dx) an-event)
(((d F) (* (/ 1 ':c) d/dct) d/dx d/dy) an-event)
;; page 164
(((- (d (SR-star F)) (* 4 :pi (SR-star 4-current)))
(* (/ 1 ':c) d/dct) d/dy d/dz)
an-event)
(((- (d (SR-star F)) (* 4 :pi (SR-star 4-current)))
(* (/ 1 ':c) d/dct) d/dz d/dx)
an-event)
(((- (d (SR-star F)) (* 4 :pi (SR-star 4-current)))
(* (/ 1 ':c) d/dct) d/dx d/dy)
an-event) Page 165: In the definition of Chapter 11Page 178: This is not necessarily a "bug", but simplifying the expression Page 180 states "Assume that we have a base frame called (define home
((frame-maker base-frame-point base-frame-chart)
'home 'home))
(define home the-ether) |
Beta Was this translation helpful? Give feedback.
-
It took some long days, but I checked the comments. I think this discussion settled. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When we write codes in Functional Differential Geometry, we manage several discrepancies. It is because we simply does not implement corresponding functions now or we face language specification problems. In the comment the former example is
define-coordinates
andlet-coordinates
, and the latter is a syntactic problem,d/dt
in Scheme andd:dt
in Clojure.I will list up some remarks and questions when coding the book.
Remarks (Added)
Code samples
We have code samples in the test directory, especially here.
Typos in the book
@sritchie summarizes them in the comment.
define-coodinates
@sritchie added
define-coordinates
in a pull request and fix a bug. We should use this macro for the book coding!Beta Was this translation helpful? Give feedback.
All reactions