Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
+5 votes

Hi everyone, I'm trying to derive the equations of motion of a scalar field with a potential $V(\phi)$, $S:= -\int \sqrt{-g}(\frac{1}{2}g^{\mu \nu} \partial_{\mu}{\phi} \partial_{\nu}{\phi}+V )d^4x$; however when I compute the variational derivative of the action with respect to $\phi$ the potential does not appear (due to property V::Depends(x), only allow to make objects implicitly dependent on the coordinates). Is there any property in Cadabra which Makes an object explicitly dependent on other objects, like $V(\phi)$?

Thank you !!

in General questions by

2 Answers

+3 votes
 
Best answer

This is not automatic (yet), but it's not difficult to work around it by simply adding another rule for how $V$ should vary. Something like

\partial{#}::PartialDerivative;
\delta{#}::Accent;
g^{\mu\nu}::Symmetric;
S:= \int{ \sqrt{-g} ( 1/2 g^{\mu\nu}\partial_{\mu}{\phi} \partial_{\nu}{\phi} + V) }{x};
rl:= \phi -> \delta{\phi}, V -> V' \delta{\phi};
vary(S, rl)
sort_product(S)
canonicalise(_)

will produce

$$\int \sqrt{-g}(\partial_{\mu} \delta{\phi} \partial_{\nu} \phi g^{\mu\nu} + V^\prime \delta{\phi}) {\rm d}x$$

after which you can do

distribute(_)
integrate_by_parts(_, $\delta{\phi}$)
factor_out(_, $\delta{\phi}$);

to get things in an equation-of-motion form.

by (82.5k points)
0 votes

It is now working for only scalar fields.

Can we solve the action of Einstein-Maxwell gravity coupled minimally to a scalar field by cadabra?

\begin{equation} S=\int d^{3}x\sqrt{-g}\left( \mathcal{R}-2\partial _{\mu }\phi \partial ^{\mu }\phi -F^{2}-V\left( \phi \right) \right) \end{equation}

Thanks

by (250 points)
edited by

This is not an anser to the question!

...