I do not know how to automatically commute partial derivatives on a scalar and simplify it. For example, if I have: $$\partial_a \partial_b \partial_c f- \partial_c \partial_a \partial_b f $$ where $f$ is a scalar function, the ToCanonical and Simplification command do not simplify this. I also use CommuteCovdsonScalar command, but it doesn't work as well. Could anybody help me?


1 Answer 1


The recommended way to do something like this is to use SortCovDs, which may introduce Christoffel terms if needed:

In[6]:= PD[-a]@PD[-b]@PD[-c]@F[] - PD[-c]@PD[-a]@PD[-b]@F[] // SortCovDs
Out[6]= 0

If you want to automate SortCovDs for a given derivative, say PD in this case, use:


Then this will automatically give zero (again, for general covariant derivatives this would produce Christoffel terms):

In[9]:= PD[-a]@PD[-b]@PD[-c]@F[] - PD[-c]@PD[-a]@PD[-b]@F[]
Out[9]= 0

To stop the automatic commutation of derivatives use


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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