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

generically if I have an expression of the form

$\frac{a+b+c+d+..}{e}$..how can i use the formulas to rewrite in the form

$\frac{a}{e}+\frac{b}{e}+\frac{c}{e}+\frac{d}{e}+..$

in General questions by (650 points)

1 Answer

+3 votes
 
Best answer

If you type

ex:=(a+b+c+d+e)/e;

Cadabra will store this as $(a + b + c + d + e) * e^{-1}$, which you can then get to your form by doing

distribute(_);
by (82.5k points)
selected by

Then when you expand using distribute then last term is e*e^{-1}..right..Its not simplying to 1.? What should i do?

collect_factors or simplify.

Actually if instead of \frac{}{} I use \over to write fractions, for example

ex:={a+b+c}\over b;

and then use collect factors, it does nothing. If I use simplify(ex) it shows

{\color{red}{\begin{verbatim}SyntaxError: unexpected character after line continuation character (, line 1)

At: /usr/lib/python3/dist-packages/sympy/parsing/sympy_parser.py(733): eval_expr /usr/lib/python3/dist-packages/sympy/parsing/sympy_parser.py(820): parse_expr

(2): \end{verbatim}}}

Its not a major problem as we can use \frac{}{}, but it would be nice if this can be corrected at some point of time.

...