2
$\begingroup$

I am new to Mathematica. So I am sorry if the question seems elementary.

I wanted to simplify an expression but it seems that some radicals ($\sqrt{u}$ and $\sqrt{u-1}$) in numerator or denominator do not cancel. What should I do?

f = Sqrt[u (-1 + u^2) - (-1 + u^2)^2] ((u (-1 + 2 u))/(
2 Sqrt[-u + u^2]) + Sqrt[-u + u^2])

FullSimplify[f]

and the result is

enter image description here

My final goal is to get

$$f = {1 \over 2}\sqrt { - u\left( {u + 1} \right)\left( {{u^2} - u - 1} \right)} \left( {4u - 3} \right)$$

$\endgroup$
7
  • $\begingroup$ Is u positive? If so, is it greater than 1? This matters in the cancellations. $\endgroup$
    – bbgodfrey
    Jan 18, 2016 at 11:17
  • $\begingroup$ Please help us to help you. Here is consider helpful to include the code in formatted form so we can copy and paste your code. $\endgroup$
    – rhermans
    Jan 18, 2016 at 11:17
  • 1
    $\begingroup$ People here generally like users to post code as Mathematica code instead of images or TeX, so they can copy-paste it, as @rhermans said. It makes it convenient for them and more likely you will get someone to help you. You may find this this meta Q&A helpful $\endgroup$
    – Michael E2
    Jan 18, 2016 at 11:22
  • 1
    $\begingroup$ @MichaelE2: OK. Thanks for the guide. I will do so. $\endgroup$ Jan 18, 2016 at 11:24
  • 1
    $\begingroup$ Have you read the documentation about FullSimplify, esp. the parts that explain this summary, "FullSimplify[expr,assum] does simplification using assumptions."? $\endgroup$
    – Michael E2
    Jan 18, 2016 at 11:24

1 Answer 1

5
$\begingroup$

Is this what you are seeking?

FullSimplify[f, u > 1]
(* 1/2 u (-3 + 4 u) Sqrt[2 + 1/u - u^2] *)

Response to edit in question

The LeafCount of this result is

LeafCount[%]
(* 24 *)

On the other hand, the LeafCount of the outcome desired by the OP is

g = 1/2  (-3 + 4 u) Sqrt[-u (u + 1) (u^2 - u - 1)]
LeafCount[%]
(* 27 *)

Note also that

FullSimplify[g, u > 1]
(* 1/2 (-3 + 4 u) Sqrt[u + 2 u^2 - u^4] *)
LeafCount[%]
(* 25 *)

which may be a more desirable result, if 1/u is not wanted in my first answer. I should add that most any transformation of f can be obtained with FullSimplify, but often not easily.

$\endgroup$
5
  • $\begingroup$ Can you kindly see the updated question. I think it is not really fully simplified yet! $\sqrt{u}$ is not cancelled! $\endgroup$ Jan 18, 2016 at 11:31
  • $\begingroup$ @@bbgodfrey, What is FullSimplify doing with these assumptions? The answer it comes out with does not depend on the assumptions, and seems to be true for any complex value of u: f2 = FullSimplify[f, u > 1]; Equal @@ {f, f2} /. u -> RandomComplex[{-10 - 10 I, 10 + 10 I}] $\endgroup$
    – Jason B.
    Jan 18, 2016 at 11:40
  • 1
    $\begingroup$ @H.R. The issue is that your desired "simplified" result is less simple than mine as assessed by LeafCount. $\endgroup$
    – bbgodfrey
    Jan 18, 2016 at 11:49
  • $\begingroup$ It's interesting that your form can be found by making the unnecessary assumption that u>1 (does that imply that Element[u,Reals]?), the OP's desired form is only true when u>1. $\endgroup$
    – Jason B.
    Jan 18, 2016 at 11:55
  • $\begingroup$ @JasonB The two expressions seem to be equal in many but not all cases. Consider Equal @@ {f, f2} /. u -> .5 + .3 I, which is True. However, Equal @@ {f, f2} /. u -> .5 - .3 I is False. Interesting question, nonetheless. $\endgroup$
    – bbgodfrey
    Jan 18, 2016 at 12:06

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.