2 (if get('ctensor,'version)=false then load(ctensor),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);
14 testmetric(confocalelliptic);
18 testmetric(parabolic);
20 testmetric(cartesian3d);
22 testmetric(polarcylindrical);
24 testmetric(ellipticcylindrical);
26 /* testmetric(confocalellipsoidal);
28 /* testmetric(bipolarcylindrical);
30 testmetric(paraboliccylindrical);
32 testmetric(paraboloidal);
34 /* testmetric(conical);
38 testmetric(spherical);
40 testmetric(oblatespheroidal);
42 testmetric(oblatespheroidalsqrt);
44 testmetric(prolatespheroidal);
46 testmetric(prolatespheroidalsqrt);
48 testmetric(cartesian4d);
50 testmetric(spherical4d);
52 testmetric(exteriorschwarzschild);
54 testmetric(interiorschwarzschild);
56 testmetric(kerr_newman);
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]);
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);
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);
86 ct_coordsys(exteriorschwarzschild,all);
88 (ug:lg^^-1,weyl(false),nptetrad(false),psi(false));
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);
107 (g:[0,0,0,0],diagmetric:false,contragrad(1/r^2,g),g);
109 (g:[0,0,0,0],diagmetric:true,contragrad(1/r^2,g),g);
113 /* TODO: miscellaneous stuff: findde, dscalar, etc */