Using Christoffel components in computations

755 views
Skip to first unread message

Daniel Mahler

unread,
Aug 22, 2014, 1:39:10 AM8/22/14
to xa...@googlegroups.com
This relates to the stackexchange question http://mathematica.stackexchange.com/questions/57726/proving-the-hairy-ball-theorem-using-xact

I have defined a chart and an explicit metric on the chart as

DefManifold[S2, 2, {a, b, c, d, e, f, g, h}]
DefMetric[1, metric[-a, -b], CD, {";", "\[Del]"}, PrintAs -> "g"]
DefChart[RS, S2, {0, 1}, {u[], v[]}]
MatrixForm[metricarray = 4/(1 + u[]^2 + v[]^2)^2 {{1, 0}, {0, 1}}]
MetricInBasis[metric, -RS, metricarray]
MetricCompute[metric, RS, All, CVSimplify -> Simplify]

it is the 2-spere with a stereographic project (ie the Riemman sphere)

I would now like to do something like

DefTensor[x[a], S2]
(CD[-a][x[b]]) // CovDToChristoffel // SeparateBasis[RS] // TraceBasisDummy // ToValues

but this with the Levi-Civita connection components plugged in.
The code above still leave them as \[Gamma]

thanks
Daniel

Jose

unread,
Aug 22, 2014, 11:37:40 AM8/22/14
to xa...@googlegroups.com
Hi Daniel,

Let us go in steps here. xCoba is indeed the xAct package to handle computations by components. It now has several different notations to do anything, and I understand it can get confusing. Let me recommend the following:

Start as you did:

In[1]:= Needs["xAct`xCoba`"]

In[2]:= DefManifold[S2, 2, {a, b, c, d, e, f, g, h}]

In[3]:= DefChart[RS, S2, {0, 1}, {u[], v[]}]

Then define the metric as a CTensor:

In[4]:= met = CTensor[4/(1 + u[]^2 + v[]^2)^2 {{1, 0}, {0, 1}}, {-RS, -RS}];

and set it as the main metric:

In[5]:= SetCMetric[met, RS]

You can see the components using

In[6]:= met[-a, -b]

Now compute everything about this metric:

In[7]:= MetricCompute[met, RS, All, CVSimplify -> Simplify]

The covariant derivative associated to that metric is now

In[8]:= cd = CovDOfMetric[met]

and the Christoffel of that connection is

In[9]:= chr = Christoffel[cd, PDRS]

Again, you can see its components using

In[10]:= chr[a, -b, -c]

