I have a sum of fractions of the form $x1 - \frac{(x2 + x3)}{(x4 + x5)} - \frac{(x6 + \frac{x7}{x13})}{(x8 - x9 - \frac{x10}{(x11 + x12)})}.$

How might I simplify it to remove fractions from the denominator and then multiply the functions to get a single fraction (like Together would do) without simplifying the expression?

I would like something like this: $\frac{(x1[x4 + x5][x13 (x8 - x9) (x11 + x12) - x10 (x13)] - [x2 + x3][ x13 (x8 - x9) (x11 + x12) - x10 (x13)] - [x6 (x13) + x7][ x4 + x5])}{[x4 + x5][x13 (x8 - x9) (x11 + x12) - x10 (x13)]}$.

I was going to iterate over the terms with List and Denominator a number of times, find the denominators and multiply all the terms, but that quickly became unwieldy and I was unable to compactly multiply them.

Any suggestions or examples would be greatly appreciated!


1 Answer 1

exp = x1 - (x2 + x3)/(x4 + x5) - ((x6 + x7/x13)/(x8 - x9 - x10/(x11 + x12)))
Simplify[Together @ exp] // TeXForm

$\small\frac{(\text{x11}+\text{x12}) (\text{x13} (\text{x4} (\text{x1} (\text{x9}-\text{x8})+\text{x6})+\text{x5} (-\text{x1} \text{x8}+\text{x1} \text{x9}+\text{x6})+(\text{x2}+\text{x3}) (\text{x8}-\text{x9}))+\text{x7} (\text{x4}+\text{x5}))-\text{x10} \text{x13} (-\text{x1} (\text{x4}+\text{x5})+\text{x2}+\text{x3})}{\text{x13} (\text{x4}+\text{x5}) (\text{x10}-(\text{x11}+\text{x12}) (\text{x8}-\text{x9}))}$


Apart[exp] // TeXForm

$\small\frac{\text{x1} \text{x4}+\text{x1} \text{x5}-\text{x2}-\text{x3}}{\text{x4}+\text{x5}}+\frac{(\text{x11}+\text{x12}) (\text{x13} \text{x6}+\text{x7})}{\text{x13} (\text{x10}-\text{x11} \text{x8}+\text{x11} \text{x9}-\text{x12} \text{x8}+\text{x12} \text{x9})}$

FullSimplify[Together @ exp] // TeXForm(* or *)
FullSimplify[Apart @ exp] // TeXForm

$\small\text{x1}+\frac{(\text{x11}+\text{x12}) (\text{x13} \text{x6}+\text{x7})}{\text{x13} (\text{x10}-(\text{x11}+\text{x12}) (\text{x8}-\text{x9}))}-\frac{\text{x2}+\text{x3}}{\text{x4}+\text{x5}}$

  • $\begingroup$ Thank you very much for your speedy reply! Unfortunately, none of these methods do exactly what I hoped for. I would like to see which terms contribute to an expansion, so conserving grouping is important. If some of the terms are the same or differ only by coefficient, e.g. $x2+x3=x1(x4+x5)$ because $x4=x1, x5=x6, x2=x1^2, and x3=x1x6$, then Together and Apart would just combine them. Is there any way you know of to keep them separate? $\endgroup$
    – BJParks
    Commented Oct 9, 2018 at 22:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.