exintro.red 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. module exintro;
  2. % Author: Eberhard Schruefer.
  3. fluid '(depl!*);
  4. global '(dimex!* lftshft!* detm!* basisforml!* sgn!* wedgemtch!*
  5. bndeq!* basisvectorl!* indxl!* nosuml!* !*nosum coord!*
  6. keepl!* metricd!* metricu!* !*product!-rule);
  7. % Some initialiations.
  8. dimex!* := !*q2f simp 'dim;
  9. sgn!* := !*k2q 'sgn;
  10. !*product!-rule := t;
  11. rlistat('(pform fdomain remfdomain tvector spacedim forder remforder
  12. frame dualframe keep closedform xpnd noxpnd
  13. isolate remisolate));
  14. symbolic procedure spacedim u;
  15. begin
  16. dimex!* := !*q2f simp car u
  17. end;
  18. symbolic procedure fdomain u;
  19. %Sets up implicit dependencies;
  20. while u do
  21. <<if not eqexpr car u then errpri2(car u,'hold)
  22. else begin scalar y;
  23. rmsubs();
  24. y := get(cadar u,'rtype);
  25. remprop(cadar u,'rtype);
  26. for each x in cdr caddar u do
  27. <<if indvarp x then
  28. for each j in mkaindxc(flatindxl cdr x,nil) do
  29. depend1(cadar u,prepsq simpindexvar
  30. sublis(pair(flatindxl cdr x,j),x),t)
  31. else depend1(cadar u,x,t)>>;
  32. flag(list cadar u,'impfun);
  33. if y then put(cadar u,'rtype,y)
  34. end;
  35. u := cdr u>>;
  36. symbolic procedure remfdomain u;
  37. %Removes implicit dependencies;
  38. begin scalar x;
  39. for each j in u do
  40. if x := assoc(j,depl!*) then <<depl!* := delete(x,depl!*);
  41. remflag(list j,'impfun)>>
  42. else rerror(excalc,1,list(j," had no dependencies"));
  43. end;
  44. symbolic procedure putform(u,v);
  45. if atom u then <<if flagp(u,'reserved)
  46. then <<remflag({u},'reserved);
  47. lpri {"***Warning: reserved variable",
  48. u,"declared exterior form"}>>;
  49. put(u := !*a2k u,'fdegree,list !*q2f simp v);
  50. put(u,'clearfn,'clearfdegree)>>
  51. else begin scalar x,y; integer n;
  52. n := length cdr u;
  53. if (x := get(car u,'ifdegree)) and (y := assoc(n,x))
  54. then x := delete(y,x);
  55. put(car u,'ifdegree,if x then (n . !*q2f simp v) . x
  56. else list(n . !*q2f simp v));
  57. x := car u;
  58. flag(list x,'indexvar);
  59. put(x,'rtype,'indexed!-form);
  60. put(x,'simpfn,'simpindexvar);
  61. put(x,'partitfn,'partitindexvar);
  62. put(x,'evalargfn,'revalindl);
  63. flag(list x,'full);
  64. put(x,'prifn,'indvarprt);
  65. put(x,'fancy!-pprifn,'xindvarprt);
  66. % The next line is needed in 3.6 to avoid the wrong
  67. % simplification of an index -0 to 0.
  68. remflag('(minus),'intfn);
  69. if null numr simp v then flag(list x,'covariant)
  70. end;
  71. symbolic procedure pform u;
  72. begin rmsubs();
  73. for each j in u do
  74. if not eqexpr j then errpri2(j,'hold)
  75. else if eqcar(cadr j,'list)
  76. then for each k in cdadr j do putform(k,caddr j)
  77. else putform(cadr j,caddr j)
  78. end;
  79. symbolic procedure tvector u;
  80. for each j in u do putform(j,-1);
  81. symbolic procedure getlower u;
  82. cdr atsoc(u,metricd!*);
  83. symbolic procedure getupper u;
  84. cdr atsoc(u,metricu!*);
  85. symbolic procedure xpnd u;
  86. <<rmsubs(); remflag(u,'noxpnd)>>;
  87. symbolic procedure noxpnd u;
  88. <<rmsubs(); flag(u,'noxpnd)>>;
  89. symbolic procedure closedform u;
  90. <<rmsubs(); flag(u,'closed)>>;
  91. symbolic procedure memqcar(u,v);
  92. null atom u and car u memq v;
  93. endmodule;
  94. end;