cadabra2 icon indicating copy to clipboard operation
cadabra2 copied to clipboard

Non-linear action principles

Open supercuerda opened this issue 8 years ago • 2 comments

Suppose you want to compute the equations of motion of a non-linear action principle, such as the Sine-Gordon model:

S:= \int { (\partial_t \phi)^2-(\partial_x \phi)^2 -2 + 2 \cos(\phi) }{x};

Can you compute the equations of motion? I tried using

vary(S, $\phi -> \delta{\phi}$)

But is seems not to work, as it keeps computing forever...

Is Cadabra equipped to deal with non-linear potentials? It seems to me that it only admits polynomial terms.

supercuerda avatar Oct 23 '17 19:10 supercuerda

This is somewhat related to https://cadabra.science/qa/79/error-in-using-vary . The problem is that it requires knowing the derivative of the cosine, and I would really like to avoid adding all that logic into cadabra itself (sympy should be taking care of that). At the moment, the way to solve this is to help cadabra a bit: if you start from

{t,x}::Coordinate;
\partial{#}::PartialDerivative;
\phi::Depends(\partial{#});
S:= \int{ (\partial_{t}{\phi})**2-(\partial_{x}{\phi})**2 -2 + 2 \cos(\phi) }{x};

just do the variation with

vary(S, $\cos(\phi) -> -\sin(\phi)\delta{\phi}, \phi -> \delta{\phi}$);

kpeeters avatar Oct 23 '17 19:10 kpeeters

Yes, I was hopping sympy would understand that. I will use your approach. Thanks!

supercuerda avatar Oct 23 '17 19:10 supercuerda