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

If i type the following in Cadabra2, ex:=\frac{19}{2 x};

it gives 191/2x. In fact for any integer numerator it appends a 1 to it. What's going on?

in Bug reports by

2 Answers

+1 vote

Also, if I type ex:=\frac{19}{2 x} a; it gives 19 (1/2x) a. But, then it does not do the cancellations for example in S:=-\frac{2}{2 s} a, it doesn't cancel the 2 whatever I do. How can I do cancellations? Provisionally I think I will not use \frac{}{}. But, it would help if it gets corrected, or at least pops up an error message.

Please help. I was able to do really difficult computation with Cadabra2 and it was giving correct results many times and I was really grateful for it, when in a subsequent computation way way simpler, I used this \frac thing and got wrong results. Thanks.

by (560 points)
+1 vote

I'll get back to this in more detail a bit later, but as a general workaround: only write purely numerical fractions using \frac, and for inverse powers of variables use e.g. x**{-1}. You can then collect those powers using collect_factors (and the numerical factors will collect automatically).

by (66.3k points)

In the updated version cadabra2-2.1.6 \frac is now working well. Thanks for the solution.

Also, is there are way to cancel the common factors in numerator and denominator, for eg.

ex:=\frac{2}{2x};

produces 2/{2x} and no matter what I do, I am not able to cancel 2. How to get around this problem?

Also, when I type ex:=\frac{2 x}{2}; I get x, so it works in the numerator. But, when it doesn't when x is in denominator.

...