First time here? Check out the FAQ!
answered 1 year ago
Based on the advice from @max and @eric_g - the following works:
commutator_f.expr() \ .collect(diff(f)[0].expr()) \ .collect(diff(f)[1].expr()) \ .collect(diff(f)[2].expr()) \ .collect(diff(f)[3].expr())
Many thanks GPN