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

Recently, I always stuck on an issue as the following: (In Cadabra2)

{a, b, c}::Indices.
D{#}::Derivative.
ex:=  D^{a}{A} D_{a}{B} + D^{a}{B} D_{a}{A};
sort_product(_);
canonicalise(_);
collect_terms(_);

The correct answer should be 2D^{a}{A} D_{a}{B}. But, I always can't get it. Thus, I am not quite sure what the problem is.

  • sort_product : ex should be sorted by indices? or the objects(i.e. A or B)?
  • canonicalize : which seems only care about the indices.

By the way, I wish there can be a feature like sort_sum as in the old Cadabra1.

in General questions by (400 points)

2 Answers

+2 votes
 
Best answer

This is now fixed in the version on github. sort_sum is coming.

by (82.4k points)
selected by

sort_sum is now included.

+2 votes

Thanks for spotting this one, it's a bug in sort_product, which should have moved the derivative on $A$ to the left of the derivative on $B$. A subsequent canonicalise would then do the trick. The bug is a consequence of some new code for expression comparison. I'll try to get a fix out asap.

by (82.4k points)

Thanks a lot! Problem solved!

...