MathGroup Archive 2004

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

Search the Archive

Re: seruous solve bug? only when used with simplifying

On 9 Jun 2004, at 17:16, sean kim wrote:

> hello group,
> i think i have a serious Solve[], Simplify[], FullSimplify[] bug...
> Take a system of equations as below. (apb is actually (a+b). i defined
> it as apb to keep Mathematica crunching away at it)
> sys =
> {c1[t] == (c*(16*a^4 + 8*a^3*kd + 4*a^2*apb*kd + 2*a*apb^2*kd +
> apb^3*kd))/(apb^4*kd),
> c2[t] == (2*(8*a^3 + 4*a^2*apb + 2*a*apb^2 + apb^3)*b*c)/(apb^4*d),
> c3[t] == (2*(8*a^3 + 4*a^2*apb + 2*a*apb^2 + apb^3)*b*c)/(apb^4*kd)}
> sys1 = sys /.{apb -> (a + b)}
> sys2 = sys/.{apb -> (a + b)}//Simplify
> sys3 = sys/.{apb -> (a + b)}//FullSimplify
> and then use
> TrueQ[sys1 == sys1]
> TrueQ[sys1 == sys2]
> TrueQ[sys1 == sys3]
> TrueQ[sys2 == sys3]
> then it gives,
> Out[18]=True
> Out[19]=False
> Out[20]=False
> Out[21]=False
> Simplify and FullSimplify changed the system so much that they are not
> equal?
> Basically, unless I define the (a+b) as a single constant apb, the 
> Mathematica
> will do soemthing with it then it messes it up. I think...
> Why is this happening? and how do i prevent it from happening again
> with other more obsucre systems?  Above I got lucky in finding the
> cause (a+b)
> thanks in advance for any and all comments.
> Sean

There is no bug here at all, just that TrueQ is not for that purpose! 
For example:

TrueQ[(a+b)^2==a^2+2 a b + b^2]


Now think about that, if TrueQ did what you think it does that would be 
some bug! TrueQ is not meant to check if something is true or not, it 
is used to "force" Mathematica to give an answer True or Flase in all 
cases, even when Mathematica does not know what the answer is. If you 
just evaluate

(a + b)^2 == a^2 + 2*a*b + b^2

Mathematica will return the same thing as output

(a + b)^2 == a^2 + 2*b*a + b^2

since does not perform the necessary simplifications to decide if both 
sides are equal.
If you now use TrueQ you will force it to give a True or False answer 
without any additional simplifications and it will of course return 
False. On the other hand



without nay need for TrueQ.
Anyway, to summarise: TrueQ is basically used for programming and not 
for the purpose you have intended. No serious bug or even a very 
unserious one.

Andrzej Kozlowski
Chiba, Japan

  • Prev by Date: Re: Basic conditional statement question.
  • Next by Date: Re: seruous solve bug? only when used with simplifying
  • Previous by thread: Re: seruous solve bug? only when used with simplifying
  • Next by thread: Re: seruous solve bug? only when used with simplifying