1
$\begingroup$

I was trying to use Mathematica for some simple algebra deduction, but it didnt work. code:

TrueQ@(Sqrt[(e0 u0)/(e1 u1)] == Sqrt[e0 u0]/Sqrt[e1 u1])

Any ideas how to make Mathematica know these equations are the same?

$\endgroup$
  • $\begingroup$ TrueQ is not usually used this way. Suppose you have a condition (e.g., A == B as in your case). There are three possibilities: it computes to True, it computes to False, and its value cannot be computed. The function If[] for instance does different things in each case. TrueQ is used to force the last case to be False. It is used for programming and not for mathematics. If you have a procedure that should not be executed unless it is known that the condition is true, then TrueQ is convenient to combine the False and the undecided cases together. $\endgroup$ – Michael E2 Nov 2 '19 at 16:50
1
$\begingroup$

You need to assume e1,u1 are positive

Assuming[e1 > 0 && u1 > 0, Simplify[Sqrt[(e0 u0)/(e1 u1)] - Sqrt[e0 u0]/Sqrt[e1 u1]]]

Mathematica graphics

Let look and see why. Consider the simple example

Clear[x]
expr = Sqrt[1/x] - 1/Sqrt[x];
Simplify[expr]

Mathematica graphics

If x is negative, then Sqrt[1/x] is Sqrt[-1/Abs[x]] which is I*Sqrt[1/Abs[x]] which is not the same as 1/Sqrt[x]. But if x>0 then Sqrt[1/x]=1/Sqrt[x]

Assuming[x > 0, Simplify[expr]]
(* 0 *)

And that is what happened in your expression.

| improve this answer | |
$\endgroup$
  • $\begingroup$ But if I try Assuming[e1 > 0 && u1 > 0, TrueQ[Sqrt[(e0 u0)/(e1 u1)] == Sqrt[e0 u0]/Sqrt[e1 u1]]] it still gives False $\endgroup$ – baker Oct 3 '19 at 2:44
  • $\begingroup$ Yep, changed to Simplify and it worked. Thanks $\endgroup$ – baker Oct 3 '19 at 2:53
  • 2
    $\begingroup$ Also, I think TrueQ is really meant for structural sameness. Not Math-wise sameness. i.e. when both sides are exactly the same structurally. Any way, I normally just use Simplify when Assuming. $\endgroup$ – Nasser Oct 3 '19 at 2:54
  • 1
    $\begingroup$ For example, TrueQ[Exp[I x] == Cos[x] + I*Sin[x]] gives False but Simplify[Exp[I x] == Cos[x] + I*Sin[x]] gives True $\endgroup$ – Nasser Oct 3 '19 at 3:10
  • 1
    $\begingroup$ This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review $\endgroup$ – m_goldberg Oct 3 '19 at 3:52

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.