grgcoper.sl 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404
  1. %==========================================================================%
  2. % GRGcoper.sl Operators and Transformations %
  3. %==========================================================================%
  4. % GRG 3.2 Standard Lisp Source Code (C) 1988-96 Vadim V. Zhytnikov %
  5. %==========================================================================%
  6. % This file is distributed without any warranty. You may modify it but you %
  7. % are not allowed to remove author's name and/or distribute modified file. %
  8. %==========================================================================%
  9. %--- Spinorial rotation 13.03.91, 05.96 ---------------------------------
  10. % Main function ...
  11. (de rotas!> (lst) % 05.96
  12. (prog2
  13. (setq lst (errorset!> (list 'rotas0!> (list 'quote lst))
  14. ![erst1!] ![erst2!]))
  15. (cond ((atom lst) (erm!> lst) (erm!> 8803) (msg!> 88033) !!er!!)
  16. (t (car lst))) ))
  17. (de rotas0!> (lst) % 05.96
  18. (proc (w wa wm wr wc)
  19. (cond ((sp!>) (setq ![er!] 78041) (return !!er!!))) % null metric!
  20. (setq wm '(mat (0 1) (-1 0)))
  21. (cond ((null lst) (prog2 (setq wr t) (go lab)))) % matrix from ls
  22. % translating the rotation matrix ...
  23. (cond ((or (atom lst) (cdr lst) (atom(car lst)))
  24. (setq ![er!] 8500) (return !!er!!)))
  25. (setq lst (memlist!> '!, (car lst)))
  26. (cond ((or (eq lst !!er!!) (not(eqn (length lst) 2)))
  27. (setq ![er!] 8500) (return !!er!!)))
  28. (while!> lst
  29. (setq wa (car lst))
  30. (setq lst (cdr lst))
  31. (cond ((or (cdr wa) (atom(car wa)))
  32. (setq ![er!] 8500) (return !!er!!)))
  33. (setq wa (memlist!> '!, (car wa)))
  34. (cond ((or (eq wa !!er!!) (not(eqn (length wa) 2)))
  35. (setq ![er!] 8500) (return !!er!!)))
  36. (setq wa (mapcar wa (function translate!>)))
  37. (cond ((memq !!er!! wa) (return !!er!!)))
  38. (setq wa (mapcar wa 'nullzero!>))
  39. (cond ((memq !!er!! wa) (setq ![er!] 8500) (return !!er!!)))
  40. (setq w (cons wa w)))
  41. lab % here we should have the matrix ...
  42. (cond (wr (cond (!#!L!S (setq w !#!L!S))
  43. (t (setq ![er!] 4001) (return !!er!!))))
  44. (t (setq w (reverse w))))
  45. (setq wa (aeval (list 'times (cons 'mat w)
  46. wm
  47. (list2 'tp (cons 'mat w)) )))
  48. (cond ((not(equal wa wm)) % chek for sl(2,c)
  49. (setq ![er!] 8501) (return !!er!!)))
  50. (setq ![ls!] w)
  51. (ls!-li!>) % ls -> li
  52. (li!-l!>) % li -> l
  53. (setq w (altdata!>(alldata!>)))
  54. (setq ![dens!] nil) % no density for spinorial rotations
  55. (while!> w % rotate all known objects ...
  56. (setq wc (car w))
  57. (cond ((or (memq wc % skipping silently ...
  58. '( ![cord!] ![const!] ![fun!] ![sol!] ![apar!]
  59. !#!L !#!L!S !#!b !#!e ))
  60. (null(get wc '!=idxl))) nil)
  61. ((flagp wc '!+hold) (nonrot!> wc)) % skipping noisily...
  62. (t % rotating particular object ...
  63. (set wc (allcoll!> (eval wc) wc nil
  64. (cond ((get wc '!=idxl) (get wc '!=idxl))
  65. (t '(0)))
  66. (function rotatel!>)))
  67. (cond
  68. ((flagp wc '!+uconn) (gammascorrect!> (eval wc) nil))
  69. ((flagp wc '!+dconn) (gammascorrect!> (eval wc) t))
  70. ((flagp wc '!+fconn) (gammacorrect!> (eval wc) )))
  71. ))
  72. (setq w (cdr w)))
  73. (clearandfinish!>)))
  74. (de clearandfinish!> nil % 05.96
  75. (progn
  76. % clearing all matrices ...
  77. (setq ![l!] nil)
  78. (setq ![li!] nil)
  79. (setq ![dl!] nil)
  80. (setq ![sdl!] nil)
  81. (setq ![ls!] nil)
  82. (setq ![dens!] nil)
  83. (setq ![dex!] nil)
  84. (setq ![dfx!] nil)
  85. (setq ![x!] nil)
  86. % new types of frame and metric ...
  87. (ftype!>)
  88. (mtype!>)
  89. (fitype!>)
  90. (mitype!>)
  91. % done message ...
  92. (done!>) ))
  93. % Build tensorial rotation from spinorial ...
  94. (de ls!-li!> nil % 05.96
  95. (prog (wa wb)
  96. (setq ![li!] (mkt!> 2))
  97. (fordim!> a do (fordim!> b do (progn
  98. (setq wa (tenspini!> a))
  99. (setq wb (tenspini!> b))
  100. (putel!> (evalalg!>(list 'times (getel2!> ![ls!] (car wb) (car wa))
  101. (coalg!>(getel2!> ![ls!] (cdr wb) (cdr wa)))))
  102. ![li!] (list2 b a)))))))
  103. (de tenspini!> (w) % 05.96
  104. (cond ((eqn w 0) '(1 . 1))
  105. ((eqn w 1) '(0 . 0))
  106. ((eqn w 2) '(1 . 0))
  107. ((eqn w 3) '(0 . 1))))
  108. % Build inverse transposed matrix ...
  109. (de li!-l!> nil % 05.96
  110. (progn (setq ![l!] (mkt!> 2))
  111. (rmat!> ![l!] (aeval(list 'quotient 1
  112. (list 'tp (mat!> ![li!])))))))
  113. (de l!-li!> nil
  114. (progn (setq ![li!] (mkt!> 2))
  115. (rmat!> ![li!]
  116. (aeval(list 'quotient 1 (list 'tp (mat!> ![l!])))))))
  117. % Correction for spinorial connection ...
  118. % WB=NIL - Undotted, WB=T - Dotted
  119. (de gammascorrect!> (w wb) % 05.96
  120. (progn
  121. (putel1!> (evalform!> (dfsum!> (list
  122. (getel1!> w 0)
  123. (fndfpr!> (ls!> 0 1 wb) (dfunsgn!>(ls!> 0 0 wb)))
  124. (chsign!> t (fndfpr!> (ls!> 0 0 wb) (dfunsgn!>(ls!> 0 1 wb)))))))
  125. w 0)
  126. (putel1!> (evalform!> (dfsum!> (list
  127. (getel1!> w 1)
  128. (fndfpr!> (ls!> 1 1 wb) (dfunsgn!>(ls!> 0 0 wb)))
  129. (chsign!> t (fndfpr!> (ls!> 1 0 wb) (dfunsgn!>(ls!> 0 1 wb)))))))
  130. w 1)
  131. (putel1!> (evalform!> (dfsum!> (list
  132. (getel1!> w 2)
  133. (fndfpr!> (ls!> 1 1 wb) (dfunsgn!>(ls!> 1 0 wb)))
  134. (chsign!> t (fndfpr!> (ls!> 1 0 wb) (dfunsgn!>(ls!> 1 1 wb)))))))
  135. w 2)))
  136. (de dfunsgn!> (lst) % 05.96
  137. (cond ((pmmm!>) (chsign!> t (dfun!> lst)))
  138. (t (dfun!> lst))))
  139. % aux function ...
  140. (de nullzero!> (w) % 05.96
  141. (cond ((null w) nil)
  142. ((zerop(car w)) (cdr w))
  143. (t !!er!!)))
  144. %--- Rotation of single element 03.91, 05.96 ---------------------------
  145. % WI - Current Indices, WN - Internal Variable
  146. (de rotatel!> (lst wi wn)
  147. (cond
  148. ((syaidxp!> wi (get wn '!=sidxl)) % if wi is in canonic order ...
  149. (cond
  150. (![dens!] (dcorr!> wn (rotatel1!> wi nil (get wn '!=idxl) wn t nil)))
  151. (t (rotatel1!> wi nil (get wn '!=idxl) wn t nil))))
  152. (t nil)))
  153. % WA,WI - Current Indices, WD - IDXL, WN - Int. Variable
  154. (de rotatel1!> (wi wa wd wn wf wc) % 05.96
  155. (cond
  156. % Last element (IDXL is empty), so getting the value of the element
  157. ((null wd) (getsa0!> wn (reverse wa)))
  158. % Enumerating or Holonomic index, skipping ...
  159. ((or (enump!> (car wd)) (holp!> (car wd)))
  160. (rotatel1!> (cdr wi)
  161. (cons (car wi) wa)
  162. (cdr wd)
  163. wn t nil))
  164. % Spinorial index ...
  165. ((spinp!>(car wd)) (prog (w wl we wx)
  166. (cond (wf (setq wa (cons 0 wa))
  167. (setq wc (dotp!>(car wd)))
  168. (setq wf nil)))
  169. (foreach!> x in '(0 1) do (progn
  170. (setq wx (cond ((lessp (car wi) (cdar wd)) 0) (t 1)))
  171. (cond
  172. ((upperp!>(car wd))
  173. (setq wl (lsi!> wx x wc)))
  174. (t (setq wl (ls!> wx x wc))))
  175. (cond (wl (progn
  176. (setq we (rotatel1!>
  177. (cond ((eqn (cdar wd) 1) (cdr wi)) (t wi))
  178. (cons (plus (car wa) x) (cdr wa))
  179. (cond ((eqn (cdar wd) 1) (cdr wd))
  180. (t (cons (cons (caar wd) (sub1(cdar wd)))
  181. (cdr wd))))
  182. wn
  183. (cond ((eqn (cdar wd) 1) t) (t nil))
  184. wc
  185. ))
  186. (cond (we (setq w
  187. (cons (cond ((algp!> wn) (multax!> wl we))
  188. (t (multfx!> wl we)))
  189. w)))))))))
  190. (return (cond ((null w) nil)
  191. ((algp!> wn) (summax!> w))
  192. (t (summfx!> w))))))
  193. % Frame index ...
  194. (t(prog (w wl we)
  195. (fordim!> x do (progn
  196. (setq wl (lli!> (car wi) x (car wd)))
  197. (cond (wl (progn
  198. (setq we (rotatel1!>
  199. (cdr wi)
  200. (cons x wa)
  201. (cdr wd)
  202. wn t nil))
  203. (cond (we (setq w
  204. (cons (cond ((algp!> wn) (multax!> wl we))
  205. (t (multfx!> wl we)))
  206. w)))))))))
  207. (return (cond ((null w) nil)
  208. ((algp!> wn) (summax!> w))
  209. (t (summfx!> w))))))))
  210. % Element of LS matrix or ~LS matrix ...
  211. (de ls!> (wa wb wc) % 05.96
  212. (cond (wc (coalg!> (getel2!> ![ls!] wa wb)))
  213. (t (getel2!> ![ls!] wa wb))))
  214. % Element of inverse transposed spinorial matrix ...
  215. (de lsi!> (wa wb wc) % 05.96
  216. (cond ((and (eqn wa 0) (eqn wb 0)) (ls!> 1 1 wc))
  217. ((and (eqn wa 0) (eqn wb 1)) (chsigna!> (ls!> 1 0 wc)))
  218. ((and (eqn wa 1) (eqn wb 0)) (chsigna!> (ls!> 0 1 wc)))
  219. ((and (eqn wa 1) (eqn wb 1)) (ls!> 0 0 wc))))
  220. % Element of L or LI matrix ...
  221. (de lli!> (wa wb wc) % 05.96
  222. (cond (wc (getel2!> ![l!] wa wb))
  223. (t (getel2!> ![li!] wa wb))))
  224. %---------- Tensorial rotation 15.03.91, 05.96 ---------------------------
  225. % Main function ...
  226. (de rotat!> (lst bool) % 05.96
  227. (prog2
  228. (setq lst (errorset!> (list 'rotat0!> (list 'quote lst) bool)
  229. ![erst1!] ![erst2!]))
  230. (cond ((atom lst) (erm!> lst) (erm!> 8803) (msg!> 88033) !!er!!)
  231. (t (car lst))) ))
  232. % BOOL=T - Transformation, BOOL=NIL - Rotation
  233. (de rotat0!> (lst bool)
  234. (proc (w wa wm we wb wr wd wc)
  235. (cond ((null bool) % for rotation we need metric ...
  236. (setq ![chain!] nil)
  237. (setq we (request!> '!#!G))
  238. (cond ((eq we !!er!!) (return we))
  239. ((null we) (trsf!> '!#!G)
  240. (prin2 "Cannot perform rotation without Metric.")
  241. (terpri) (setq ![er!] 6046) (return !!er!!))) ))
  242. (cond ((null lst) (prog2 (setq wr t) (go lab))))% matrix from L
  243. (cond ((or (atom lst) (cdr lst) (atom(car lst)))% matrix in the command
  244. (prog2 (setq ![er!] 8500) (return !!er!!))))
  245. (setq lst (memlist!> '!, (car lst)))
  246. (cond((or (eq lst !!er!!) (not(eqn (length lst) ![dim!])))
  247. (prog2 (setq ![er!] 8500) (return !!er!!))))
  248. (while!> lst
  249. (setq wa (car lst)) (setq lst(cdr lst))
  250. (cond((or(cdr wa)(atom(car wa)))
  251. (prog2 (setq ![er!] 8500) (return !!er!!))))
  252. (setq wa (memlist!> '!, (car wa)))
  253. (cond ((or (eq wa !!er!!) (not(eqn (length wa) ![dim!])))
  254. (prog2 (setq ![er!] 8500) (return !!er!!))))
  255. (setq wa (mapcar wa (function translate!>)))
  256. (cond ((memq !!er!! wa) (return !!er!!)))
  257. (setq wa (mapcar wa 'nullzero!>))
  258. (cond ((memq !!er!! wa) (prog2 (setq ![er!] 8500) (return !!er!!))))
  259. (setq w (cons wa w)) )
  260. lab % here in w we should have the matrix already ...
  261. (cond (wr (cond (!#!L (setq w !#!L))
  262. (t (prog2 (setq ![er!] 4001) (return !!er!!)))))
  263. (t (setq w (reverse w))))
  264. (cond (bool(go lab1))) % transformation -> skipping correct rotation
  265. % checking for correct rotation ...
  266. (setq wm !#!G)
  267. (setq wm (cons 'mat (mapcar wm 'aeval2!>)))
  268. (setq wa (aeval (list 'times (cons 'mat w)
  269. wm
  270. (list2 'tp (cons 'mat w)) )))
  271. (cond ((not (equal wa wm)) % check for correct rotation
  272. (prog2 (setq ![er!] 8502) (return !!er!!))))
  273. lab1
  274. % Here W is the matrix ...
  275. (setq wd (raeval!>(list 'det (cons 'mat w)))) % wd=detl
  276. (cond ((or (null wd) (zerop wd))
  277. (prog2 (setq ![er!] 8504) (return !!er!!))))
  278. (setq ![l!] w)
  279. (setq ![dl!] wd)
  280. % The most sabtle point in all machinery with densityes
  281. % and pseudotensors. We choose sign factor as
  282. % sdl = detL * sqrt(1/(detL)^2) <- we use this!
  283. % this gives transformation for pseudo tensors consistent
  284. % with their calculation after transformation. The sabtle
  285. % point is for imagenary detL this definition of sdl is
  286. % quite strange and is different from another
  287. % sdl1 = detL/sqrt((detL)^2)
  288. % in fact for positive real "a" we have:
  289. % detL: sdl: sdl1:
  290. % a 1 1
  291. % -a -1 -1
  292. % i*a -1 1
  293. % -i*a 1 -1
  294. % Actually the whole problem is in the way how to choose
  295. % the branch of sqrt.
  296. (setq ![sdl!] (raeval!>
  297. (list 'times ![dl!]
  298. (list 'sqrt (list 'quotient 1
  299. (list 'expt ![dl!] 2))))))
  300. (l!-li!>)
  301. (setq w (altdata!>(alldata!>)))
  302. (while!> w
  303. (setq wc (car w))
  304. (cond ((memq wc '(![cord!] ![const!] ![fun!] ![sol!] ![apar!]
  305. !#!b !#!e ))
  306. nil)
  307. ((flagp wc '!+hold) (nonrot!> wc))
  308. ((isspinor!> wc) (nonrot!> wc))
  309. (t (prepldens!> wc)
  310. (set wc
  311. (allcoll!> (eval wc ) wc nil
  312. (cond ((get wc '!=idxl) (get wc '!=idxl))
  313. (t '(0)))
  314. (function rotatel!>)))
  315. (cond
  316. ((flagp wc '!+fconn) (gammacorrect!> (eval wc) )))
  317. ))
  318. (setq w (cdr w)))
  319. (clearandfinish!>)))
  320. (de aeval2!> (w) (mapcar w 'aeval1!>))
  321. (de aeval1!> (w) (aeval(nz!> w)))
  322. % Correction for connection ...
  323. (de gammacorrect!> (w) % 05.96
  324. (fordim!> a do
  325. (fordim!> b do
  326. (putel!>
  327. (evalform!> (dfsum!> (cons (getel2!> w a b)
  328. (mkldli!> a b))))
  329. w (list2 a b)))))
  330. (de mkldli!> (wa wb) % 05.96
  331. (foreach!> wx in (dimlist!> 0) collect
  332. (fndfpr!> (getel2!> ![l!] wa wx)
  333. (dfun!> (getel2!> ![li!] wb wx)))))
  334. (de nonrot!> (wd) % 05.96
  335. (progn (gprinreset!>)
  336. (gprin!> "WARNING: ")
  337. (pn!> wd)
  338. (gprils0!> (cond
  339. ((flagp wd '!+pl) '("remain" "unchanged."))
  340. (t '("remains" "unchanged."))))
  341. (gterpri!>)))
  342. (de dcorr!> (wn w)
  343. (cond ((algp!> wn) (multax!> ![dens!] w))
  344. (t (multfx!> ![dens!] w))))
  345. (de prepldens!> (wn)
  346. (prog (w)
  347. (setq w (get wn '!=dens))
  348. (cond
  349. ((null w)
  350. (setq ![dens!] nil))
  351. ((and (null(caddr w)) (null(cadddr w)))
  352. (setq ![dens!] nil))
  353. ((null(cadddr w))
  354. (setq ![dens!] ![sdl!]))
  355. ((null(caddr w))
  356. (setq ![dens!] (list 'expt ![dl!] (cadddr w))))
  357. (t (setq ![dens!]
  358. (list 'times ![sdl!] (list 'expt ![dl!] (cadddr w))))))
  359. (return ![dens!])))
  360. %--- Coordinates Transformations 25.02.91, 05.96 -------------------------
  361. % Main Function ...
  362. (de chcoord!> (lst)
  363. (prog2
  364. (setq lst (errorset!> (list 'chcoord0!> (list 'quote lst))
  365. ![erst1!] ![erst2!]))
  366. (cond ((atom lst) (erm!> lst) (erm!> 8803) (msg!> 88033) !!er!!)
  367. (t (car lst))) ))
  368. (de chcoord0!> (lst) % 05.96 ...
  369. (proc (w wn wa wb wd)
  370. (cond ((null lst) (return nil)))
  371. (setq wn 0)
  372. (setq ![xb!] nil)
  373. (while!> (and lst (not(eqs!> (car lst) 'with))) % word!!!
  374. (setq w (cons (car lst) w))
  375. (setq lst (cdr lst)))
  376. (cond ((or (null w) (null lst) (null(cdr lst)))
  377. (setq ![er!] 8375) (return !!er!!)))
  378. (setq w (memlist!> '!, (reverse w)))
  379. (setq lst (memlist!> '!, (cdr lst)))
  380. (cond ((or (eq w !!er!!)
  381. (eq lst !!er!!)
  382. (not(eqn (length lst) ![dim!]))
  383. (not(eqn (length w) ![dim!])))
  384. (setq ![er!] 8375) (return !!er!!)))
  385. (setq ![ocord!] ![cord!])
  386. (setq ![cord!] nil)
  387. (while!> w % new coordinates list ...
  388. (cond ((or (cdar w) (not(idp(caar w))))
  389. (setq ![er!] 8375) (remnew!>) (return !!er!!)))
  390. (cond ((flagp(caar w) '!+grg)
  391. (setq ![er!] 5013) (doub!>(caar w)) (remnew!>) (return !!er!!)))
  392. (flag (car w) 'used!*)
  393. (flag (car w) '!+grgvar)
  394. (flag (car w) '!+grg)
  395. (put (caar w) '!=cord wn)
  396. (cond (![apar!] (depend (cons (caar w) ![apar!]))))
  397. (setq ![cord!] (cons (caar w) ![cord!]))
  398. (setq wn (add1 wn))
  399. (setq w (cdr w)))
  400. (setq ![cord!] (reverse ![cord!]))
  401. (setq ![dfx!] (mkt!> 1))
  402. (setq ![x!] (mkt!> 1))
  403. (while!> lst % x = f(x') ...
  404. (setq wa (car lst))
  405. (setq lst (cdr lst))
  406. (cond ((or (null(cdr wa)) (null(cddr wa))
  407. (not(eq (cadr wa) '=)) (not(idp(car wa)))
  408. (not (memq (car wa) ![ocord!])) )
  409. (setq ![er!] 8375) (remnew!>) (return !!er!!))
  410. ((memold!> (cddr wa))
  411. (setq ![er!] 8388) (remnew!>) (return !!er!!)))
  412. (setq wb (translate!>(cddr wa)))
  413. (cond ((eq wb !!er!!) (remnew!>) (return !!er!!))
  414. ((not(zerop(car wb)))
  415. (setq ![er!] 8389) (remnew!>) (return !!er!!)))
  416. (setq wd (evalform!> (dfun1!> (cdr wb) nil)))
  417. (putel1!> (cdr wb) ![x!] (get (car wa) '!=cord))
  418. (putel1!> wd ![dfx!] (get (car wa) '!=cord)) )
  419. (setq w (evalform!>(dfprod!> ![dfx!])))
  420. (cond ((null w) (setq ![er!] 8377)(remnew!>)(return !!er!!)))
  421. (setq ![dbas!] nil)
  422. (idfx!>) % d x -> /d x
  423. (ncfdep!>) % rebuilding implicit dependence
  424. (evalcomm!> '(all) (function ncel!>)) % transform all objects ...
  425. (remold!>) % remove old coordinates
  426. (copar1!> (ncons ![cord!])) % conjugated pairs
  427. (cond (![umod!] (mktables!>))) % refreshing tables in amode
  428. % now transforming holonomic indices ...
  429. (crotat0!>)
  430. % finish ...
  431. (clearandfinish!>)))
  432. (de ncel!> (lst wi wn)
  433. (cond ((null lst) nil)
  434. % in holonomic regime frame/inv frame stay holonomic
  435. ((and (eq wn '!#!T) (holonomicp!>)) lst)
  436. ((and (eq wn '!#!D) (holonomicp!>)) lst)
  437. ((eq wn '!#!b) (ncform0!> lst)) % b
  438. ((eq wn '!#!e) (ncvec0!> lst)) % e
  439. ((and (zerop(gettype!> wn)) (not (flagp wn '!+equ))) % alg
  440. (ncalg!> lst))
  441. ((and (eqn(gettype!> wn)-1)(not (flagp wn '!+equ))) % vec
  442. (ncvec!> lst))
  443. ((not (flagp wn '!+equ)) % form
  444. (ncform!> lst))
  445. ((zerop(gettype!> wn)) % eq alg
  446. (equation!> (ncalg!>(cadr lst)) (ncalg!>(caddr lst))))
  447. ((eqn(gettype!> wn)-1) % eq vec
  448. (equation!> (ncvec!>(cadr lst)) (ncvec!>(caddr lst))))
  449. (t % eq alg
  450. (equation!> (ncform!>(cadr lst)) (ncform!>(caddr lst))))
  451. ))
  452. % New coord for algebraic expression ...
  453. (de ncalg!> (w)
  454. (cond ((null w) w)
  455. (t (evalalg!> (ncalg0!> w)))))
  456. (de ncalg0!> (w)
  457. (cond ((and (idp w) (get w '!=cord))
  458. (getel1!> ![x!] (get w '!=cord)))
  459. ((atom w) w)
  460. ((eq (car w) 'dfp) (list 'dfp (ncalg!>(cadr w)) (caddr w)))
  461. ((eq (car w) 'df) (ncdf!> (ncalg!>(cadr w)) (cddr w)))
  462. ((or (eq (car w) '!*sq) (eq (car w) 'taylor!*)) (err!> 9999))
  463. (t (mapcar w (function ncalg0!>)))))
  464. % New coord for DF(...) ...
  465. (de ncdf!> (w wl) % w - expr, wl - diff list
  466. (cond ((null wl) w)
  467. (t(prog (wb wn wd)
  468. % wd - diff or number of coordinate
  469. (cond ((and (atom(car wl)) (memq (car wl) ![ocord!]))
  470. (setq wd (get (car wl) '!=cord)))
  471. (t (prog2 (setq wb t) (setq wd (car wl)))))
  472. % wn - how many times
  473. (cond ((and (cdr wl) (numberp(cadr wl)))
  474. (prog2 (setq wn (cadr wl)) (setq wl (cddr wl))))
  475. (t (prog2 (setq wn 1) (setq wl (cdr wl)))))
  476. % not coordinate, so exiting
  477. (cond (wb
  478. (return (ncdf!> (list 'df w (ncalg!> wd) wn) wl))))
  479. (setq wd (getel1!> ![dex!] wd))
  480. % we diffentiate wn times
  481. (for!> x (1 1 wn) do (setq w (vfun!> wd w)))
  482. (return (ncdf!> w wl))))))
  483. % New coord for form ...
  484. (de ncform!> (w)
  485. (cond ((null w) w)
  486. (t (evalform!> (dfsum!> (mapcar w (function ncform1!>)))))))
  487. (de ncform1!> (w)
  488. (fndfpr!> (ncalg!> (car w))
  489. (ncxb!> (cdr w) ![umod!])))
  490. % New coord for d X/\d Y/\...
  491. (de ncxb!> (w wm)
  492. (cond
  493. (wm (ncons (cons 1 w)))
  494. ((assoc (car w) ![xb!]) (cadr(assoc (car w) ![xb!])))
  495. (t(progn
  496. (setq ![xb!] (cons
  497. (list2 (car w) (evalform!> (mkxb!>(cdr w))))
  498. ![xb!]))
  499. (cadar ![xb!])))))
  500. (de mkxb!> (w)
  501. (proc (wa wn)
  502. (setq wn 0)
  503. (while!> w
  504. (cond ((caar w) (setq wa (cons (getel1!> ![dfx!] wn) wa))))
  505. (setq wn (add1 wn))
  506. (setq w (cdr w)))
  507. (return (evalform!> (dfprod!> (reverse wa))))))
  508. (de ncform0!> (w)
  509. (cond ((null w) w)
  510. (t (evalform!> (dfsum!> (mapcar w (function ncform00!>)))))))
  511. (de ncform00!> (w)
  512. (fndfpr!> (ncalg!> (car w))
  513. (ncxb!> (cdr w) nil)))
  514. % New coord for vector ...
  515. (de ncvec!> (w)
  516. (cond ((null w) w)
  517. (t (evalform!> (dfsum!> (mapcar w (function ncvec1!>)))))))
  518. (de ncvec1!> (w)
  519. (fndfpr!> (ncalg!> (car w))
  520. (ncxv!> (cdr w) ![umod!])))
  521. (de ncxv!> (w wm)
  522. (proc (wc)
  523. (cond (wm (return (ncons (cons 1 w)))))
  524. (setq wc -1)
  525. (setq w (car w))
  526. (while!> (not(eqn w 1))
  527. (setq w (quotient w 2))
  528. (setq wc (add1 wc)) )
  529. (return (getel1!> ![dex!] wc)) ))
  530. (de ncvec0!> (w)
  531. (cond ((null w) w)
  532. (t (evalform!> (dfsum!> (mapcar w (function ncvec00!>)))))))
  533. (de ncvec00!> (w)
  534. (fndfpr!> (ncalg!> (car w))
  535. (ncxv!> (cdr w) nil)))
  536. % d x -> /d x
  537. (de idfx!> nil
  538. (prog (w)
  539. (setq ![dex!] (mkt!> 1))
  540. (setq w (aeval (list 'tp (list 'quotient 1 (mkmtetr!> ![dfx!])))))
  541. (mktetrm!> (cdr w) ![dex!])
  542. (return t)))
  543. % New coord for implicit function dependence ...
  544. (de ncfdep!> nil
  545. (prog (wd wn)
  546. (foreach!> x in ![fun!] do (prog2
  547. (setq wd (get x '!=depend))
  548. (cond (wd (progn
  549. (setq wn (vard!> (ncalg0!> wd)))
  550. (nodepend wd)
  551. (depend wn)
  552. (put x '!=depend wn))))))))
  553. (de vard!> (lst)
  554. (cond ((and (atom lst) (flagp lst '!+grgvar)) (ncons lst))
  555. ((atom lst) nil)
  556. (t (appmem!> (vard!>(car lst)) (vard!>(cdr lst))))))
  557. (de memold!> (w)
  558. (cond ((and (atom w) (memq w ![ocord!])) t)
  559. ((atom w) nil)
  560. (t (or (memold!>(car w)) (memold!>(cdr w))))))
  561. (de remold!> nil
  562. (progn (remflag ![ocord!] '!+grg)
  563. (remflag ![ocord!] '!+grgvar)
  564. (remflag ![ocord!] 'used!*)
  565. (foreach!> x in ![ocord!] do (progn
  566. (cond (![apar!] (nodepend (cons x ![apar!]))))
  567. (remprop x '!=cord)
  568. (remprop x '!=conj)))
  569. (setq ![xb!] nil)
  570. (setq ![ocord!] nil)
  571. ))
  572. (de remnew!> nil
  573. (progn (remflag ![cord!] '!+grg)
  574. (remflag ![cord!] '!+grgvar)
  575. (remflag ![cord!] 'used!*)
  576. (foreach!> x in ![cord!] do (progn
  577. (cond (![apar!] (nodepend (cons x ![apar!]))))
  578. (remprop x '!=cord)))
  579. (setq ![cord!] ![ocord!])
  580. (setq ![dex!] nil)
  581. (setq ![dfx!] nil)
  582. (setq ![x!] nil)
  583. (setq ![xb!] nil)
  584. (setq ![ocord!] nil)
  585. ))
  586. (de crotat0!> nil
  587. (proc (w wa wm we wb wr wd wc)
  588. % here w is the matrix ...
  589. (setq w (foreach!> a in (dimlist!> 0) collect
  590. (foreach!> b in (dimlist!> 0) collect
  591. (getfdx!> (getel1!> ![dex!] b) a))))
  592. (setq wd (raeval!> (list 'det (cons 'mat w))))
  593. (cond ((or (null wd) (zerop wd))
  594. (prog2 (setq ![er!] 8377) (return !!er!!))))
  595. (setq ![l!] w) % d = d xnew/d xold
  596. (setq ![dl!] wd) % detd
  597. (setq ![sdl!] (raeval!> % sign(detd)
  598. (list 'times ![dl!]
  599. (list 'sqrt (list 'quotient 1
  600. (list 'expt ![dl!] 2))))))
  601. (l!-li!>) % d^(-1)
  602. (setq w (altdata!>(alldata!>)))
  603. % transforming all ...
  604. (while!> w
  605. (setq wc (car w))
  606. (cond ((memq wc '(![cord!] ![const!] ![fun!] ![sol!] ![apar!] % skipping
  607. !#!b !#!e ))
  608. nil)
  609. ((and (holonomicp!>) (eq wc '!#!T)) (msg!> 8391)) % keep T
  610. ((and (holonomicp!>) (eq wc '!#!D)) (msg!> 8392)) % keep D
  611. ((not(mustbecrotated!> wc)) nil) % skipping
  612. ((flagp wc '!+hold) (nonrot!> wc)) % skipping noisily
  613. (t (cprepdens!> wc) % prepare density
  614. (set wc
  615. (allcoll!> (eval wc ) wc nil
  616. (cond ((get wc '!=idxl) (get wc '!=idxl))
  617. (t '(0)))
  618. (function crotatel!>)))
  619. % correct connection
  620. (cond
  621. % holonomic ...
  622. ((flagp wc '!+hconn) (gammacorrect!> (eval wc)))
  623. % in holonomic regime holonomir = frame ...
  624. ((and (flagp wc '!+fconn) (holonomicp!>))
  625. (gammacorrect!> (eval wc))))
  626. ))
  627. (setq w (cdr w)))
  628. ))
  629. % Defines whether this object requires any cord rotation or not ...
  630. (de mustbecrotated!> (w)
  631. (or (hashol!> w) % it has hol. index
  632. (and (holonomicp!>) (hasfram!> w)) % in hol. regime hol.=frame
  633. (get w '!=dens))) % density correction
  634. % Rotate an element ...
  635. (de crotatel!> (lst wi wn)
  636. (cond
  637. ((syaidxp!> wi (get wn '!=sidxl)) % if wi is in canonic order ...
  638. (cond
  639. (![dens!] (dcorr!> wn (crotatel1!> wi nil (get wn '!=idxl) wn t nil)))
  640. (t (crotatel1!> wi nil (get wn '!=idxl) wn t nil))))
  641. (t nil)))
  642. % Prepares density correction ...
  643. (de cprepdens!> (wn)
  644. (prog (w)
  645. (setq w (get wn '!=dens))
  646. % In hol. regime if exists DENS for frame roration
  647. % then we use it ...
  648. (cond ((and w (holonomicp!>) (or (caddr w) (cadddr w)))
  649. (return (prepldens!> wn))))
  650. (cond
  651. ((null w)
  652. (setq ![dens!] nil))
  653. ((and (null(car w)) (null(cadr w)))
  654. (setq ![dens!] nil))
  655. ((null(cadr w))
  656. (setq ![dens!] ![sdl!]))
  657. ((null(car w))
  658. (setq ![dens!] (list 'expt ![dl!] (cadr w))))
  659. (t (setq ![dens!]
  660. (list 'times ![sdl!] (list 'expt ![dl!] (cadr w))))))
  661. (return ![dens!])))
  662. % WA,WI - Current Indices, WD - IDXL, WN - Int. Variable
  663. (de crotatel1!> (wi wa wd wn wf wc) % 05.96
  664. (cond
  665. % Last element (IDXL is empty), so getting the value of the element
  666. ((null wd) (getsa0!> wn (reverse wa)))
  667. % Enumerating or Spinor index, or Frame in Nonholonomic skipping ...
  668. ((or (enump!> (car wd))
  669. (spinp!> (car wd))
  670. (and (tetrp!> wd) (not(holonomicp!>))))
  671. (crotatel1!> (cdr wi)
  672. (cons (car wi) wa)
  673. (cdr wd)
  674. wn t nil))
  675. % Holonomic of Frame in holonomic mode index ...
  676. (t(prog (w wl we)
  677. (fordim!> x do (progn
  678. (setq wl (lli!> (car wi) x (upperp!>(car wd))))
  679. (cond (wl (progn
  680. (setq we (crotatel1!>
  681. (cdr wi)
  682. (cons x wa)
  683. (cdr wd)
  684. wn t nil))
  685. (cond (we (setq w
  686. (cons (cond ((algp!> wn) (multax!> wl we))
  687. (t (multfx!> wl we)))
  688. w)))))))))
  689. (return (cond ((null w) nil)
  690. ((algp!> wn) (summax!> w))
  691. (t (summfx!> w))))))))
  692. %----- Lie Derivatives ---------------------------------------------------
  693. (de lietr!> (lst)
  694. (prog (wv wn wi wi1 wl wm wsi wr)
  695. % wv - vector, wn - int.var. of differentiated object
  696. % wi - idxl of wn, wl - indices, wm - manipulations
  697. % wi1 - new idxl after manipulation
  698. (setq lst (memlist!> '!, lst))
  699. (cond ((eq lst !!er!!) (err!> 2020))
  700. ((not(eqn (length lst) 2)) (err!> 2500)))
  701. (setq wv (unitra0!> (car lst))) % vector
  702. (setq lst (cadr lst)) % lst = (id (...))
  703. % Internal variable ...
  704. (cond ((not(idp(car lst))) (err!> 2500))
  705. (t (setq wn (incomiv!>(explode(car lst))))))
  706. (cond ((not (or (flagp wn '!+ivar) (flagp wn '!+macros2))) (err!> 2500))
  707. ((flagp wn '!+noncov) (err!> 2502)))
  708. % Indices ...
  709. (setq wi (get wn '!=idxl))
  710. (cond
  711. ((null wi)
  712. (cond ((not(eqn (length lst) 1)) (err!> 2207)))
  713. (setq wi nil)
  714. (go lab))
  715. ((null(cdr lst)) (err!> 2207))
  716. ((not(pairp(cadr lst))) (err!> 2102)))
  717. (setq lst (memlist!> '!, (cadr lst)))
  718. (cond ((eq lst !!er!!) (err!> 2020))
  719. ((not(eqn (length lst) (length wi))) (err!> 2207)))
  720. (setq wm (mapcar lst 'selmani!>)) % manipulations
  721. (setq lst (mapcar lst 'delmani!>))
  722. (setq wl (mapcar lst (function unitra0!>)))
  723. (setq wi1 (chidxl!> wi wm))
  724. % Maybe we need T and D ...
  725. (cond ((frameorspin!> wi1) (require!> '( !#!T !#!D ))))
  726. lab
  727. (cond ((get wn '!=dens) (require!> '( !#!T !#!D ))))
  728. % Einstein summation ...
  729. (setq wsi (intersecl!> (freevar!> wv ![extvar!])
  730. (freevar!> wl ![extvar!])))
  731. % result ...
  732. (setq wr (list 'lieexec!> wn wi1 wl wm wv))
  733. (cond (wsi (setq wr (mkeinsum0!> wsi wr))))
  734. (return wr)
  735. ))
  736. (de frameorspin!> (wi)
  737. (cond ((null wi) nil)
  738. ((or (spinp!>(car wi)) (tetrp!>(car wi))) t)
  739. (t (frameorspin!>(cdr wi)))))
  740. (de chidxl!> (wi wm)
  741. (cond ((null wi) nil)
  742. (t (cons (chidxl1!> (car wi) (car wm))
  743. (chidxl!> (cdr wi) (cdr wm))))))
  744. (de chidxl1!> (wi wm)
  745. (cond
  746. ((null wm) wi)
  747. ((enump!> wi) wi)
  748. ((eqn wm 1) % ' cvalificator - up
  749. (cond
  750. ((and (spinp!> wi) (not(upperp!> wi)))
  751. (spinup!> wi)) % .s -> 's
  752. ((holpd!> wi) t) % .g -> 't
  753. ((tetrpd!> wi) t) % .t -> 't
  754. ((holpu!> wi) t) % 'g -> 't
  755. (t wi)))
  756. ((eqn wm 2) % . cvalificator - down
  757. (cond
  758. ((and (spinp!> wi) (upperp!> wi))
  759. (spindown!> wi)) % 's -> .s
  760. ((holpu!> wi) nil) % 'g -> .t
  761. ((tetrpu!> wi) nil) % 't -> .t
  762. ((holpd!> wi) nil) % .g -> .t
  763. (t wi)))
  764. ((eqn wm 3) % ^ cvalificator - g up
  765. (cond
  766. ((spinp!> wi) (err!> 9913))
  767. ((holpd!> wi) 1) % .g -> 'g
  768. ((tetrpd!> wi) 1) % .t -> 'g
  769. ((tetrpu!> wi) 1) % 't -> 'g
  770. (t wi)))
  771. ((eqn wm 4) % _ cvalificator - g down
  772. (cond
  773. ((spinp!> wi) (err!> 9913))
  774. ((holpu!> wi) 0) % 'g -> .g
  775. ((tetrpu!> wi) 0) % 't -> .g
  776. ((tetrpd!> wi) 0) % .t -> .g
  777. (t wi)))
  778. ))
  779. (de spinup!> (wi)
  780. (cond ((eq (car wi) 'u) (cons 'uu (cdr wi)))
  781. ((eq (car wi) 'd) (cons 'ud (cdr wi)))
  782. (t wi)))
  783. (de spindown!> (wi)
  784. (cond ((eq (car wi) 'uu) (cons 'u (cdr wi)))
  785. ((eq (car wi) 'ud) (cons 'd (cdr wi)))
  786. (t wi)))
  787. (de cdrnil!> (w)
  788. (cond ((null w) nil)
  789. (t (cdr w))))
  790. % wv - vector, wn - int. variable, wi - modified idxl
  791. % wl - index list, wm - ind. manipulations
  792. (de lieexec!> (wn wi wl wm wv)
  793. (prog (wt wr w0 ww wi1 wl0 wl1 wc wd)
  794. % evaluating vector ...
  795. (setq wv (unieval!> wv))
  796. (cond ((null wv) (return nil))
  797. ((not(eqn (car wv) -1)) (err!> 2501)))
  798. (setq wv (cdr wv))
  799. % evaluating indices ...
  800. (setq wl (mapcar wl 'unieval!>))
  801. % type of expression ...
  802. (setq wt (get wn '!=type))
  803. % main element of lie derivative
  804. (setq ww (cdrnil!>(funapply!> wn wl wm)))
  805. (setq w0 ww)
  806. (cond ((eqn wt 0) (setq wr (ncons(vfun!> wv ww)))) % ksi | w
  807. ((eqn wt -1) (setq wr (ncons(vbrack!> wv ww)))) % [ksi,w]
  808. ((eqn wt 1) (setq wr (list2
  809. (vform!> wv (dex!> ww)) % ksi _| d w
  810. (dfun!> (vform1!> wv ww))))) % + d ksi _| w
  811. (t (setq wr (list2
  812. (vform!> wv (dex!> ww)) % ksi _| d w
  813. (dex!> (vform!> wv ww)))))) % + d ksi _| w
  814. (setq wl1 wl)
  815. (setq wi1 wi)
  816. % for all indices ...
  817. (while!> wl1
  818. (cond
  819. % frame or holonomic ...
  820. ((or (tetrp!>(car wi1)) (holp!>(car wi1)))
  821. (fordim!> x do (progn
  822. (setq wc (liecoef!> (tonumb!>(car wl1)) x wv (car wi1)))
  823. (cond (wc
  824. (setq ww (cdrnil!>(funapply!> wn
  825. (app!> wl0 (cons (tocalg!> x)
  826. (cdr wl1)))
  827. wm)))))
  828. (cond (wc
  829. (setq wr (cons (cond ((zerop wt) (mktimes2!> wc ww))
  830. (t (fndfpr!> wc ww)))
  831. wr)))))))
  832. % spinorial index ...
  833. ((spinp!>(car wi1))
  834. (for!> x (0 1 2) do (progn
  835. (setq wc (liespin!> (tonumb!>(car wl1)) x wv (car wi1)))
  836. (cond (wc
  837. (setq ww (cdrnil!>(funapply!> wn
  838. (app!> wl0
  839. (cons
  840. (tocalg!>
  841. (sind!> (tonumb!>(car wl1))
  842. x (car wi1)))
  843. (cdr wl1)))
  844. wm)))))
  845. (cond (wc
  846. (setq wr (cons (cond ((zerop wt) (mktimes2!> wc ww))
  847. (t (fndfpr!> wc ww)))
  848. wr)))))))
  849. (t nil))
  850. (setq wl0 (cons (car wl1) wl0))
  851. (setq wl1 (cdr wl1))
  852. (setq wi1 (cdr wi1)))
  853. % density ...
  854. (setq wd (get wn '!=dens))
  855. (cond (wd
  856. (setq wd (mkplus2!>
  857. (mktimes2!> (cadr wd) (ksisum!> wv))
  858. (mktimes2!> (cadddr wd) (zetasum!> wv))))))
  859. (cond (wd
  860. (setq wd (chsign!> nil wd))
  861. (setq wr (cons (cond ((zerop wt) (mktimes2!> wd w0))
  862. (t (fndfpr!> wd w0)))
  863. wr))))
  864. % result ...
  865. (cond ((zerop wt) (setq wr (evalalg!>(algsum!> wr))))
  866. (t (setq wr (evalform!>(dfsum!> wr)))))
  867. (cond ((null wr) (return nil)))
  868. (return (cons wt wr))) )
  869. (de mkplus2!> (wa wb)
  870. (cond ((and (null wa) (null wb)) nil)
  871. ((null wa) wb)
  872. ((null wb) wa)
  873. (t (list 'plus wa wb))))
  874. % Frame and Holonomic indices ...
  875. (de liecoef!> (wa wb wv wi)
  876. (cond
  877. ((holpu!> wi) (evalalg!> (chsign!> nil (ksicoef!> wa wb wv))))
  878. ((holpd!> wi) (evalalg!> (ksicoef!> wb wa wv)))
  879. ((tetrpu!> wi) (evalalg!> (chsign!> nil (zetacoef!> wa wb wv))))
  880. ((tetrpd!> wi) (evalalg!> (zetacoef!> wb wa wv))) ))
  881. % KSI^a_b
  882. (de ksicoef!> (wa wb wv)
  883. (prog2
  884. (setq wv
  885. (cond (![umod!] (vform1!> wv (getel1!> ![xf!] wa)))
  886. (t (getfdx!> wv wa))))
  887. (cond ((null wv) wv)
  888. (t (list 'df wv (getel1!> ![cord!] wb))))))
  889. % ZETA'a.b
  890. (de zetacoef!> (wa wb wv)
  891. (prog2
  892. (setq wv (dfsum!> (list (dfun!> (vform1!> wv (getframe!> wa)))
  893. (vform!> wv (dex!> (getframe!> wa))))))
  894. (vform1!> (getiframe!> wb) wv)))
  895. % KSI^x_x
  896. (de ksisum!> (wv)
  897. (prog (w)
  898. (fordim!> x do
  899. (setq w (cons (ksicoef!> x x wv) w)))
  900. (return (evalalg!> (algsum!> w)))))
  901. % ZETA'm.m
  902. (de zetasum!> (wv)
  903. (prog (w)
  904. (fordim!> x do
  905. (setq w (cons (zetacoef!> x x wv) w)))
  906. (return (evalalg!> (algsum!> w)))))
  907. % Spinorial indices ...
  908. (de liespin!> (wk wx wv wi)
  909. (prog (w)
  910. (setq w (spinumb!> wk wx wi))
  911. (cond ((zerop w) (return nil)))
  912. (return
  913. (mktimes2!> w
  914. (cond ((dotp!> wi) (zetaspinc!> wx wv))
  915. (t (zetaspin!> wx wv)))))))
  916. (de spinumb!> (wk wx wi)
  917. (cond
  918. % upper spinorial ...
  919. ((upperp!> wi)
  920. (cond
  921. ((eqn wx 0)
  922. (cond ((greaterp wk 0) (pm!> wk))
  923. (t 0 )))
  924. ((eqn wx 1)
  925. (pm!>(difference (times 2 wk) (cdr wi))))
  926. ((eqn wx 2)
  927. (cond ((lessp wk (cdr wi)) (pm!>(difference wk (cdr wi))))
  928. (t 0 )))))
  929. % lower spinorial ...
  930. (t (cond
  931. ((eqn wx 0)
  932. (cond ((lessp wk (cdr wi)) (pm!>(difference wk (cdr wi))))
  933. (t 0 )))
  934. ((eqn wx 1)
  935. (mp!>(difference (times 2 wk) (cdr wi))))
  936. ((eqn wx 2)
  937. (cond ((greaterp wk 0) (pm!> wk))
  938. (t 0 )))))))
  939. (de sind!> (wk wx wi)
  940. (cond ((upperp!> wi) (plus wk (sub1 wx)))
  941. (t (plus wk (minus(sub1 wx))))))
  942. % ZETA_AA
  943. (de zetaspin!> (wa wv)
  944. (cond
  945. ((eqn wa 0) (mpa!>(zetacoef!> 2 1 wv)))
  946. ((eqn wa 1) (pma!>(evalalg!>
  947. (list 'quotient
  948. (list 'plus (zetacoef!> 3 3 wv)
  949. (zetacoef!> 1 1 wv)) 2))))
  950. ((eqn wa 2) (pma!>(zetacoef!> 3 0 wv)))))
  951. % ZETA~_AA
  952. (de zetaspinc!> (wa wv)
  953. (cond
  954. ((eqn wa 0) (mpa!>(zetacoef!> 3 1 wv)))
  955. ((eqn wa 1) (pma!>(evalalg!>
  956. (list 'quotient
  957. (list 'plus (zetacoef!> 2 2 wv)
  958. (zetacoef!> 1 1 wv)) 2))))
  959. ((eqn wa 2) (pma!>(zetacoef!> 2 0 wv)))))
  960. (de tocalg!> (w)
  961. (cond ((null w) '(0 . 0))
  962. (t (cons 0 w))))
  963. (de tonumb!> (w)
  964. (cond ((null w) 0)
  965. (t (cdr w))))
  966. (de pm!> (w)
  967. (cond ((not(pmmm!>)) w)
  968. (t (minus w ))))
  969. (de mp!> (w)
  970. (cond ((pmmm!>) w)
  971. (t (minus w ))))
  972. (de pma!> (w)
  973. (cond ((not(pmmm!>)) w)
  974. (t (chsign!> nil w ))))
  975. (de mpa!> (w)
  976. (cond ((pmmm!>) w)
  977. (t (chsign!> nil w ))))
  978. (de pmf!> (w)
  979. (cond ((not(pmmm!>)) w)
  980. (t (chsign!> t w ))))
  981. (de mpf!> (w)
  982. (cond ((pmmm!>) w)
  983. (t (chsign!> t w ))))
  984. %------- Covariant Differential -------------------------------------------
  985. (de dctran!> (lst)
  986. (prog (wn wi wi1 wl wm wc w wf wh wu wd)
  987. % wn - int.var. of differentiated object
  988. % wi - idxl of wn, wl - indices, wm - manipulations
  989. % wi1 - new idxl after manipulation
  990. % wc - possible list of alternative connections
  991. (setq lst (memlist!> '!, lst))
  992. (cond ((eq lst !!er!!) (err!> 2020)))
  993. (setq wc (cdr lst))
  994. (setq lst (car lst)) % lst = (id (...))
  995. % Internal variable ...
  996. (cond ((not(idp(car lst))) (err!> 2600))
  997. (t (setq wn (incomiv!>(explode(car lst))))))
  998. (cond ((not (or (flagp wn '!+ivar) (flagp wn '!+macros2))) (err!> 2600))
  999. ((flagp wn '!+noncov) (err!> 2602))
  1000. ((eqn (get wn '!=type) -1) (err!> 2004)))
  1001. % Indices ...
  1002. (setq wi (get wn '!=idxl))
  1003. % We need connections ...
  1004. (setq wf '!#!o!m!e!g!a)
  1005. (setq wh '!#!G!A!M!M!A)
  1006. (setq wu '!#!o!m!e!g!a!u)
  1007. (setq wd '!#!o!m!e!g!a!d)
  1008. (cond ((holonomicp!>) (setq wh '!#!o!m!e!g!a)))
  1009. % possible alternative connections ...
  1010. (cond (wc
  1011. (setq wc (mapcar wc 'car))
  1012. (foreach!> wx in wc do (progn
  1013. (cond ((not(idp wx)) (err!> 2603)))
  1014. (setq w (incomiv!>(explode wx)))
  1015. (cond ((flagp w '!+fconn) (setq wf w)
  1016. (cond ((holonomicp!>) (setq wh w))))
  1017. ((flagp w '!+hconn) (setq wh w)
  1018. (cond ((holonomicp!>) (setq wf w))))
  1019. ((flagp w '!+uconn) (setq wu w))
  1020. ((flagp w '!+dconn) (setq wd w))
  1021. (t (err!> 2603)))))))
  1022. (setq wc (list wf wh wu wd))
  1023. % indices ...
  1024. (cond
  1025. ((null wi)
  1026. (cond ((not(eqn (length lst) 1)) (err!> 2207)))
  1027. (setq wi nil)
  1028. (go lab))
  1029. ((null(cdr lst)) (err!> 2207))
  1030. ((not(pairp(cadr lst))) (err!> 2102)))
  1031. (setq lst (memlist!> '!, (cadr lst)))
  1032. (cond ((eq lst !!er!!) (err!> 2020))
  1033. ((not(eqn (length lst) (length wi))) (err!> 2207)))
  1034. (setq wm (mapcar lst 'selmani!>)) % manipulations
  1035. (setq lst (mapcar lst 'delmani!>))
  1036. (setq wl (mapcar lst (function unitra0!>)))
  1037. (setq wi1 (chidxl!> wi wm))
  1038. % which of connections we really need ...
  1039. (foreach!> wx in wi1 do
  1040. (cond ((tetrp!> wx) (require!> (list wf)))
  1041. ((holp!> wx) (require!> (list wh)))
  1042. ((undotp!> wx) (require!> (list wu)))
  1043. ((dotp!> wx) (require!> (list wd))) ))
  1044. lab
  1045. (cond ((get wn '!=dens)
  1046. (cond ((cadr(get wn '!=dens)) (require!> (list wh))))
  1047. (cond ((cadddr(get wn '!=dens)) (require!> (list wf)))) ))
  1048. % result ...
  1049. (return (list 'dcexec!> wn wi1 wl wm wc))
  1050. ))
  1051. % wn - int. variable, wi - modified idxl
  1052. % wl - index list, wm - ind. manipulations
  1053. % wo - connections
  1054. (de dcexec!> (wn wi wl wm wo)
  1055. (prog (wt wr w0 ww wi1 wl0 wl1 wc wd)
  1056. % evaluating connections ...
  1057. (setq wo (mapcar wo 'eval))
  1058. % evaluating indices ...
  1059. (setq wl (mapcar wl 'unieval!>))
  1060. % type of expression ...
  1061. (setq wt (get wn '!=type))
  1062. % main differential
  1063. (setq ww (cdrnil!>(funapply!> wn wl wm)))
  1064. (setq w0 ww)
  1065. (cond ((eqn wt 0) (setq wr (ncons(dfun!> ww)))) % d alg
  1066. (t (setq wr (ncons(dex!> ww))))) % d form
  1067. (setq wl1 wl)
  1068. (setq wi1 wi)
  1069. % for all indices ...
  1070. (while!> wl1
  1071. (cond
  1072. % frame or holonomic ...
  1073. ((or (tetrp!>(car wi1)) (holp!>(car wi1)))
  1074. (fordim!> x do (progn
  1075. (setq wc (concoef!> (tonumb!>(car wl1)) x (car wi1) wo))
  1076. (cond (wc
  1077. (setq ww (cdrnil!>(funapply!> wn
  1078. (app!> wl0 (cons (tocalg!> x)
  1079. (cdr wl1)))
  1080. wm)))))
  1081. (cond (wc
  1082. (setq wr (cons (cond ((zerop wt) (fndfpr!> ww wc))
  1083. (t (dfprod2!> wc ww)))
  1084. wr)))))))
  1085. % spinorial index ...
  1086. ((spinp!>(car wi1))
  1087. (for!> x (0 1 2) do (progn
  1088. (setq wc (conspin!> (tonumb!>(car wl1)) x (car wi1) wo))
  1089. (cond (wc
  1090. (setq ww (cdrnil!>(funapply!> wn
  1091. (app!> wl0
  1092. (cons
  1093. (tocalg!>
  1094. (sind!> (tonumb!>(car wl1))
  1095. x (car wi1)))
  1096. (cdr wl1)))
  1097. wm)))))
  1098. (cond (wc
  1099. (setq wr (cons (cond ((zerop wt) (fndfpr!> ww wc))
  1100. (t (dfprod2!> wc ww)))
  1101. wr)))))))
  1102. (t nil))
  1103. (setq wl0 (cons (car wl1) wl0))
  1104. (setq wl1 (cdr wl1))
  1105. (setq wi1 (cdr wi1)))
  1106. % density ...
  1107. (setq wd (get wn '!=dens))
  1108. (cond (wd
  1109. (setq wd (evalform!> (dfsum2!>
  1110. (cond ((cadr wd)
  1111. (fndfpr!>(cadr wd)(hosum!> wo)))(t nil))
  1112. (cond ((cadddr wd)
  1113. (fndfpr!>(cadddr wd)(fosum!> wo)))(t nil))
  1114. )))))
  1115. (cond (wd
  1116. (setq wr (cons (cond ((zerop wt) (fndfpr!> w0 wd))
  1117. (t (fndfpr!> wd w0)))
  1118. wr))))
  1119. % result ...
  1120. (setq wr (evalform!>(dfsum!> wr)))
  1121. (cond ((null wr) (return nil)))
  1122. (return (cons (add1 wt) wr))) )
  1123. % Frame of Holonomic ...
  1124. (de concoef!> (wa wb wi wo)
  1125. (cond
  1126. ((tetrpu!> wi) (getel2!> (car wo) wa wb))
  1127. ((tetrpd!> wi) (chsignf!>(getel2!>(car wo) wb wa)))
  1128. ((holpu!> wi) (getel2!> (cadr wo) wa wb))
  1129. ((holpd!> wi) (chsignf!>(getel2!>(cadr wo) wb wa)))))
  1130. % Spinorial ...
  1131. (de conspin!> (wk wx wi wo)
  1132. (prog (w)
  1133. (setq w (spinumb!> wk wx wi))
  1134. (cond ((zerop w) (return nil)))
  1135. (return
  1136. (fndfpr!> (chsigna!> w)
  1137. (cond ((dotp!> wi) (getel1!> (cadddr wo) wx))
  1138. (t (getel1!> (caddr wo) wx)))))))
  1139. % Summed connection ...
  1140. (de fosum!> (wo)
  1141. (prog (w)
  1142. (setq wo (car wo))
  1143. (fordim!> wx do
  1144. (setq w (cons (getel2!> wo wx wx) w)))
  1145. (return(dfsum!> w))))
  1146. (de hosum!> (wo)
  1147. (prog (w)
  1148. (setq wo (cadr wo))
  1149. (fordim!> wx do
  1150. (setq w (cons (getel2!> wo wx wx) w)))
  1151. (return(dfsum!> w))))
  1152. %------- Covariant Derivative ---------------------------------------------
  1153. (de dfctran!> (lst)
  1154. (prog (wv wn wi wi1 wl wm wc w wf wh wu wd wsi wr)
  1155. % wv - vector
  1156. % wn - int.var. of differentiated object
  1157. % wi - idxl of wn, wl - indices, wm - manipulations
  1158. % wi1 - new idxl after manipulation
  1159. % wc - possible list of alternative connections
  1160. (setq lst (memlist!> '!, lst))
  1161. (cond ((eq lst !!er!!) (err!> 2020))
  1162. ((lessp (length lst) 2) (err!> 2700)))
  1163. (setq wv (unitra0!> (car lst))) % vector
  1164. (setq lst (cdr lst))
  1165. (setq wc (cdr lst)) % alternative connections
  1166. (setq lst (car lst)) % lst = (id (...))
  1167. % Internal variable ...
  1168. (cond ((not(idp(car lst))) (err!> 2700))
  1169. (t (setq wn (incomiv!>(explode(car lst))))))
  1170. (cond ((not (or (flagp wn '!+ivar) (flagp wn '!+macros2))) (err!> 2700))
  1171. ((flagp wn '!+noncov) (err!> 2702))
  1172. ((not(eqn (get wn '!=type) 0)_) (err!> 2704)))
  1173. % Indices ...
  1174. (setq wi (get wn '!=idxl))
  1175. % We need connections ...
  1176. (setq wf '!#!o!m!e!g!a)
  1177. (setq wh '!#!G!A!M!M!A)
  1178. (setq wu '!#!o!m!e!g!a!u)
  1179. (setq wd '!#!o!m!e!g!a!d)
  1180. (cond ((holonomicp!>) (setq wh '!#!o!m!e!g!a)))
  1181. % possible alternative connections ...
  1182. (cond (wc
  1183. (setq wc (mapcar wc 'car))
  1184. (foreach!> wx in wc do (progn
  1185. (cond ((not(idp wx)) (err!> 2703)))
  1186. (setq w (incomiv!>(explode wx)))
  1187. (cond ((flagp w '!+fconn) (setq wf w)
  1188. (cond ((holonomicp!>) (setq wh w))))
  1189. ((flagp w '!+hconn) (setq wh w)
  1190. (cond ((holonomicp!>) (setq wf w))))
  1191. ((flagp w '!+uconn) (setq wu w))
  1192. ((flagp w '!+dconn) (setq wd w))
  1193. (t (err!> 2703)))))))
  1194. (setq wc (list wf wh wu wd))
  1195. % indices ...
  1196. (cond
  1197. ((null wi)
  1198. (cond ((not(eqn (length lst) 1)) (err!> 2207)))
  1199. (setq wi nil)
  1200. (go lab))
  1201. ((null(cdr lst)) (err!> 2207))
  1202. ((not(pairp(cadr lst))) (err!> 2102)))
  1203. (setq lst (memlist!> '!, (cadr lst)))
  1204. (cond ((eq lst !!er!!) (err!> 2020))
  1205. ((not(eqn (length lst) (length wi))) (err!> 2207)))
  1206. (setq wm (mapcar lst 'selmani!>)) % manipulations
  1207. (setq lst (mapcar lst 'delmani!>))
  1208. (setq wl (mapcar lst (function unitra0!>)))
  1209. (setq wi1 (chidxl!> wi wm))
  1210. % which of connections we really need ...
  1211. (foreach!> wx in wi1 do
  1212. (cond ((tetrp!> wx) (require!> (list wf)))
  1213. ((holp!> wx) (require!> (list wh)))
  1214. ((undotp!> wx) (require!> (list wu)))
  1215. ((dotp!> wx) (require!> (list wd))) ))
  1216. lab
  1217. (cond ((get wn '!=dens)
  1218. (cond ((cadr(get wn '!=dens)) (require!> (list wh))))
  1219. (cond ((cadddr(get wn '!=dens)) (require!> (list wf)))) ))
  1220. % einstein summation ...
  1221. (setq wsi (intersecl!> (freevar!> wv ![extvar!])
  1222. (freevar!> wl ![extvar!])))
  1223. % result ...
  1224. (setq wr (list 'dfcexec!> wn wi1 wl wm wc wv))
  1225. (cond (wsi (setq wr (mkeinsum0!> wsi wr))))
  1226. (return wr)
  1227. ))
  1228. % wn - int. variable, wi - modified idxl
  1229. % wl - index list, wm - ind. manipulations
  1230. % wo - connections, wv - vector
  1231. (de dfcexec!> (wn wi wl wm wo wv)
  1232. (prog (wr w0 ww wi1 wl0 wl1 wc wd)
  1233. % evaluating vector ...
  1234. (setq wv (unieval!> wv))
  1235. (cond ((null wv) (return nil))
  1236. ((not(eqn (car wv) -1)) (err!> 2701)))
  1237. (setq wv (cdr wv))
  1238. % evaluating connections ...
  1239. (setq wo (mapcar wo 'eval))
  1240. % evaluating indices ...
  1241. (setq wl (mapcar wl 'unieval!>))
  1242. % main differential
  1243. (setq ww (cdrnil!>(funapply!> wn wl wm)))
  1244. (setq w0 ww)
  1245. (setq wr (ncons(dfun!> ww))) % d alg
  1246. (setq wl1 wl)
  1247. (setq wi1 wi)
  1248. % for all indices ...
  1249. (while!> wl1
  1250. (cond
  1251. % frame or holonomic ...
  1252. ((or (tetrp!>(car wi1)) (holp!>(car wi1)))
  1253. (fordim!> x do (progn
  1254. (setq wc (concoef!> (tonumb!>(car wl1)) x (car wi1) wo))
  1255. (cond (wc
  1256. (setq ww (cdrnil!>(funapply!> wn
  1257. (app!> wl0 (cons (tocalg!> x)
  1258. (cdr wl1)))
  1259. wm)))))
  1260. (cond (wc
  1261. (setq wr (cons (fndfpr!> ww wc)
  1262. wr)))))))
  1263. % spinorial index ...
  1264. ((spinp!>(car wi1))
  1265. (for!> x (0 1 2) do (progn
  1266. (setq wc (conspin!> (tonumb!>(car wl1)) x (car wi1) wo))
  1267. (cond (wc
  1268. (setq ww (cdrnil!>(funapply!> wn
  1269. (app!> wl0
  1270. (cons
  1271. (tocalg!>
  1272. (sind!> (tonumb!>(car wl1))
  1273. x (car wi1)))
  1274. (cdr wl1)))
  1275. wm)))))
  1276. (cond (wc
  1277. (setq wr (cons (fndfpr!> ww wc)
  1278. wr)))))))
  1279. (t nil))
  1280. (setq wl0 (cons (car wl1) wl0))
  1281. (setq wl1 (cdr wl1))
  1282. (setq wi1 (cdr wi1)))
  1283. % density ...
  1284. (setq wd (get wn '!=dens))
  1285. (cond (wd
  1286. (setq wd (evalform!> (dfsum2!>
  1287. (cond ((cadr wd)
  1288. (fndfpr!>(cadr wd)(hosum!> wo)))(t nil))
  1289. (cond ((cadddr wd)
  1290. (fndfpr!>(cadddr wd)(fosum!> wo)))(t nil))
  1291. )))))
  1292. (cond (wd
  1293. (setq wr (cons (fndfpr!> w0 wd)
  1294. wr))))
  1295. % result ...
  1296. (setq wr (evalalg!>(vform1!> wv (dfsum!> wr))))
  1297. (cond ((null wr) (return nil)))
  1298. (return (cons 0 wr))) )
  1299. %======= End of GRGcoper.sl ===============================================%