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

\wedge does not seem to be able to distribute a sum, i.e. \wedge(A, B+C) does not give \wedge(A,B) + \wedge(A,C).

Here is an example with cadabra2 version compiled on August 17, 2017.

A::DifferentialForm(degree=1).
B::DifferentialForm(degree=2).
C::DifferentialForm(degree=3).
d{#}::ExteriorDerivative.
ex:=C= d{B}+A ^ B;
ge:=d{C}+A ^ C;
substitute(ge,ex);

produces:

C= dB + A \wedge B
dC + A \wedge C
d (dB + A \wege B) +  A \wedge dB + A \wedge B
in Bug reports by (180 points)

2 Answers

+3 votes
 
Best answer

The bug is not so much that distribution does not happen automatically (more on that below), but that the last term is manifestly wrong (there should be no A ^ B in the answer). I don't know how that slipped the net, but it's embarrassing... Will fix.

Now the distribution thing. In Cadabra, distribution of operators over sums is not automatic, you need to call

distribute(ge);

explicitly to make that happen. Similarly, the product rule is not applied automatically; you need to call

product_rule(ge);

explicitly. If you do want this to happen automatically, define your post_process function to read something like

def post_process(ex):
   distribute(ex)
   sort_product(ex)
   collect_terms(ex)

(you can stick this in the first cell of the notebook).

by (80.3k points)
selected by
+2 votes

This is now fixed in the version on github, thanks for reporting the issue.

(The problem was actually a printing problem, not a maths issue, but I fixed a few other things along the way as well).

by (80.3k points)
...