Minimal Working Example for coordinate transformation

429 views
Skip to first unread message

Gabriele Bozzola

unread,
May 19, 2018, 2:15:31 PM5/19/18
to xAct Tensor Computer Algebra
Hi,

I am trying to understand if xAct&friends could fit my needs. In particular, I often have to work with components, so xCoba is the package I am studying. 
Yet, despite having looked at the latest xCoba documentation and some of the questions posted in this forum, I could not figure out how to archive a very 
simple task. For concreteness let's consider a Euclidean R^3 space. I can start with Spherical coordinates (r,theta,phi) and the metric of this manifold would 
be diag(1,r^2,r^2 sin(theta)^2). Now, I can define a new set of coordinates, for example, the Cartesian coordinates. So I define the coordinate (x,y,z) and I
have a transformation law to express (x,y,z) as functions of (r,theta,phi). My goal is to find the transformed metric (which should be diag(1,1,1)). 

My (unsuccessful) attempt modeled on the shape of what I find in the documentation is the following:

Needs["xAct`xCoba`"]
DefManifold[M, 3, IndexRange[a, c]]
DefChart[sph, M, {1, 2, 3}, {r[], \[Theta][], \[Phi][]}]
bc
= {{r[] Sin[\[Theta][]] Cos[\[Phi][]], 0, 0 }, {0,
   r
[] Sin[\[Theta][]] Sin[\[Phi][]], 0}, {0, 0,
   r
[] Cos[\[Theta][]]}}
DefBasis[cart, TangentM, {1, 2, 3},
 
BasisChange -> CTensor[bc, {-cart, sph}], BasisColor -> Red]
met
= CTensor[{{1, 0, 0}, {0, r[]^2, 0}, {0, 0,
    r
[]^2 Sin[\[Theta][]]^2}}, {-sph, -sph}]
ToCTensor[met, {-cart, -cart}]


Honestly, I don't know what I am doing. In particular, I don't understand why I have both charts and basis involved.

Could anyone give me some directions?

Thank you,
Gabriele 

Alfonso García-Parrado

unread,
May 21, 2018, 4:23:49 AM5/21/18
to Gabriele Bozzola, xAct Tensor Computer Algebra
Dear Gabriele,

I attach a notebook with your computation. Note that in the BasisChange
option you need to add the Jacobian matrix corresponding to the
coordinate change you have, not the coordinate change itself (which by
the way isn't a matrix). Usually you don't know this Jacobian matrix in
advance so the best is define both charts with DefChart and then
compute the Jacobian matrix separately. Once this is done you use
SetBasisChange to declare the Jacobianmatrix you computed as the matrix
relating both holonomic frames (see the notebook for further details).

Hope the notebook helps you.

Regards,

Alfonso.
CTensorChangeCoords.nb

Gabriele Bozzola

unread,
May 21, 2018, 12:19:51 PM5/21/18
to xAct Tensor Computer Algebra
Hi, Alfonso

Thank you for your answer, I'll study the notebook.

Gabriele
Reply all
Reply to author
Forward
0 new messages