I want to simplify expression $\frac{\sqrt{1+b+b^2}}{b}$ to$\sqrt{1+\frac{1}{b^2}+\frac{1}{b}}$.

How to achieve this?

  • 1
    $\begingroup$ How is your target expression computationally simpler than your source expression? It may look prettier to you eyes, but it not simpler by Mathematica's concept of expression simplicity. If you are looking for a way to pretty print your expression in discourse, then you are really asking about working with HoldForm expressions and not about simplification. $\endgroup$ – m_goldberg Oct 7 '15 at 4:46
  • $\begingroup$ Simply speaking, if you are performing calculations keep in mind that your simpfied version is more expensive. It as one additional division than the starting expression. $\endgroup$ – Edmund Oct 7 '15 at 11:03

Try this:

 expr = Sqrt[1 + b + b^2]/b;
(expr /. 1/b*Sqrt[a_] -> Sqrt[a/b^2]) // Simplify

(*   Sqrt[1 + 1/b^2 + 1/b]   *)

Have fun!

| improve this answer | |

You can bruteforce it for this kind of fraction where the numerator has a square root.

 exp = Sqrt[1 + b^2 + b]/b

Write a function that takes the denominator squared inside the square root

f[frac_] := Module[{num, den},
  num = Numerator[frac][[1]];
  den = Denominator[frac];

Pass your expression to the function to check


(*Sqrt[1 + 1/b^2 + 1/b]*)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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