MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: how to test if 2 expressions are the same? Mathematica 5.0


Use Equal (==); however, you will also frequently have to use Simplify or
FullSimplify.

1-Sin[x]^2 == Cos[x]^2

1 - Sin[x]^2 == Cos[x]^2

%//Simplify

True

You may also have to state Assumptions that would make the equality True

a*Log[x] == Log[x^a] // Simplify

a*Log[x] == Log[x^a]

Simplify[%, {Element[{a,x}, Reals], x>0}]

True

Sometimes there are shortcuts using PowerExpand; however, you need to be sure
that the implied assumptions hold.

a*Log[x] == Log[x^a] // PowerExpand

True


Bob Hanlon

In article <bvt135$oj5$1 at smc.vnet.net>, nma124 at hotmail.com (steve_H) wrote:

<< many times, I want to find if there is a way to obtain one expression
from another by tranformation.

for example, we know that 1-sin^2(x) = cos^2(x), and  a*log(x)=log(x^a),
etc.., but sometimes this does not seem to work using SameQ:

SameQ[a Log[x], Log[x^a] ]
False

I tried MatchQ and that also gives False.

what is the right way to do these things in Mathematica? I checked the on-line
help,
and can't seem to see the right command for this.


  • Prev by Date: Re: Export problem with Mathematica 4.1/Mac OS 9
  • Next by Date: Re: InputAutoReplacements With "-marks
  • Previous by thread: Re: how to test if 2 expressions are the same? Mathematica 5.0
  • Next by thread: Re: how to test if 2 expressions are the same? Mathematica 5.0