2
$\begingroup$

I want to work in the Schwarzchild metric in 2 dimensions with the coordinates $v, r, \theta$. My hope was that I could define a scalar function made up of 2 other scalar functions:

$$\Psi(v,r,\theta) = v + \phi(r) + \chi(v,r,\theta).$$

Then later, define a vector whose components are the partial derivative of this scalar:

$$u_\mu = \partial_\mu \Psi.$$

I was hoping that upon creation of the chart and basis, that by taking the derivatives of this scalar it would for instance know that $\partial_v \phi(r)=0$ without my needing to insert substitutions.

Any attempt at a minimal working example is as follows:

Clear["Global`*"]
<< xAct`xCoba`

DefManifold[M, 3, {a, b, c, d, e, f}]
DefChart[coords, M, {0, 1, 2}, {v[], r[], \[Theta][]}]

DefScalarFunction[\[CapitalPhi], X, \[Phi], \[Chi]]
\[CapitalPsi] = v[] + \[Phi][r[]] + \[Chi][v[], r[], \[Theta][]]
PDcoords[{-b, -coords}][\[CapitalPsi]]
TableOfComponents[%, -sch]

This currently gives an output of:

Throw: Uncaught Throw[Null] returned to top level.

I'm pretty new to xCoba so apologies if this is just a misunderstanding of functions and their definitions.

$\endgroup$
3
  • 1
    $\begingroup$ I think the RegisterIndices line is not needed. Also, are you sure you want to have coordinate chart coords and separately a basis (i.e. a frame) sch? Note that when you define a chart, the associated coordinate frame is defined with the same name, which also has its associated PD derivative. It's usually enough to work in this simpler situation. $\endgroup$
    – jose
    Oct 5, 2021 at 16:37
  • 1
    $\begingroup$ @jose yes I think you're right that they are unneeded for this minimal example. I kept trying to cut out code to get a minimal example and it looks like I could have kept slicing. I'll edit after work and possible change the answer. Thanks! $\endgroup$
    – akozi
    Oct 5, 2021 at 16:55
  • 1
    $\begingroup$ @jose yes, you were correct. I adjusted the original answer and question to reflect your suggestion. $\endgroup$
    – akozi
    Oct 6, 2021 at 0:07

2 Answers 2

2
$\begingroup$

As it turns out this was a minor error. If you want to define multiple scalar functions at the sametime, you have to define them using a list. I.e the line:

DefScalarFunction[\[CapitalPhi], X, \[Phi], \[Chi]]

becomes

DefScalarFunction[{\[CapitalPhi], X, \[Phi], \[Chi]}]

A few other notes, unless the dummy variable $b$ was expanded the line TableOfComponents is meaningless as there would currently be no components. As well, on the same line it should have been written as TableOfComponents[%, sch] as this command doesn't care about whether its the contravarient or covariant index.

Comparing the output of the minimal working example we can see that it now knows which functions have partial derivatives equal to zero, and sets them to zero:

Before:

In:

Clear["Global`*"]
<< xAct`xCoba`

DefManifold[M, 3, {a, b, c, d, e, f}]
DefChart[coords, M, {0, 1, 2}, {v[], r[], \[Theta][]}]

DefScalarFunction[\[CapitalPhi], X, \[Phi], \[Chi]]
\[CapitalPsi] = v[] + \[Phi][r[]] + \[Chi][v[], r[], \[Theta][]]
PDcoords[{-b, -coords}][\[CapitalPsi]] // Simplify

Out (Screenshot as it is less clear in input for):

enter image description here

After:

In:

Clear["Global`*"]
<< xAct`xCoba`

DefManifold[M, 3, {a, b, c, d, e, f}]
DefChart[coords, M, {0, 1, 2}, {v[], r[], \[Theta][]}]

DefScalarFunction[{\[CapitalPhi], X, \[Phi], \[Chi]}]
\[CapitalPsi] = v[] + \[Phi][r[]] + \[Chi][v[], r[], \[Theta][]]
PDcoords[{-b, -coords}][\[CapitalPsi]] // Simplify

Out (Screenshot as it is less clear in input for):

enter image description here

$\endgroup$
1
$\begingroup$

I have never worked with xCoba, but you could do:

\[CapitalPsi][v_, r_, \[Theta]_] :=  v + \[Phi][r] + \[Chi][v, r, \[Theta]]

Now

Grad[\[CapitalPsi][v, r, \[Theta]], {v, r, \[Theta]}]

will give you the desired result.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.