F(x,y,z,....)-F(x,y,z,....)=0
because it does not depend on such structure!
When dealing with tensors this is very common, due to symmetries and
other properties of tensors, to have a lot of equal or quasi-equal
expressions. Algebraic tensor calculus is in some sense a very simple
calculus because it use essentially sums and products of components of
tensors. The combination of this operators can be very large, of course,
but the possibility of collapse of quasi-equal terms is high. TTC
exploit this fact internally. Also the user can use them in a controlled
way as we shall see in Big calculus.
One of the functions which use a lot the compact utilities of TTC
is TensorSimplify
of trying to simplify the tensor as a whole.
One can choose the conversion operators ( Simplify, Expand,
Together,
...) to be used through a list in first argument of
TensorSimplify.
The syntax is
TensorSimplify[list][t]
where t is the tensor one wants to simplify.
Here we can appreciate the way tensor simplify works. We define a tensor in a raw way. Next we use SetCompactTensor or it's short syntax "=>". The effect of this is to join terms of equal basis element also it has the effect to attach the right hand side at the left whatever could happen at the right, as we shall see..... After we simplify the output using TensorSimplify This has the effect also to simplify the tensor T!!. If we define a new tensor Q as the not simplified version of T and then use TensorSimplify over the output the tensor Q will not be simplified. BUT if we use "=>" to define R as the same not simplified expression used in the definition of Q the effect is that R will we automatically defined as the simplified version . We use TensorSimplify[{Factor} over the not simplified expression an see what effect has over the tensor T,Q,R.Finally we use CompactTensor in order to see the actual simplified version of the not simplified expression.
T=2 X1(1/X1 X2+1/X1 X3) XX[1,2]+X3^3 X1 XX[1,3]+1/X1 XX[1,2]
1 X2 X3
-- dX1*.dX2 + 2 X1 (-- + --) dX1*.dX2 +
X1 X1 X1
3
>X1 X3 dX1*.dX3
T=>%
1 X2 X3 3
(-- + 2 X1 (-- + --)) dX1*.dX2 + X1 X3 dX1*.dX3
X1 X1 X1
Teq=%;
TensorSimplify[{Simplify}][%]
1 3
(-- + 2 X2 + 2 X3) dX1*.dX2 + X1 X3 dX1*.dX3
X1
T
1 3
(-- + 2 X2 + 2 X3) dX1*.dX2 + X1 X3 dX1*.dX3
X1
Q=%2
1 X2 X3
=-- dX1*.dX2 + 2 X1 (-- + --) dX1*.dX2 +
X1 X1 X1
3
> X1 X3 dX1*.dX3
TensorSimplify[{Simplify}][%]
1 3
(-- + 2 X2 + 2 X3) dX1*.dX2 + X1 X3 dX1*.dX3
X1
Q
1 X2 X3
-- dX1*.dX2 + 2 X1 (-- + --) dX1*.dX2 +
X1 X1 X1
3
> X1 X3 dX1*.dX3
R=>Teq
1 3
(-- + 2 X2 + 2 X3) dX1*.dX2 + X1 X3 dX1*.dX3
X1
TensorSimplify[{Factor}][ Teq]
1 + 2 X1 X2 + 2 X1 X3 3
--------------------- dX1*.dX2 + X1 X3 dX1*.dX3
X1
R
1 + 2 X1 X2 + 2 X1 X3 3
--------------------- dX1*.dX2 + X1 X3 dX1*.dX3
X1
Q
1 X2 X3
-- dX1*.dX2 + 2 X1 (-- + --) dX1*.dX2 +
X1 X1 X1
3
> X1 X3 dX1*.dX3
T
1 + 2 X1 X2 + 2 X1 X3 3
--------------------- dX1*.dX2 + X1 X3 dX1*.dX3
X1
CompactTensor[Teq]
1 + 2 X1 X2 + 2 X1 X3 3
--------------------- dX1*.dX2 + X1 X3 dX1*.dX3
X1
A you can see each time you use TensorSimplify the simplifications
performed in an object is used also in other objects.
TensorSimplify is also used in internal simplifications. In
this case, the variable TTCSimplify stores the list of simplification
operators that have to be used. You can modify this variable at will. The
frequency of internal simplifications is regulated with SimplifyLevel,
which runs from 0 through 4. A value of 0 disables internal simplifications.
The value SimplifyLevel is declared with InputSimplifyLevel.
Mathematica has the function Save to store in a file
the object definitions that are going to be used later on. To be able to
proceed the same way once TTC has been loaded TTCSave
has to be used. The complete syntax of this command is TTCSave[
file.ext, format, exp1, exp2,
...]
being file.ext the name of the file where the expressions are
to be saved. The parameter format can take two values: In
and Out. When format takes the value In, TTC
stores exp1, exp2,... in a format suitable
to be read in from Mathematica in another session in the file file.ext.
If format is equal to Out, exp1, exp2,,,,
are stored in the file file.ext in an easy-to-read way.
If the format parameter and .ext are omitted, TTC
creates two files: file.in and file.out with
the two types of formats.
You can save things like Riemann[g,x]or Metric[g,x ], Coordinates[x], BasisSymbols[{x,b} . Is your own responsibility to control if such objects are coherently stored and can be reused in a correctly mathematical way. For example if you store the Riemann but not the coordinates, metric ..etc. and then get the file in a session TTC probably ask for the coordinate system metric ...and you must enter it in a coherently way or interrupt the session!
In general it is useful to save space to use TTCSave with the option Compact[On] Se the subsection below...
TTCSave[path/file(.ext/
),(In/Out/omitted),{Coordinates[xn],Metric[gn,xn],
ChristoffelTensor[gn,xn],Riemann[gn,xn],Ricci[gn,xn],T,Q,....}]
will save in the file file the session in a order that it will be
correctly used later.
Note: If Compact[Off] TTCSave saves objects uncompacted. If Compact[On] TTCSave use the compact utilities to save objects.
It's strongly recomended that you don´t use these fucntions to clear objects and continue with a new sesion. If you want to make a NEW sesion is much more recomended to restart the Mathematica program and restart TTC . These functions are useful went you make a mistake in an Input function like InputCoordinates, InputMetric ....After the mistake there are no problem to use them.
They are:
ClearCoordinates ClearBasis ClearMetric ClearChange ClearTTCIf you clear a basis named {cc, bb} using ClearBasis[{cc,bb}] all objects that depends on it will be cleared. Hence, TTC clears not only the basis but also all objets related to it. The same it is true for the remaining three functions. Finally ClearTTC clear all things related to TTC .
First we calculate the ricci tensor for the kerr metric by using Compact[Off] and a simplifylevel=1 in order to sure that expression will not be very large. The time and memory used must be take as a reference numbers in order to compare with the second way to do the same calculus:
In[1]:=(
InputSimplifyLevel[1];
Compact[Off];
TTCSimplify={SinTosin,Together,sinToSin});
In[2]:=(
InputCoordinates[Boyer, {r, th, ph, t}];
ScalarBasis=Boyer;
A = r^2 - 2 M r + a^2 ;
B = r^2 + a^2 Cos[th]^2;
e = ZZ[Boyer];
g = -A/B e[4,4]+
A/B a Sin[th]^2 (e[3,4]+e[4,3])-
A/B a^2 Sin[th]^4 e[3,3]+
Sin[th]^2 /B (r^2+a^2)^2 e[3,3]+
Sin[th]^2 /B a^2 e[4,4]-
Sin[th]^2 /B (r^2+a^2) a (e[3,4]+e[4,3])+
B/A e[1,1]+
B e[2,2] ;
InputMetric[KERR, Boyer, g]);
In[3]:=Ricci[KERR,Boyer]//Timing
Out[3]={29.33 Second, 0}
In[4]:=MaxMemoryUsed[]
Out[4]=2021116
In the second way we use SimplifyLevel=0, that is no simplifications
at all, but we set Compact[On]. When the ricci tensor has been
calculated we simplify it (in fact all objects used in the calculus of
Ricci will be also simplified!!). You can see that the time is almost the
half and the memory used is less than in the first way!!
In[1]:=(
InputSimplifyLevel[0];
Compact[On];
TTCSimplify={SinTosin,Together,sinToSin});
In[2]:=(
InputCoordinates[Boyer, {r, th, ph, t}];
ScalarBasis=Boyer;
A = r^2 - 2 M r + a^2 ;
B = r^2 + a^2 Cos[th]^2;
e = ZZ[Boyer];
g = -A/B e[4,4]+
A/B a Sin[th]^2 (e[3,4]+e[4,3])-
A/B a^2 Sin[th]^4 e[3,3]+
Sin[th]^2 /B (r^2+a^2)^2 e[3,3]+
Sin[th]^2 /B a^2 e[4,4]-
Sin[th]^2 /B (r^2+a^2) a (e[3,4]+e[4,3])+
B/A e[1,1]+
B e[2,2] ;
InputMetric[KERR, Boyer, g]);
In[3]:=Ricci[KERR,Boyer];//Timing
Out[3]={6.54 Second, Null}
In[4]:=TensorSimplify[TTCSimplify][Ricci[KERR,Boyer]]//Timing
Out[4]={10.16 Second, 0}
In[5]:=MaxMemoryUsed[]
Out[5]=1383964
You must take into account that in both cases TensorSimplify is
able to recognize the symmetries of Ricci and other objects. That is the
fall in time is due essentially to the manipulation of expression within
Mathematica
. In the first case when Mathematica do something over an expression
it takes the expression itself. In the second case Mathematica takes
only a little object related to the expression. Only when TensorSimplify
acts all this little objects are set to the related expressions.
This page is maintained by XavierJaén.