# Victor T.Toth

## http://www.vttoth.com/CMS/projects/61-the-maxima-computer-algebra-system

Example of using Maxima for derivation of Schwartzschild metric from Hilbert Variational principle.
Below L is Lambda-term.
Slightly corrected by S.Blinnikov on 21st October 2012 (Novosibirsk): Friedmann lines are removed.

if get('ctensor,'version)=false then load(ctensor);

if get('itensor,'version)=false then load(itensor);

remsym(g,2,0);
remsym(g,0,2);
remsym(gg,2,0);
remsym(gg,0,2);
remcomps(gg);
imetric(gg);

icurvature([a,b,c],[e])*gg([d,e],[])$

contract(rename(expand(%)))$

%,ichr2$

contract(rename(expand(%)))$

canform(%)$

contract(rename(expand(%)))$

components(gg([a,b],[]),kdels([a,b],[u,v])*g([u,v],[])/2);

components(gg([],[a,b]),kdels([u,v],[a,b])*g([],[u,v])/2);

%th(4),gg$

contract(rename(expand(%)))$

contract(canform(%))$

imetric(g);

contract(rename(expand(%th(2))))$

remcomps(R);

 components(R([a,b,c,d],[]),%th(2));

g([],[a,b])*R([a,b,c,d])*g([],[c,d])$

contract(rename(canform(%)))$

contract(rename(canform(%)))$

components(R([],[]),%);

decsym(g,2,0,[sym(all)],[]);

decsym(g,0,2,[],[sym(all)]);

ishow(1/(16*%pi*G)*((2*L+'R([],[])))*sqrt(-determinant(g)))$

L0:%,R$

canform(contract(canform(rename(contract(expand(diff(L0,g([],[m,n]))-
    idiff(diff(L0,g([],[m,n],k)),k)+idiff(rename(idiff(contract(
    diff(L0,g([],[m,n],k,l))),k),1000),l)))))))$

ishow(e([m,n],[])=canform(%*16*%pi/sqrt(-determinant(g))))$

EQ:ic_convert(%)$

ct_coords:[t,r,u,v];

lg:ident(4);

lg[1,1]:B;
lg[2,2]:-A;
lg[3,3]:-r^2;
lg[4,4]:-r^2*sin(u)^2;

kill(dependencies);

dependencies(A(r),B(r));

cmetric();

christof(false);

e:zeromatrix(4,4);

ev(EQ);

E:expand(radcan(ug.e));

exp:findde(E,2);

solve(ode2(exp[1],A,r),A);

%,%c=-2*M;

a:%[1],%c=-2*M;

ode2(ev(exp[2],a),B,r);

b:ev(%,%c=rhs(solve(rhs(%)*rhs(a)=1,%c)[1]));

factor(ev(ev(exp[3],a,b),diff));

lg:ev(lg,a,b),L=0$

ug:invert(lg)$

block([title: "Schwarzschild Potential for Mass M=2",M:2.],
    wxplot3d([r*cos(th),r*sin(th),1-ug[1,1]],[r,5.,50.],[th,-%pi,%pi],
    ['grid,20,30],['z,-2,0],[psfile],['legend,title]));