1/* Copyright (C) 2004 Viktor T. Toth <http://www.vttoth.com/>
2 *
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License as
5 * published by the Free Software Foundation; either version 2 of
6 * the License, or (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be
9 * useful, but WITHOUT ANY WARRANTY; without even the implied
10 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 * PURPOSE.  See the GNU General Public License for more details.
12 *
13 * MAXIMA CTENSOR demo: The Petrov classification of the Kerr metric.
14 *
15 */
16
17("Attempt to compute the Petrov classification of the Kerr metric.")$
18("First, we need to load modules and define the metric:")$
19if get('ctensor,'version)=false then load(ctensor);
20init_ctensor();
21gcd:spmod;
22ct_coords:[t,r,h,p]$
23declare([a,m],constant)$
24s(r,h):=r^2+(a*cos(h))^2$
25d(r):=a^2-2*m*r+r^2$
26dim:4$
27fri:matrix(
28  [sqrt(d(r)/s(r,h)), 0, 0, -sqrt(d(r)/s(r,h))*a*sin(h)^2],
29  [0, sqrt(s(r,h)/d(r)), 0, 0],
30  [0, 0, sqrt(s(r,h)), 0 ],
31  [-a/sqrt(s(r,h))*sin(h), 0, 0, (s(r,h)+(a*sin(h))^2)*sin(h)/sqrt(s(r,h))]);
32("We need aggressive simplification to ensure that the result is correct.")$
33ctrgsimp:true;
34ratfac:true;
35cframe_flag:true;
36cmetric(false);
37ug:invert(lg)$
38nptetrad(false);
39("Verify the tetrad")$
40trigsimp(np.transpose(npi));
41christof(false);
42lriemann(false);
43ricci(false);
44weyl(false);
45/*
46("Since we use a tetrad frame, the Weyl tensor was computed in the tetrad
47  base. We need the Weyl tensor in the coordinate base to compute the
48  Newman-Penrose coefficients, so we must do a conversion first. Please
49  be patient; this is not very efficient and will take a while:")$
50for i thru dim do for j thru dim do for k thru dim do for l thru dim do
51    w2[i,j,k,l]:weyl[i,j,k,l];
52for i thru dim do for j thru dim do for k thru dim do for l thru dim do
53    weyl[i,j,k,l]:sum(sum(sum(sum(w2[ii,jj,kk,ll]*fri[ii,i]*fri[jj,j]*
54                  fri[kk,k]*fri[ll,l],ii,1,dim),jj,1,dim),kk,1,dim),ll,1,dim);
55*/
56("Now we are ready to compute the Newman-Penrose coefficients:")$
57psi(true);
58petrov();
59
60/* End of demo -- comment line needed by MAXIMA to resume demo menu */
61