aboutsummaryrefslogtreecommitdiffstats
path: root/chapters/4-Basis-Fields.scm
blob: 577bd58df47505c7c72b4641b5336452c29c4dac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150

; pre-reqs
(define R2->R (-> (UP Real Real) Real))
(define R2-rect-chi (chart R2-rect))
(define R2-rect-chi-inverse (point R2-rect))
(define R2-polar-chi (chart R2-polar))
(define R2-polar-chi-inverse (point R2-polar))
(define R2-rect-point (R2-rect-chi-inverse (up 'x0 'y0)))
(define R2-polar-point (R2-polar-chi-inverse (up 'r0 'theta0)))

(define-coordinates (up x y) R2-rect)
(define-coordinates (up r theta) R2-polar)

(define e0
  (+ (* (literal-manifold-function 'e0x R2-rect) d/dx)
     (* (literal-manifold-function 'e0y R2-rect) d/dy)))

(define e1
  (+ (* (literal-manifold-function 'e1x R2-rect) d/dx)
     (* (literal-manifold-function 'e1y R2-rect) d/dy)))

(define e-vector-basis (down e0 e1))
(define e-dual-basis
  (vector-basis->dual e-vector-basis R2-polar))

((e-dual-basis e-vector-basis) R2-rect-point)
; (up (down 1 0) (down 0 1))

((e-dual-basis e-vector-basis) R2-polar-point)
; (up (down 1 0) (down 0 1))

; remember, e-vector-basis is "down"
(define v
  (* (up (literal-manifold-function 'b^0 R2-rect)
         (literal-manifold-function 'b^1 R2-rect))
     e-vector-basis))

((e-dual-basis v) R2-rect-point)
; (up (b^0 (up x0 y0)) (b^1 (up x0 y0)))

(define (Jacobian to-basis from-basis)
  (s:map/r (basis->1form-basis to-basis)
           (basis->vector-basis from-basis)))

(define b-rect
  ((coordinate-system->1form-basis R2-rect)
   (literal-vector-field 'b R2-rect)))

(define b-polar
  (* (Jacobian (coordinate-system->basis R2-polar)
               (coordinate-system->basis R2-rect))
     b-rect))

(b-rect ((point R2-rect) (up 'x0 'y0)))
; (up (b^0 (up x0 y0)) (b^1 (up x0 y0)))

(b-polar ((point R2-rect) (up 'x0 'y0)))
; (up (/ (+ (* x0 (b^0 (up x0 y0))) (* y0 (b^1 (up x0 y0))))
;        (sqrt (+ (expt x0 2) (expt y0 2))))
;     (/ (+ (* x0 (b^1 (up x0 y0))) (* -1 y0 (b^0 (up x0 y0))))
;        (+ (expt x0 2) (expt y0 2))))
; same as...
; (x0 b0(m) + y0 b1(m)) / r
; (x0 b1(m) - y0 b0(m)) / r^2

; Commutators

(let* ((polar-basis (coordinate-system->basis R2-polar))
       (polar-vector-basis (basis->vector-basis polar-basis))
       (polar-dual-basis (basis->1form-basis polar-basis))
       (f (literal-manifold-function 'f-rect R2-rect)))
  ((- ((commutator e0 e1) f)
      (* (- (e0 (polar-dual-basis e1))
            (e1 (polar-dual-basis e0)))
         (polar-vector-basis f)))
   R2-rect-point))
; 0

(define-coordinates (up x y z) R3-rect)

(define R3->R (-> (UP Real Real Real) Real))
(define R3-rect-chi (chart R3-rect))
(define R3-rect-chi-inverse (point R3-rect))
(define R3-rect-point (R3-rect-chi-inverse (up 'x0 'y0 'z0)))

(define Jz (- (* x d/dy) (* y d/dx)))
(define Jx (- (* y d/dz) (* z d/dy)))
(define Jy (- (* z d/dx) (* x d/dz)))

; huh, 'g' here was not defined. is it supposed to be a metric? probably not. a function?
;(((+ (commutator Jx Jy) Jz) g) R3-rect-point)
(define g (compose (literal-function 'g-rect R3->R) R3-rect-chi))

; oh, I see, there was a footnote. I defined things a little differently, could have been:

; (define R3-rect (coordinate-system-at 'rectangular 'origin R3))
; (define-coordinates (up x y z) R3-rect)
; (define R3-rect-point ((point R3-rect) (up 'x0 'y0 'z0)))
; (define g (literal-manifold-function 'g-rect R3-rect))


(((+ (commutator Jx Jy) Jz) g) R3-rect-point)
; 0
(((+ (commutator Jy Jz) Jx) g) R3-rect-point)
; 0
(((+ (commutator Jz Jx) Jy) g) R3-rect-point)
; 0

(define Euler-angles (coordinate-system-at 'Euler 'Euler-patch SO3))
(define Euler-angles-chi-inverse (point Euler-angles))
(define-coordinates (up theta phi psi) Euler-angles)
(define SO3-point ((point Euler-angles) (up 'theta 'phi' psi)))
(define f (literal-manifold-function 'f-Euler Euler-angles))

; from p48
(define e_x (+ (* (cos phi) d/dtheta)
               (* -1 (sin phi) (/ (cos theta) (sin theta)) d/dphi)
               (* (/ (sin phi) (sin theta)) d/dpsi)))
(define e_y (+ (* (cos phi) (/ (cos theta) (sin theta)) d/dphi)
               (* (sin phi) d/dtheta)
               (* -1 (/ (cos phi) (sin theta)) d/dpsi)))
(define e_z d/dphi)

(((+ (commutator e_x e_y) e_z) f) SO3-point)
; 0

(((+ (commutator e_y e_z) e_x) f) SO3-point)
; 0

(((+ (commutator e_z e_x) e_y) f) SO3-point)
; 0

; that is a fair amount of computer algebra! verified by fiddling with the
; definition of e_x, and the subtraction no longer comes out to zero

;;; Exercise 4.1 Alternate Angles

; 4.1a


;;; Exersize 4.2 General Commutators

; verify equation (4.38) (not done)

;;; Exersize 4.3 SO(3) Basis and Angular Momentum Basis


((Jx g) R3-rect-point)

((e_x f) SO3-point)