[xAct] Equations of Motion from Metric using VarD

70 views
Skip to first unread message

Filomela Gerou

unread,
Aug 26, 2024, 4:54:33 PMAug 26
to leo....@gmail.com, xa...@googlegroups.com
Hi xAct Community, Hi Leo,

I was hoping to get some insight on why when I run the following file, it does not output the equation of motion, but "VarD..." and a "Hold[Null]" error. I have followed what the example files in github say but with no luck. Below is a screenshot of my output. Any help would be greatly appreciated.

Thank you,

Filomela
Screenshot 2024-08-26 at 4.40.54 PM.png
[xAct] example.nb

Juan Margalef

unread,
Aug 29, 2024, 9:33:30 AMAug 29
to xAct Tensor Computer Algebra
Hi Filomena,

You have a few mistakes in your code but, thanks to the error messages, we can solve them. Let's go one by one:

1. "Symbol A is already used as a scalar function

This appears when you write DefTensor[A[-a], M4] because you have already used A to define a scalar function in the line above. The way to solve it is by changing the "A" by another name in one of the definitions. For instance: DefScalarFunction /@ {U, anothername};

2. Found inhomogeneous indices {IndexList[], \IndexList[-a, -b]}

This tells you that in some expressions, you add terms with different indices (one with no indices and another with indices {-a,-b}). The problem here is a bit more complicated and is originated in your definition 

F[-a, -b] := CD[-a]@A[-b] - CD[-b]@A[-a]; 

Unfortunately, this is not a good definition and should be removed. If you write  F[-a, -b] F[a, b] you will see that the first one is substituted but the second one is not, because Mathematica doesn't recognize the pattern (your definition includes minuses and without them, there is no substitution). The same will happen if you write F[-c,-d]. You have first to define F as a tensor DefTensor[F[-a,-b],M] and then use IndexSet 

IndexSet[F[a_, b_], CD[a]@A[b] - CD[b]@A[a]]

3. Then you have another problem, and it is that you include Exp[- a \[Phi][]]. That "a" is defined as an index so you have to change it to another name (probably the function we defined previously "anothername" or, even better, a new tensor DefTensor[function[], M4]).

4. You have to define DefTensorPerturbation for the tensor A and for the function "function".

I think that with these changes, you should be able to get what you were looking for!

Best,
Juan

Filomela Gerou

unread,
Aug 30, 2024, 9:35:21 AMAug 30
to Juan Margalef, xAct Tensor Computer Algebra
Hi Juan,

Thank you so much for your help and detailed explanation! I appreciate it greatly.

I implemented the above corrections, and unfortunately the output is the same. Do you, (or someone else in the thread), have any more insights into why that could happen? The updated code is below

Should I resort to writing this in with VarAction or VarL instead?

Thanks,

Filomela

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/xact/0358d314-1ed4-4456-b637-eede1aecd250n%40googlegroups.com.
[xAct] example.nb

Juan Margalef

unread,
Sep 11, 2024, 5:53:32 AMSep 11
to xAct Tensor Computer Algebra
Hi Filomela,

I think you would benefit a lot from reading the documentation and the examples of the website since there are many basic mistakes in your code. 

1. UpSet: Tag C in ... is Protected. 

This means that you cannot use the name "C" for a tensor, change it for instance to CC

2. 

L = Sqrt[-Detg[]] (RicciScalarCD[] -
      1/2*CD[-a][\[Phi][]] CD[a][\[Phi][]] -
      1/4 Exp[- C \[Phi][]] IndexSet[F[a_, b_],
        CD[a]@A[b] - CD[b]@A[a]];);

IndexSet is a standalone function that sets the value of F. You used it before in the right place and from that point on, you can simply write F[a,b], F[-a,-c]...

I guess you want

L = Sqrt[-Detg[]] (RicciScalarCD[] -
    1/2*CD[-a][\[Phi][]] CD[a][\[Phi][]] -
    1/4 Exp[- CC[] \[Phi][]] F[a, -a])

Notice the brackets after CC that you missed before.

3. VarD[F[LI[1], -a, -b], CD] will always return zero since F[-a,-b] is automatically substitute by CD[-a][A[-b]]-CD[-b][A[-a]]. If you want to work with both A and F you should use MakeRule instead of IndexSet

4. VarD[\[Delta]\[Phi][LI[1]], CD] shold be changed by VarD[\[Delta]\[CurlyPhi][LI[1]], CD]. Notice that \[Delta]\[Phi] appears in blue because it has not been defined

5. 

ds2 = \[Lambda] (r) dt^2 - \[Lambda] (r)^(-1) dr^2 - R^2 d\[Theta]^2 -
    R^2 Sin[\[Theta]]^2 d\[Phi]^2;
\[Lambda] (r) = (1 - rPlus/r) (1 - rMinus/r)^((1 - C^2)/(1 + C^2));

doesn't make too much sense. You should remove it or comment it with (*  *)

6. R == RAsymptotic doesn't contain M or Q, so solving this for M and Q doesn't make sense.

I hope this helps!
Reply all
Reply to author
Forward
0 new messages