How to define a vector/tensor in xCoba

860 views
Skip to first unread message

Mario Galante

unread,
Nov 9, 2015, 11:08:19 AM11/9/15
to xAct Tensor Computer Algebra
Hi all,

I have a question that maybe is too basic, but here it goes:

I was using xCoba to compute some on shell actions, and I tried to compute a term like this 

G_{\alpha \beta} n^{\alpha} n^{\beta}

where G is the Einstein tensor, and n is a normal vector. I had no problem working out the Einstein tensor part, I define a CTensor that after set as a metric 

g=CTensor[{{-F[r[]], 0, 0, 0, 0}, {0, 1/F[r[]], 0, 0, 0}, {0, 0, r[]^2, 0, 0}, {0, 0, 0, r[]^2 Sin[\[Psi][]]^2, 0}, {0, 0, 0, 0, r[]^2 Sin[\[Theta][]]^2 Sin[\[Psi][]]^2}}, {-S, -S}, 0]
SetCMetric[g, S]

and with that, I told Mathematica to compute all the geometric tensors related to g 

MetricCompute[g, S, All].


The problems arose  when I tried to define a vector n[-a] with a definite value in the chart where g is the metric. I tried again CTensor, but with that construction doesn't allow me to use "n" as a tensor in a contraction, for example g[a,b]n[-a]n[-b]. 

I don't know if I'm being clear enough, I will attach a notebook to this thread asap.

thanks in advance,

Mario
 




Jose

unread,
Jan 24, 2016, 1:30:24 PM1/24/16
to xAct Tensor Computer Algebra
Hi,

As a general comment, it helps if you send full code up to the point where things do not work, so that we don't have to guess what your setup was.

An example:

In[1]:= << xAct`xCoba`

In[2]:= DefManifold[M, 5, {a, b, c, d, e, f}]

In[3]:= DefChart[S, M, {0, 1, 2, 3, 4}, {t[], r[], \[Theta][], \[Phi][], \[Psi][]}]

In[4]:= DefScalarFunction[F]

Your metric:

In[5]:= g = CTensor[{{-F[r[]], 0, 0, 0, 0}, {0, 1/F[r[]], 0, 0, 0}, {0, 0, 
     r[]^2, 0, 0}, {0, 0, 0, r[]^2 Sin[\[Psi][]]^2, 0}, {0, 0, 0, 0, 
     r[]^2 Sin[\[Theta][]]^2 Sin[\[Psi][]]^2}}, {-S, -S}, 0];
SetCMetric[g, S, SignatureOfMetric -> {4, 1, 0}]

In[7]:= MetricCompute[g, S, All]

Extract the Einstein tensor:

In[8]:= G = Einstein[CovDOfMetric[g]];

A random choice for the n vector:

In[9]:= DefScalarFunction[{n0, n1}]

In[10]:= n = CTensor[{n0[r[]], n1[t[], r[]], 0, 0, 1}, {S}];

The computation you wanted, with two different index configurations. xCoba worries about putting metric factors where needed:

In[11]:= result1 = G[-a, -b] n[a] n[b];

In[12]:= result2 = G[a, b] n[-a] n[-b];

The results must coincide:

In[13]:= Simplify[result1 - result2]
Out[13]= 0

Cheers,
Jose.
Reply all
Reply to author
Forward
0 new messages