Update the ChangeLog for bug #4008
[maxima.git] / share / tensor / rtest_ctensor.mac
bloba8d5a54a163db9a809f71bdb94d6d185204f0956
1 /* Load ctensor */
2 (if get('ctensor,'version)=false then load(ctensor),done);
3 done;
4 /* Test predefined metrics */
5 /* Some metrics are known to fail, due to sqrt sign ambiguities. */
6 testmetric(metric):=is(trigsimp((cframe_flag:true,ct_coordsys(metric),cmetric(),lg)-(cframe_flag:false,ct_coordsys(metric),lg))=zeromatrix(dim,dim));
7 testmetric(metric):=is(trigsimp((cframe_flag:true,ct_coordsys(metric),cmetric(),lg)-(cframe_flag:false,ct_coordsys(metric),lg))=zeromatrix(dim,dim));
8 testmetric(cartesian2d);
9 true;
10 testmetric(polar);
11 true;
12 testmetric(elliptic);
13 true;
14 testmetric(confocalelliptic);
15 true;
16 testmetric(bipolar);
17 true;
18 testmetric(parabolic);
19 true;
20 testmetric(cartesian3d);
21 true;
22 testmetric(polarcylindrical);
23 true;
24 testmetric(ellipticcylindrical);
25 true;
26 /* testmetric(confocalellipsoidal);
27    true; */
28 /* testmetric(bipolarcylindrical);
29    true; */
30 testmetric(paraboliccylindrical);
31 true;
32 testmetric(paraboloidal);
33 true;
34 /* testmetric(conical);
35    true; */
36 testmetric(toroidal);
37 true;
38 testmetric(spherical);
39 true;
40 testmetric(oblatespheroidal);
41 true;
42 testmetric(oblatespheroidalsqrt);
43 true;
44 testmetric(prolatespheroidal);
45 true;
46 testmetric(prolatespheroidalsqrt);
47 true;
48 testmetric(cartesian4d);
49 true;
50 testmetric(spherical4d);
51 true;
52 testmetric(exteriorschwarzschild);
53 true;
54 testmetric(interiorschwarzschild);
55 true;
56 testmetric(kerr_newman);
57 true;
58 /* Use a simple metric to test other functions */
59 (ct_coords:[x,y,z,t],dim:4,remove([a,d],constant),depends([a,d],x),lg:matrix([a,0,0,0],[0,x^2,0,0],[0,0,x^2*sin(y)^2,0],[0,0,0,-d]),ug:lg^^-1,christof(false),mcs[1,1,1]);
60 'diff(a,x,1)/(2*a);
61 (ricci(false),ric[1,1]);
62 'diff(a,x,1)/(a*x)-'diff(d,x,2)/(2*d)+('diff(d,x,1))^2/(4*d^2)+'diff(a,x,1)*'diff(d,x,1)/(4*a*d);
63 (uricci(false),uric[1,1]);
64 ('diff(a,x,1)/(a*x)-'diff(d,x,2)/(2*d)+('diff(d,x,1))^2/(4*d^2)+'diff(a,x,1)*'diff(d,x,1)/(4*a*d))/a;
65 (einstein(false),ein[1,1]);
66 ('diff(d,x,1)*x+(1-a)*d)/(a*d*x^2);
67 (riemann(false),riem[1,2,1,2]);
68 -'diff(a,x,1)/(2*a*x);
69 (lriemann(false),lriem[1,2,1,2]);
70 -'diff(a,x,1)*x/(2*a);
71 (uriemann(false),uriem[1,2,1,2]);
72 -'diff(a,x,1)/(2*a^3*x^3);
73 rinvariant();
74 2*('diff(d,x,1))^2/(a^2*d^2*x^2)+2*('diff(a,x,1))^2/(a^4*x^2)+4*(a-1)^2/(a^2*x^4)+(2*a*d*'diff(d,x,2)-a*('diff(d,x,1))^2-'diff(a,x,1)*d*'diff(d,x,1))^2/(4*a^4*d^4);
75 (weyl(false),weyl[1,2,1,2])+((2*a*d*'diff(d,x,2)-a*'diff(d,x,1)^2-'diff(a,x,1)*d*'diff(d,x,1))*x^2+(2*'diff(a,x,1)*d^2-2*a*d*'diff(d,x,1))*x+(4*a-4*a^2)*d^2)/(24*a*d^2);
77 /* Test Taylor-series approximations with a simple example */
78 (ratfac:true,ct_coords:[t,r,theta,phi],lg:matrix([-1,0,0,0],[0,1,0,0],[0,0,r^2,0],[0,0,0,r^2*sin(theta)^2]),h:matrix([h11,0,0,0],[0,h22,0,0],[0,0,h33,0],[0,0,0,h44]),depends(l,r),lg:lg+l*h,cmetric(false),ctayswitch:true,ctayvar:l,ctaypov:1,ctaypt:0,christof(false),ricci(false),uricci(false),einstein(false),ratsimp(ein[1,1]));
79 (((h11*h22+h11^2)*('diff(l,r,1))^2*r^4+2*h33*'diff(l,r,2)*r^2)*sin(theta)^2+2*h44*'diff(l,r,2)*r^2+h33*h44*('diff(l,r,1))^2)/(4*r^4*sin(theta)^2);
81 /* TODO: Frames, torsion, nonmetricity */
83 /* Algebraic classification */
84 (init_ctensor(),cframe_flag:true,gcd:spmod,ctrgsimp:true,ratfac:true);
85 true;
86 ct_coordsys(exteriorschwarzschild,all);
87 done;
88 (ug:lg^^-1,weyl(false),nptetrad(false),psi(false));
89 done;
90 psi[0];
92 psi[1];
94 psi[2];
95 m/r^3;
96 psi[3];
98 psi[4];
100 petrov();
102 np.transpose(npi);
103 matrix([0,-1,0,0],[-1,0,0,0],[0,0,0,1],[0,0,1,0]);
104 /* Test cograd, contragrad */
105 (g:[0,0,0,0],diagmetric:true,cograd(1/r^2,g),g);
106 [0,-2/r^3,0,0];
107 (g:[0,0,0,0],diagmetric:false,contragrad(1/r^2,g),g);
108 [0,-2/r^3,0,0];
109 (g:[0,0,0,0],diagmetric:true,contragrad(1/r^2,g),g);
110 [0,-2/r^3,0,0];
111 kill(g);
112 done;
113 /* TODO: miscellaneous stuff: findde, dscalar, etc */
115 (reset(ratfac),0);