hodge.red 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. module hodge;
  2. % Author: Eberhard Schruefer;
  3. global '(dimex!* sgn!* detm!* basisforml!*);
  4. symbolic procedure formhodge(u,vars,mode);
  5. if mode eq 'symbolic then 'hash . formlis(cdr u,vars,mode)
  6. else 'list . mkquote 'hodge . formlis(cdr u,vars,mode);
  7. put('hash,'formfn,'formhodge);
  8. put('hodge,'simpfn,'simphodge);
  9. put('hodge,'rtypefn,'getrtypecar);
  10. put('hodge,'partitfn,'partithodge);
  11. symbolic procedure partithodge u;
  12. hodgepf partitop car u;
  13. symbolic procedure simphodge u;
  14. !*pf2sq partithodge u;
  15. symbolic procedure mkhodge u;
  16. begin scalar x,y;
  17. return if x := opmtch(y := list('hodge,u))
  18. then partitop x
  19. else if deg!*form u = dimex!*
  20. then 1 .* mksq(y,1) .+ nil
  21. else mkupf y
  22. end;
  23. smacro procedure mkbaseform u;
  24. mkupf list(caar basisforml!*,u);
  25. symbolic procedure basisformp u;
  26. null atom u and (u memq basisforml!*);
  27. symbolic procedure hodgepf u;
  28. if null u then nil
  29. else addpf(multpfsq(hodgek ldpf u,lc u),hodgepf red u);
  30. symbolic procedure hodgek u;
  31. if eqcar(u,'hodge)
  32. then cadr u .* multsq(mksgnsq multf(deg!*form cadr u,
  33. addf(dimex!*,negf deg!*form cadr u)),
  34. resimp sgn!*) .+ nil
  35. else if basisformp u then dual list u
  36. else if eqcar(u,'wedge) and boundindp(cdr u,basisforml!*) then
  37. dual cdr u
  38. else if basisforml!* and null deg!*form u
  39. then dual0 u
  40. else mkhodge u;
  41. symbolic procedure dual0 u;
  42. (multpfsq(mkwedge ('wedge . basisforml!*),
  43. simpexpt list(mk!*sq(absf!* numr x ./
  44. absf!* denr x),'(quotient 1 2))))
  45. where x = simp!* detm!*;
  46. symbolic procedure dual u;
  47. (multpfsq(mkdual xpnddual u,
  48. simpexpt list(mk!*sq(absf!* numr x ./
  49. absf!* denr x),'(quotient 1 2))))
  50. where x = simp!* detm!*;
  51. symbolic procedure !*met2pf u;
  52. metpf1 getupper cadr u;
  53. symbolic procedure xpnddual u;
  54. if null cdr u
  55. then mkunarywedge !*met2pf car u
  56. else wedgepf2(!*met2pf car u,xpnddual cdr u);
  57. symbolic procedure metpf1 u;
  58. if null u then nil
  59. else addpf(multpfsq(mkbaseform caar u,simp cdar u),metpf1 cdr u);
  60. symbolic procedure mkdual u;
  61. if null u then nil
  62. else addpf(multpfsq(((if null x then nil
  63. else if cdr ldpf x
  64. then multpfsq(mkuniquewedge1 ldpf x,
  65. lc x)
  66. else car ldpf x .* lc x .+ nil)
  67. where x = dualk ldpf u),
  68. lc u),mkdual red u);
  69. symbolic procedure dualk u;
  70. begin scalar x;
  71. x := !*k2pf basisforml!*;
  72. a: x := dualk2(car u,x);
  73. if null(u := cdr u) then return x;
  74. go to a
  75. end;
  76. symbolic procedure dualk2(u,v);
  77. dualk0(u,v,nil);
  78. symbolic procedure dualk0(u,v,w);
  79. if u eq car ldpf v
  80. then if null cdr ldpf v
  81. then list 1 .* multsq(mksgnsq w,lc v) .+ nil
  82. else cdr ldpf v .* multsq(mksgnsq w,lc v) .+ nil
  83. else if null cdr ldpf v then nil
  84. else wedgepf2(!*k2pf ldpf car v,
  85. dualk0(u,cdr ldpf v .* lc v .+ nil,addf(w,1)));
  86. symbolic procedure hodgeprn u;
  87. <<prin2!* "#"; rembras cadr u>>;
  88. put('hodge,'prifn,'hodgeprn);
  89. endmodule;
  90. end;