To access an individual component use for example. (NOTE: If the following does not work add the definition   xAct`xCoba`Private`moveto[n_, n_] := {1}   somewhere):

In[11]:= chr[{0, RS}, {1, -RS}, {0, -RS}]

Note that you can do operations like

In[12]:= chr[a, -b, -c] chr[b, -a, -d] // Simplify

For example, now define two scalar functions:

In[13]:= DefScalarFunction[{x0, x1}]

and construct x:

In[14]:= x = CTensor[{x0[u[], v[]], x1[u[], v[]]}, {RS}];

Now you can compute for instance:

In[15]:= cd[a]@cd[-a]@x[b] // Simplify

In[16]:= % // InputForm

Hope that helps.

Cheers,
Jose.

Daniel Mahler

unread,
Aug 22, 2014, 6:39:48 PM8/22/14
to Jose, xa...@googlegroups.com
Hi Jose,

Thanks a lot.
The set up code runs fine and chr gets creted properly:

 In[14]:= chr[a, -b, -c]

Out[14]= xAct`xCoba`CTensor[{{{(-2) u[]/(1 + u[]^2 + v[]^2), (-2) v[]/(
    1 + u[]^2 + v[]^2)}, {(-2) v[]/(1 + u[]^2 + v[]^2), 2 u[]/(
    1 + u[]^2 + v[]^2)}}, {{
   2 v[]/(1 + u[]^2 + v[]^2), (-2) u[]/(1 + u[]^2 + v[]^2)}, {(-2) u[]/(
    1 + u[]^2 + v[]^2), (-2) v[]/(1 + u[]^2 + v[]^2)}}}, {
 RS, -RS, -RS}, 0][a, -b, -c]

but it runs into some problems at the end:

In[15]:= chr[{0, RS}, {1, -RS}, {0, -RS}]

During evaluation of In[15]:= Transpose::nmtx: The first two levels of {-((2 v)/(1+u^2+v^2)),-((2 u)/(1+u^2+v^2))} cannot be transposed. >>

During evaluation of In[15]:= CTensor::nobd: Incompatible number of bases 0 and array depth 1.

During evaluation of In[15]:= Throw::nocatch: Uncaught Throw[Null] returned to top level. >>

Out[15]= Hold[Throw[Null]]

In[16]:= chr[a, -b, -c] chr[b, -a, -d] // Simplify

Out[16]= xAct`xCoba`CTensor[{{
  8 (u[]^2 - v[]^2) (1 + u[]^2 + v[]^2)^(-2), 
   16 u[] v[] (1 + u[]^2 + v[]^2)^(-2)}, {
  16 u[] v[] (1 + u[]^2 + v[]^2)^(-2), (-8) (
    u[]^2 - v[]^2) (1 + u[]^2 + v[]^2)^(-2)}}, {-RS, -RS}, 0][-c, -d]

In[17]:= DefScalarFunction[{x0, x1}]

During evaluation of In[17]:= ** DefScalarFunction: Defining scalar function x0. 

During evaluation of In[17]:= ** DefScalarFunction: Defining scalar function x1. 

In[18]:= x = CTensor[{x0[u[], v[]], x1[u[], v[]]}, {RS}];

In[19]:= cd[a]@cd[-a]@x[b] // Simplify

During evaluation of In[19]:= Transpose::nmtx: The first two levels of {x0[u,v],x1[u,v]} cannot be transposed. >>

Out[19]= xAct`xCoba`CCovD[PDRS, 
xAct`xCoba`CTensor[{{{(-2) u[]/(1 + u[]^2 + v[]^2), (-2) v[]/(
     1 + u[]^2 + v[]^2)}, {(-2) v[]/(1 + u[]^2 + v[]^2), 2 u[]/(
     1 + u[]^2 + v[]^2)}}, {{
    2 v[]/(1 + u[]^2 + v[]^2), (-2) u[]/(1 + u[]^2 + v[]^2)}, {(-2) u[]/(
     1 + u[]^2 + v[]^2), (-2) v[]/(1 + u[]^2 + v[]^2)}}}, {RS, -RS, -RS}, 
  0], 
xAct`xCoba`CTensor[{{4 (1 + u[]^2 + v[]^2)^(-2), 0}, {
   0, 4 (1 + u[]^2 + v[]^2)^(-2)}}, {-RS, -RS}, 0]][a][
$Failed[b, -a]]

In[20]:= % // InputForm

Out[20]//InputForm=
CCovD[PDRS, CTensor[{{{(-2*u[])/(1 + u[]^2 + v[]^2), (-2*v[])/(1 + u[]^2 + v[]^2)}, {(-2*v[])/(1 + u[]^2 + v[]^2), (2*u[])/(1 + u[]^2 + v[]^2)}}, 
     {{(2*v[])/(1 + u[]^2 + v[]^2), (-2*u[])/(1 + u[]^2 + v[]^2)}, {(-2*u[])/(1 + u[]^2 + v[]^2), (-2*v[])/(1 + u[]^2 + v[]^2)}}}, {RS, -RS, -RS}, 0], 
   CTensor[{{4/(1 + u[]^2 + v[]^2)^2, 0}, {0, 4/(1 + u[]^2 + v[]^2)^2}}, {-RS, -RS}, 0]][a][$Failed[b, -a]]

I am afraid I do not understand xAct enough to figure out what it is trying to tell me

thanks
Daniel

--
You received this message because you are subscribed to the Google Groups "xAct Tensor Computer Algebra" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xact+uns...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jose

unread,
Aug 22, 2014, 6:42:58 PM8/22/14
to xa...@googlegroups.com
That's a bug.

Before executing the line that fails, execute this:

xAct`xCoba`Private`moveto[n_, n_] := {1}

Cheers,
Jose.
To unsubscribe from this group and stop receiving emails from it, send an email to xact+unsubscribe@googlegroups.com.

Daniel Mahler

unread,
Sep 3, 2014, 9:31:56 PM9/3/14
to xa...@googlegroups.com
Thanks, Jose! That works for me now.
Could you explain the difference between the your approach
and the approach that I was initially trying which comes from the documentation.

Also are there conceptual/desig documents for xAct & xCoba.
I find I can often get things to work by trial and error
without really understanding why one thing worked and another did not.

ttheanks
Daniel
To unsubscribe from this group and stop receiving emails from it, send an email to xact+uns...@googlegroups.com.

Alfonso García-Parrado Gómez-Lobo

unread,
Sep 4, 2014, 6:42:54 AM9/4/14
to Daniel Mahler, xa...@googlegroups.com
Dear Daniel,


> Thanks, Jose! That works for me now.
> Could you explain the difference between the your approach
> and the approach that I was initially trying which comes from the
> documentation.
>
>
I can answer this question. I attach a notebook in which the computation
is done following your initial approach.

Regards,

Alfonso.

S2.nb

Daniel Mahler

unread,
Sep 4, 2014, 4:33:03 PM9/4/14
to Alfonso García-Parrado Gómez-Lobo, xa...@googlegroups.com
Thanks Alfonso! I still do not understand what differnece between these approaches is. When is each approach appropriate? Can you use objects creted in the two approaches together? It looks like the tensors produced in the twoo approaches are different kinds of object or at least they diplay differently. In the original approach you mainly get algebrac expressions involving basis vectors while in Jose's approach you get CTensors which display as arrays together with indexes indicating the signature of the tensor. How can you tell which functions are applicable to which kind of object?

reards
Daniel


Jose

unread,
Sep 7, 2014, 1:26:28 PM9/7/14
to xa...@googlegroups.com
Yes, xCoba does not have a single unified approach to component computations. The original idea was to keep it as close as possible to the abstract approach of xTensor, to have a smooth transition between the packages and to make xCoba use internally the tools of xTensor. That resulted in a very general system (as Alfonso has shown several times), but slower than I had anticipated. That's why there is an alternative approach, gravitating around MetricCompute, which is complementary: it does only what it does, but fast. The point is that it does precisely what most relativists want to do: computing curvature tensors from a metric in a (coordinated or not) frame. CTensor was born basically as an interface to the results of MetricCompute, though now it has a life of its own.

The two approaches can be partially mixed. For example, using your settings, we can do:

In[38]:= CTensor[{x1, x2}, {RS}][a]
Out[38]= CTensor[{x1, x2}, {RS}, 0][a]

In[39]:= ToBasisExpand[%]
Out[39]= x1  Basis[{0, -RS}, a] + x2  Basis[{1, -RS}, a]

In[40]:= FromBasisExpand[%, {RS}]
Out[40]= CTensor[{x1, x2}, {RS}, 0][a]

Concerning which functions can be applied, the original approach handles everything, but CTensor does not, though as I said it handles the fundamental parts. We'll see if we can put together a basic doc file for MetricCompute & co. from old example notebooks.

Cheers,
Jose.
To unsubscribe from this group and stop receiving emails from it, send an email to xact+unsubscribe@googlegroups.com.

Jose

unread,
Sep 28, 2014, 8:52:36 PM9/28/14
to xa...@googlegroups.com
Hi,

There is some additional documentation about all this now. See the file xCobaDoc2.nb in xAct 1.1.1.

Cheers,
Jose.

Daniel Mahler

unread,
Dec 8, 2014, 12:50:08 AM12/8/14
to xa...@googlegroups.com
Hi Jose,

Thank you very much. This is very useful.

regards
Daniel
Reply all
Reply to author
Forward
0 new messages