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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg46104] Re: how to test if 2 expressions are the same? Mathematica 5.0
  • From: drbob at bigfoot.com (Bobby R. Treat)
  • Date: Fri, 6 Feb 2004 04:15:27 -0500 (EST)
  • References: <bvt135$oj5$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I'd think all these would work; some do and some don't:

expr = 1 - Sin[x]^2 == Cos[x]^2; 
simplifiers = {Simplify, FullSimplify, TrigExpand, TrigReduce,
TrigToExp};
Through[Compose[simplifiers, expr]]

{True, True, 1 - Sin[x]^2 == Cos[x]^2,
  1 - Sin[x]^2 == Cos[x]^2, True}

The results for Log, on the other hand, don't surprise me. Simplify
and FullSimplify (correctly) do not assume that x is a positive real,
et cetera. PowerExpand does make that kind of assumption.

expr = a*Log[x] == Log[x^a];
simplifiers = {Simplify, FullSimplify, PowerExpand}; 
Through[Compose[simplifiers, expr]]

{a*Log[x] == Log[x^a], a*Log[x] == Log[x^a], True}

Sometimes subtracting may work when Equal doesn't (but not this time):

expr = a*Log[x] - Log[x^a]; 
simplifiers = {Simplify, FullSimplify, PowerExpand}; 
Through[Compose[simplifiers, expr]]

{a*Log[x] - Log[x^a], a*Log[x] - Log[x^a], 0}

Bobby

nma124 at hotmail.com (steve_H) wrote in message news:<bvt135$oj5$1 at smc.vnet.net>...
> hello;
> 
> I am confused.
> 
> 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.
> 
> many thanks,
> STeve


  • Prev by Date: Re: InputAutoReplacements With "-marks
  • 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