1
$\begingroup$

One of the things that frustrates me most about Mathematica's symbolic manipulations is the fact that output is often presented quite differently than most humans would write it. This is especially egregious when square roots are involved. For example, Mathematica will output this

standard format for radicals

when I think most humans (or at least physicists) would consider this to be "simpler":

desirable format for radicals

or, alternatively,

other desirable format

My question is: Is there any simplification function, option, or other trick for coercing Mathematica into formatting an output thusly? I have so far not had any success finding one, and I've explored various simplification formulas as well as trying to apply assumptions about the variables (real, positive, etc.) -- though maybe I just haven't stumbled on the right one.

$\endgroup$
3
  • $\begingroup$ Providing copyable code will increase the likelihood and speed of answers. $\endgroup$
    – Mr.Wizard
    Apr 15, 2015 at 17:24
  • 1
    $\begingroup$ I get nervous whenever factions start to collect under one radical. $\endgroup$ Apr 15, 2015 at 20:04
  • $\begingroup$ @Mr.Wizard: Noted. Thanks. $\endgroup$
    – ibeatty
    Apr 16, 2015 at 2:24

1 Answer 1

3
$\begingroup$

Your transformation is not generally true; if you provide FullSimplify with your assumptions you get a better result:

expr = (Sqrt[2] Sqrt[Ea - g L m])/Sqrt[m];

FullSimplify[expr, m > 0]
Sqrt[-2 g L + (2 Ea)/m]
$\endgroup$
3
  • $\begingroup$ Nice… Though I'd still like to factor out the 2, but leave it under the radical? More broadly, is there a general strategy for making Mathematica expressions more like what we normally write? $\endgroup$
    – ibeatty
    Apr 15, 2015 at 18:26
  • $\begingroup$ @ibeatty You could Factor the expression under the radical but then Mathematica would automatically convert it to Sqrt[2] Sqrt[-((-Ea + g L m)/m)]. I am not aware of any general and successful strategy to make Mathematica format expressions in "human" form, though there are tools and formats that are at least useful, e.g. TraditionalForm, HornerForm, etc. This has been asked before; I'll try to find a reference. $\endgroup$
    – Mr.Wizard
    Apr 15, 2015 at 18:34
  • $\begingroup$ Why is Mathematica not returning FullSimplify[Sqrt[a]/Sqrt[5], a > 0] as Sqrt[a/5]? $\endgroup$
    – divenex
    Mar 28 at 18:15

Your Answer

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

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