2
$\begingroup$

I've been trying to check the identity using wolfram Mathematica and I've found the following

ppo = Plus[Times[Rational[1,6],Power[a,2],Plus[1,Subscript[i,3]],Plus[2,Subscript[i,3]],Plus[6,Times[-3,s],Times[2,Subscript[i,3]]]],Times[Rational[1,2],Plus[1,Subscript[i,3]],Plus[2,Subscript[i,3]],Plus[6,Times[-5,s],Power[s,2],Times[Plus[5,Times[-2,s]],Subscript[i,3]],Power[Subscript[i,3],2]],Power[Superscript[a,0],2]]]

ppn = Plus[Times[Rational[-1,6],Power[a,2],Plus[-6,Times[3,s],Times[-2,Subscript[i,3]]],Plus[2,Times[3,Subscript[i,3]],Power[Subscript[i,3],2]]],Times[Rational[1,2],Plus[2,Times[3,Subscript[i,3]],Power[Subscript[i,3],2]],Plus[6,Times[-5,s],Power[s,2],Times[Plus[5,Times[-2,s]],Subscript[i,3]],Power[Subscript[i,3],2]],Power[Superscript[a,0],2]]]

And when I try to compare these two expressions with

ppo === ppn

It returns False

But this is actually an identity enter image description here

So what's the problem here? Am I getting something wrong?

$\endgroup$

closed as off-topic by m_goldberg, Anton Antonov, march, MarcoB, AccidentalFourierTransform Jan 31 at 0:10

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, Anton Antonov, march, MarcoB, AccidentalFourierTransform
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Simplify[ppn == ppo] gives True. Don't use ===. Your ideas about its semantics are wrong. $\endgroup$ – m_goldberg Jan 30 at 17:27
  • 4
    $\begingroup$ Expand[ppo] === Expand[ppn] works as well, but the point is that ppo and ppn are not structurally equivalent expressions. $\endgroup$ – Jason B. Jan 30 at 17:28
4
$\begingroup$

SameQ (===) is working as expected.

See the evaluation trace result:

FullSimplify[ppo === ppn] // Trace

enter image description here

Now see this result:

FullSimplify[ppo] === FullSimplify[ppn]

(* True *) 

enter image description here

$\endgroup$
3
$\begingroup$

ppo and ppn may be mathematically identical, but they are not the same structurally. Thus, === returns False. Use ==, and coax it to do the work with Simplify.

Simplify[ppo == ppn]
(* True *)
$\endgroup$
  • $\begingroup$ What do you mean by saying "same structurally"? $\endgroup$ – Melik Karapetyan Jan 30 at 18:15
  • 3
    $\begingroup$ Look at x (y + 1) // TreeForm and x y + x // TreeForm. Do you see the difference? === effectively compares FullForm, of the expressions, and TreeForm is just a visualization of that. $\endgroup$ – John Doty Jan 30 at 18:36
  • $\begingroup$ Wow, thank you a lot. $\endgroup$ – Melik Karapetyan Feb 9 at 23:38

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