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


I want to get an expand an expression of the form and finally get the rhs of the below expression

\begin{align} \Big(\frac{A1{a}}{r}+\frac{A2{a}}{r^{2}}\Big)\Big(\frac{B1{a}}{r}+\frac{B2{a}}{r^{2}}\Big)=\frac{A1{a}B1{a}}{r^{2}}+\frac{A1{a}B2{a}+A2{a}B1{a}}{r^{3}}+\frac{A2{a}B2{a}}{r^{4}} \end{align}

For this i used the following code




But finally i am getting the expression \begin{align} A1{a}B1{a}r^{-1}r^{-1}+A1{a}B2{a}r^{-2}r^{-1}+A2{a}B1{a}r^{-2}r^{-1}+A2{a}B2{a}r^{-2}r^{-2} \end{align}

It is not simplifying after this to get the rhs of the expression i wanted in the beginning. I have just shown a simple expression for the convenience of expressing my doubt. The actual expression is pretty large.

It would be helpful if the mistake I am doing can be pointed out and how to simpify the mathematical expressions.

in General questions by (630 points)

1 Answer

+1 vote


I was able to resolve this issue. After the last command, I added collect_factors() which did the job.

by (630 points)