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