1 /* Copyright (C) 2009 Viktor T. Toth <http://www.vttoth.com/>
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.
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.
13 * MAXIMA CTENSOR demo: Deriving the equation of hydrostatic
14 * equilibrium in a spherically symmetric static metric.
20 We derive the equation of hydrostatic equilibrium in a static,
21 spherically symmetric metric. First, we load the tensor packages...")$
22 if get('ctensor,'version)=false then load(ctensor);
23 if get('itensor,'version)=false then load(itensor);
24 ("The metric is characterized by two parameters, A and B, as usual.")$
25 ("In addition, we have the energy density rho and pressure p.")$
26 ("These are all functions of the radial coordinate r.")$
28 depends([A,B,rho,p],[r]);
29 ("We form the covariant derivative of the stress-energy tensor,
30 and convert it into a ctensor program. This derivative must be zero
31 for matter distribution satisfying the Einstein field equations.")$
32 EQ:ic_convert(covdiff(T([a],[b]),b)=J([a],[]));
33 ("We now form the general spherically symmetric static metric.")$
34 ct_coords:[t,r,theta,phi];
39 lg[4,4]:-r^2*sin(theta)^2;
42 ("We also form the energy-momentum tensor from rho and p.")$
45 T[2,2]:T[3,3]:T[4,4]:-p;
46 ("We initialize J as a zero vector...")$
48 ("... and evaluate the program generated by ic_convert.")$
50 ("We note that only one component of J is not trivial:")$
52 ("However, even this component must be zero.
53 We convert this equation into the usual form:")$
54 factor(diff(p,r)=diff(p,r)+J[2]);
55 ("This is the equation of hydrostatic equilibrium.")$
56 ("It appears in many textbooks, for instance Weinberg's Gravitation
57 and Cosmology (1972), Eq. (11.1.8).")$
59 /* End of demo -- comment line needed by MAXIMA to resume demo menu */