MathGroup Archive 1999

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

Search the Archive

Re: Bug in Solve?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg17458] Re: [mg17395] Bug in Solve?
  • From: "Andrzej Kozlowski" <andrzej at tuins.ac.jp>
  • Date: Sun, 9 May 1999 04:43:58 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

I do not know whether to call this a bug, but if it is one  it is quite 
understandable why it occurs. The problem is that Mathematica, just like my
students, does not check its solutions. This is how a careless student (and
also Mathematica) would arrive at this wrong answer:

First, you re-write your equation as

Sqrt[1+a^2]*Sqrt[1+b^2]==-(1+a*b)

You now square both sides to get

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

Now, Solve quite correctly will give:

In[78]:=
Solve[(1+a^2)*(1+b^2)==(1+a*b)^2,a]
Out[78]=
{{a -> b}, {a -> b}}

This is fine, the only problem is that these are not solutions of the
original equation, which has no solutions. The only way to check this is to
substitute these solutions back into the original equation to check if it
works. But Mathematica does not do this in this case.

Actually, it does do chcking in some cases. Solve  takes the option
VerifySolutions which is by default set to Automatic (same as True), but it
only works in case of numerical solutions, not solutions containing symbols.
Compare what hapens if we use a value for b, for example b=1.

Solve[{1 + x*1 + Sqrt[1 + 1^2]*Sqrt[1 + x^2] == 0}, x, VerifySolutions ->
False]
Out[2]=
{{x -> 1}}

Same as before and just as wrong. But

In[3]:=
Solve[{1 + x*1 + Sqrt[1 + 1^2]*Sqrt[1 + x^2] == 0}, x]
Out[3]=
{}

This time Mathematica checked its solution and noticed that it is wrong. In
general there is a good reason why Mathematica does not try to verify
solutiuons containing symbols. It will probably be unable to do so in most
casess. The transformations needed to do this are usually very complicated.
Its usually easier to do the insection by hand or substitute a few numbers.

--
Andrzej Kozlowski
Toyama International University
JAPAN
http://sigma.tuins.ac.jp
http://eri2.tuins.ac.jp


----------
>From: iaz at cs.umd.edu (Ilya Zavorine)
To: mathgroup at smc.vnet.net
>To: mathgroup at smc.vnet.net
>Subject: [mg17458] [mg17395] Bug in Solve?
>Date: Thu, May 6, 1999, 3:44 PM
>

> I executed the following statement:
>
> Solve[1+a*b+Sqrt[1+a^2]*Sqrt[1+b^2]== 0,a]
>
> and got as the answer
>
> {{a->b}}
>
> which is obviously wrong. Is this a Mathematica bug or
> am I doing something wrong?
>
> Thanks,
>
> Ilya


  • Prev by Date: About domains of functions
  • Next by Date: RE: compile NIntegrate
  • Previous by thread: Bug in Solve?
  • Next by thread: Re: Re: Bug in Solve?