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

Hi community.

My problem is simple, but I don't know if there is a solution implemented in cadabra.

I have expressions, after applying the substitutealgorithm, that contain higher order partial derivatives, say

\partial_{t i}{ T^{j} }

or

\partial_{t i j}{ T^{j} }

or

\partial_{t i t j}{ T^{k} }

I'd like to rewrite any possible combination of partial derivatives in a sorted way, with all the "time" derivatives at last, i.e. to transfor the above expressions to:

\partial_{i t}{ T^{j} }
\partial_{i j t}{ T^{j} }
\partial_{i j t t}{ T^{k} }

respectively.

Question

Does anyone know how to achieve this? Considering that it might be an undefined number of "time" and "space" derivatives.

in General questions by (15.0k points)

1 Answer

+1 vote
 
Best answer

This works in most cases:

{i,j,k,l}::Indices(space, position=free).
{t, \tau}::Indices(time, position=free).
{i,j,k,l,t}::SortOrder;
\partial{#}::PartialDerivative;
ex := \partial_{t i}{ T^{j} };
canonicalise(ex);
ex := \partial_{t i j}{ T^{j} };
canonicalise(ex);
ex := \partial_{t i t j}{ T^{k} };
canonicalise(ex);

The only case which is not exactly what you want is when an index is summed according to the Einstein convention; the summation and canonicalization have the effect of raising one of the indices.

The following is another variant, which also has an issue when an index is summed according to the Einstein convention, it's just a different issue:

{i,j,k,l}::Indices(space, position=independent).
{t, \tau}::Indices(time, position=independent).
{i,j,k,l,t}::SortOrder;
\partial{#}::PartialDerivative;
ex := \partial_{t i}{ T^{j} };
canonicalise(ex);
ex := \partial_{t i j}{ T^{j} };
canonicalise(ex);
ex := \partial_{t i t j}{ T^{k} };
canonicalise(ex);
by (2.0k points)
selected by

Hmmm...

Hi GPN. I was very exited with your answer, but unfortunately it didn't work!!!

(Weird, isn't it?)

Thank you for the suggestion. Dox.

Sorry, I fixed it now by adding the line

\partial{#}::PartialDerivative;

(which is always defined in my notebooks, which is why I made the mistake). Give it a try, I hope it works for you now.

GPN

Great!!! Thank you.

...