# Commutation of the partial derivatives on scalar in xAct

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?

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

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


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

SortCovDsStart[PD]


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

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


To stop the automatic commutation of derivatives use

SortCovDsStop[PD]