3
$\begingroup$

What assumption is needed to make both outputs equal to Sqrt[P^2]/2

In[65]:= tps = (1/2) (1 - T (1 - P^2) + Sqrt[(1 - T(1 - P^2))^2 - P^2]);
         tms = (1/2) (1 - T (1 - P^2) - Sqrt[(1 - T(1 - P^2))^2 - P^2]);
         FullSimplify[Sqrt[tms tps]]
         FullSimplify[Sqrt[tms] Sqrt[tps]]


Out[67]= Sqrt[P^2]/2

Out[68]= 1/2 Sqrt[1 + (-1 + P^2) T - Sqrt[(-1 + P^2) (-1 + T (2 + (-1 + P^2) T))]] 
             Sqrt[1 + (-1 + P^2) T + Sqrt[(-1 + P^2) (-1 + T (2 + (-1 + P^2) T))]]

Comment: There are many similar questions on the web but I couldn't find a proper answer. To assume that T and P are real isn't enough.

Edit: T and P are real numbers and not necessarily equal to zero. So the question should better be, what is the reason that both ways don't yield the same result and how can I change this?

$\endgroup$
  • $\begingroup$ Any bounds at all on either T or P? $\endgroup$ – Michael E2 Sep 3 '14 at 23:11
  • $\begingroup$ Instead of assumptions, you could just force it by using a replacement rule (only recommended if you can verify the validity in the end): Simplify@ReleaseHold[Hold[Sqrt[tms] Sqrt[tps]] //. HoldPattern[Sqrt[x_] Sqrt[y_]] :> Sqrt[x y]] $\endgroup$ – Jens Sep 3 '14 at 23:22
2
$\begingroup$

In Mathematica, Sqrt[x]Sqrt[y]==Sqrt[x y] is not always true, there is a simple example gived by @Rahul Narain

$\sqrt{-1}\times\sqrt{-1}=i\times i=-1$

$\sqrt{(-1)\times(-1)}=\sqrt{1}=1$

So FullSimplify[Sqrt[x] Sqrt[y]] don't give the result as Sqrt[x y]

To get a better answer, to assume range of the variables is helpful, like this

In[59]:= tps = (1/2) (1 - T (1 - P^2) + Sqrt[(1 - T (1 - P^2))^2 - P^2]);
         tms = (1/2) (1 - T (1 - P^2) - Sqrt[(1 - T (1 - P^2))^2 - P^2]);
         FullSimplify[Sqrt[tms tps]]
         FullSimplify[Sqrt[tms] Sqrt[tps], Assumptions -> tps >= 0 && tms >= 0]

Out[61]= Sqrt[P^2]/2

Out[62]= Abs[P]/2
$\endgroup$
  • $\begingroup$ It is not always true that $\sqrt x\sqrt y=\sqrt{xy}$ when $x$ and $y$ are real; for example, take $x=y=-1$. If $x$ and $y$ are positive then it holds. $\endgroup$ – Rahul Sep 4 '14 at 3:46
  • $\begingroup$ Oh I understand, thanks! $\endgroup$ – wuyingddg Sep 4 '14 at 4:07
  • $\begingroup$ @Rahul Narain, thanks a lot. How could I forget this!? $\endgroup$ – PeMa Sep 4 '14 at 8:17

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.