Lie.scm 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. #| -*-Scheme-*-
  2. Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
  3. 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
  4. 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Massachusetts
  5. Institute of Technology
  6. This file is part of MIT/GNU Scheme.
  7. MIT/GNU Scheme is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or (at
  10. your option) any later version.
  11. MIT/GNU Scheme is distributed in the hope that it will be useful, but
  12. WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. General Public License for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with MIT/GNU Scheme; if not, write to the Free Software
  17. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
  18. USA.
  19. |#
  20. #|
  21. ;;; Generalize to rank k.
  22. (define ((Lie-derivative X) Y)
  23. (vector-field? X)
  24. (assert (form-field? Y))
  25. (procedure->1form-field
  26. (lambda (Z)
  27. (- ((Lie-derivative X) (Y Z))
  28. (Y ((Lie-derivative X) Z))))
  29. 'foo))
  30. |#
  31. (define (Lie-derivative X)
  32. (cond ((function? X) ;compatability with SICM Hamiltonian
  33. (make-operator
  34. (lambda (F)
  35. ;(assert (function? F))
  36. (Poisson-bracket F X))
  37. `(Lie-derivative ,X)))
  38. ((vector-field? X)
  39. (make-operator
  40. (lambda (Y)
  41. (cond
  42. ((function? Y) (X Y))
  43. ((vector-field? Y) (commutator X Y))
  44. ((form-field? Y) ; Hawking & Ellis p.29
  45. (let ((k (get-rank Y)))
  46. (procedure->nform-field
  47. (lambda vectors
  48. (assert (= k (length vectors)))
  49. (- ((Lie-derivative X) (apply Y vectors))
  50. (sigma (lambda (i)
  51. (apply Y
  52. (list-with-substituted-coord vectors i
  53. ((Lie-derivative X)
  54. (list-ref vectors i)))))
  55. 0 (- k 1))))
  56. k
  57. `((Lie-derivative ,(diffop-name X))
  58. ,(diffop-name Y)))))
  59. ((structure? Y)
  60. (s:map/r (Lie-derivative X) Y))
  61. (else
  62. (error "Bad argument -- Lie-derivative"))))
  63. `(Lie-derivative ,X)))
  64. (else
  65. (error "Bad vector field -- Lie-derivative"))))
  66. #|
  67. (install-coordinates R3-rect (up 'x 'y 'z))
  68. (define R3-rect-point ((R3-rect '->point) (up 'x0 'y0 'z0)))
  69. (install-coordinates R3-cyl (up 'r 'theta 'zeta))
  70. (define R3-cyl-point ((R3-cyl '->point) (up 'r0 'theta0 'zeta0)))
  71. (define w (literal-1form-field 'w R3-rect))
  72. (define u (literal-1form-field 'u R3-rect))
  73. (define v (literal-1form-field 'v R3-rect))
  74. (define X (literal-vector-field 'X R3-rect))
  75. (define Y (literal-vector-field 'Y R3-rect))
  76. (define Z (literal-vector-field 'Z R3-rect))
  77. (define W (literal-vector-field 'W R3-rect))
  78. (define f (literal-scalar-field 'f R3-rect))
  79. (clear-arguments)
  80. (suppress-arguments (list '(up x0 y0 z0)))
  81. (pec ((((Lie-derivative X) w) Y) R3-rect-point)
  82. (compose arg-suppressor simplify))
  83. #| Result:
  84. (+ (* ((partial 0) w_0) X^0 Y^0)
  85. (* ((partial 0) w_1) X^0 Y^1)
  86. (* ((partial 0) w_2) X^0 Y^2)
  87. (* ((partial 1) w_0) X^1 Y^0)
  88. (* ((partial 1) w_1) X^1 Y^1)
  89. (* ((partial 1) w_2) X^1 Y^2)
  90. (* ((partial 2) w_0) X^2 Y^0)
  91. (* ((partial 2) w_1) X^2 Y^1)
  92. (* ((partial 2) w_2) X^2 Y^2)
  93. (* ((partial 0) X^0) w_0 Y^0)
  94. (* ((partial 1) X^0) w_0 Y^1)
  95. (* ((partial 2) X^0) w_0 Y^2)
  96. (* ((partial 0) X^1) w_1 Y^0)
  97. (* ((partial 1) X^1) w_1 Y^1)
  98. (* ((partial 2) X^1) w_1 Y^2)
  99. (* ((partial 0) X^2) Y^0 w_2)
  100. (* ((partial 1) X^2) Y^1 w_2)
  101. (* ((partial 2) X^2) w_2 Y^2))
  102. |#
  103. (pec ((- ((d ((Lie-derivative X) f)) Y)
  104. (((Lie-derivative X) (d f)) Y) )
  105. R3-rect-point)
  106. (compose arg-suppressor simplify))
  107. #| Result:
  108. 0
  109. |#
  110. (pec ((- ((d ((Lie-derivative X) w)) Y Z)
  111. (((Lie-derivative X) (d w)) Y Z) )
  112. ((R3-rect '->point) (up 'x^0 'y^0 'z^0)))
  113. (compose arg-suppressor simplify))
  114. #| Result:
  115. 0
  116. |#
  117. |#
  118. #|
  119. (install-coordinates R2-rect (up 'x 'y))
  120. (define R2-rect-point ((R2-rect '->point) (up 'x0 'y0)))
  121. (define X (literal-vector-field 'X R2-rect))
  122. (define Y (literal-vector-field 'Y R2-rect))
  123. (define f (literal-scalar-field 'f R2-rect))
  124. (clear-arguments)
  125. (suppress-arguments (list '(up x0 y0)))
  126. (pec ((((Lie-derivative X) Y) f) R2-rect-point)
  127. (compose arg-suppressor simplify))
  128. #| Result:
  129. (+ (* ((partial 0) Y^0) X^0 ((partial 0) f))
  130. (* ((partial 0) Y^1) X^0 ((partial 1) f))
  131. (* ((partial 1) Y^0) X^1 ((partial 0) f))
  132. (* ((partial 1) Y^1) X^1 ((partial 1) f))
  133. (* -1 ((partial 0) X^0) Y^0 ((partial 0) f))
  134. (* -1 ((partial 0) X^1) Y^0 ((partial 1) f))
  135. (* -1 ((partial 1) X^0) ((partial 0) f) Y^1)
  136. (* -1 ((partial 1) X^1) Y^1 ((partial 1) f)))
  137. |#
  138. Let phi_t(x) be the integral curve of V from x for interval t
  139. L_V Y (f) (x) = lim_t->0 ( Y(f) (phi_t (x)) - (d phi_t)(Y)(f)(x))/t
  140. = D (lambda (t)
  141. ( Y(f) (phi_t (x)) - (d phi_t)(Y)(f)(x)))
  142. (t=0)
  143. so let g(t) = ( Y(f) (phi_t (x)) - (d phi_t)(Y)(f)(x))
  144. = ( Y(f) (phi_t (x)) - Y(f circ phi_t)(x))
  145. we only need linear terms in phi_t(x)
  146. Perhaps
  147. phi_t(x) = (I + t v(I))(x)
  148. Is this correct? No!, cannot add to a manifold point. ***********
  149. g(t) = ( Y(f) ((I + t v(I))(x)) - Y(f circ (I + t v(I)))(x))
  150. (define ((((Lie-test V) Y) f) x)
  151. (define (g t)
  152. (- ((Y f) ((+ identity (* t (V identity))) x))
  153. ((Y (compose f (+ identity (* t (V identity))))) x)))
  154. ((D g) 0))
  155. (pec (- ((((Lie-test X) Y) f) R2-rect-point)
  156. ((((Lie-derivative X) Y) f) R2-rect-point)))
  157. #| Result:
  158. 0
  159. |#
  160. ;;; this result is a consequence of confusing manifold points
  161. ;;; with tuples of coordinates in the embedding space.
  162. (clear-arguments)
  163. |#
  164. #|
  165. ;;; Lie derivative satisfies extended Leibnitz rule
  166. (define V (literal-vector-field 'V R2-rect))
  167. (define Y (literal-vector-field 'Y R2-rect))
  168. (define q_0 (up 'q_x 'q_y))
  169. (define m ((R2-rect '->point) q_0))
  170. ;Value: m
  171. (define f (literal-manifold-function 'f R2-rect))
  172. (define e_0 (literal-vector-field 'e_0 R2-rect))
  173. (define e_1 (literal-vector-field 'e_1 R2-rect))
  174. (define vector-basis (down e_0 e_1))
  175. (define 1form-basis (vector-basis->dual (down e_0 e_1) R2-rect))
  176. (define basis (make-basis vector-basis 1form-basis))
  177. (define Y^i (1form-basis Y))
  178. (pe ((- (((Lie-derivative V) Y) f)
  179. (+ (* (s:map/r (Lie-derivative V) Y^i) (vector-basis f))
  180. (* Y^i ((s:map/r (Lie-derivative V) vector-basis) f))))
  181. m))
  182. 0
  183. |#
  184. #|
  185. ;;; Computation of Lie derivatives by difference quotient.
  186. (define X (literal-vector-field 'X R2-rect))
  187. (define Y (literal-vector-field 'Y R2-rect))
  188. (define q_0 (up 'q_x 'q_y))
  189. (define m_0
  190. ((R2-rect '->point) q_0))
  191. (define ((q coords) t)
  192. (+ coords
  193. (* t
  194. ((X (R2-rect '->coords))
  195. ((R2-rect '->point) coords)))))
  196. (define (gamma initial-point)
  197. (compose (R2-rect '->point)
  198. (q ((R2-rect '->coords) initial-point))))
  199. (define ((phi^X t) point)
  200. ((gamma point) t))
  201. (define f (literal-manifold-function 'f R2-rect))
  202. (pe ((D (lambda (t)
  203. (- ((Y f) ((phi^X t) m_0))
  204. ((Y (compose f (phi^X t))) m_0))))
  205. 0))
  206. (+ (* -1 (((partial 1) X^0) (up q_x q_y)) (Y^1 (up q_x q_y)) (((partial 0) f) (up q_x q_y)))
  207. (* -1 (Y^1 (up q_x q_y)) (((partial 1) X^1) (up q_x q_y)) (((partial 1) f) (up q_x q_y)))
  208. (* (((partial 1) Y^0) (up q_x q_y)) (((partial 0) f) (up q_x q_y)) (X^1 (up q_x q_y)))
  209. (* (((partial 0) f) (up q_x q_y)) (((partial 0) Y^0) (up q_x q_y)) (X^0 (up q_x q_y)))
  210. (* -1 (((partial 0) f) (up q_x q_y)) (((partial 0) X^0) (up q_x q_y)) (Y^0 (up q_x q_y)))
  211. (* (((partial 1) Y^1) (up q_x q_y)) (((partial 1) f) (up q_x q_y)) (X^1 (up q_x q_y)))
  212. (* (((partial 1) f) (up q_x q_y)) (((partial 0) Y^1) (up q_x q_y)) (X^0 (up q_x q_y)))
  213. (* -1 (((partial 1) f) (up q_x q_y)) (((partial 0) X^1) (up q_x q_y)) (Y^0 (up q_x q_y))))
  214. (pe ((((Lie-derivative X) Y) f) m_0))
  215. (+ (* -1 (((partial 1) X^0) (up q_x q_y)) (Y^1 (up q_x q_y)) (((partial 0) f) (up q_x q_y)))
  216. (* -1 (Y^1 (up q_x q_y)) (((partial 1) X^1) (up q_x q_y)) (((partial 1) f) (up q_x q_y)))
  217. (* (((partial 1) Y^0) (up q_x q_y)) (((partial 0) f) (up q_x q_y)) (X^1 (up q_x q_y)))
  218. (* (((partial 0) f) (up q_x q_y)) (((partial 0) Y^0) (up q_x q_y)) (X^0 (up q_x q_y)))
  219. (* -1 (((partial 0) f) (up q_x q_y)) (((partial 0) X^0) (up q_x q_y)) (Y^0 (up q_x q_y)))
  220. (* (((partial 1) Y^1) (up q_x q_y)) (((partial 1) f) (up q_x q_y)) (X^1 (up q_x q_y)))
  221. (* (((partial 1) f) (up q_x q_y)) (((partial 0) Y^1) (up q_x q_y)) (X^0 (up q_x q_y)))
  222. (* -1 (((partial 1) f) (up q_x q_y)) (((partial 0) X^1) (up q_x q_y)) (Y^0 (up q_x q_y))))
  223. (pe (- ((D (lambda (t)
  224. (- ((Y f) ((phi^X t) m_0))
  225. ((Y (compose f (phi^X t))) m_0))))
  226. 0)
  227. ((((Lie-derivative X) Y) f) m_0)))
  228. 0
  229. (pe (- ((D (lambda (t)
  230. (- ((Y f) ((phi^X t) m_0))
  231. ((((pushforward-vector (phi^X t) (phi^X (- t)))
  232. Y)
  233. f)
  234. ((phi^X t) m_0)))))
  235. 0)
  236. ((((Lie-derivative X) Y) f) m_0)))
  237. 0
  238. (pe (- ((D (lambda (t)
  239. ((((pushforward-vector (phi^X (- t)) (phi^X t))
  240. Y)
  241. f)
  242. m_0)))
  243. 0)
  244. ((((Lie-derivative X) Y) f) m_0)))
  245. 0
  246. |#
  247. #|
  248. (define m ((R2-rect '->point) (up 'x 'y)))
  249. (define V (literal-vector-field 'V R2-rect))
  250. (define Y (literal-vector-field 'Y R2-rect))
  251. (define f (literal-manifold-function 'f R2-rect))
  252. (define e_0 (literal-vector-field 'e_0 R2-rect))
  253. (define e_1 (literal-vector-field 'e_1 R2-rect))
  254. (define vector-basis (down e_0 e_1))
  255. (define 1form-basis (vector-basis->dual (down e_0 e_1) R2-rect))
  256. (define e^0 (ref 1form-basis 0))
  257. (define e^1 (ref 1form-basis 1))
  258. (define basis (make-basis vector-basis 1form-basis))
  259. (define (Delta^i_j v)
  260. (1form-basis (s:map/r (Lie-derivative v) vector-basis)))
  261. ;;; Verifying equation 0.184
  262. (pec ((- (((Lie-derivative V) Y) f)
  263. (* (vector-basis f)
  264. (+ (V (1form-basis Y))
  265. (* (1form-basis Y) (Delta^i_j V)))))
  266. m))
  267. #| Result:
  268. 0
  269. |#
  270. ;;; Indeed, a painful detail:
  271. (pec ((- (* (1form-basis Y) ((s:map/r (Lie-derivative V) vector-basis) f))
  272. (* (1form-basis Y) (Delta^i_j V) (vector-basis f)))
  273. m))
  274. #| Result:
  275. 0
  276. |#
  277. ;;; Even simpler
  278. (pec ((- (* ((s:map/r (Lie-derivative V) vector-basis) f))
  279. (* (Delta^i_j V) (vector-basis f)))
  280. m))
  281. #| Result:
  282. (down 0 0)
  283. |#
  284. |#