Re: Strange behaviour of Solve without VerifySolutions
- To: mathgroup at smc.vnet.net
- Subject: [mg85174] Re: [mg85146] Strange behaviour of Solve without VerifySolutions
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Thu, 31 Jan 2008 00:46:44 -0500 (EST)
- References: <200801301106.GAA11322@smc.vnet.net>
Well, I think the short answer is that Mathematica is not written with
students as the principal audience, and yes, I think this behaviour is
not stupid but has a good reason.
Note that the default value of the option VerifySolutions in Solve is
Options[Solve, VerifySolutions]
{VerifySolutions -> Automatic}
If everything in your equations is exact (and there are no symbolic
parameters) the option is set to True, because verification is always
possible (unlike in the parametric case) and rejecting parasite
solutions always makes sense. However, with equations involving
approximate numbers the situation is far less clear because the
meaning of what constitutes a solution is not clear. Due to numerical
errors you will often end up with solutions that when substituted back
return errors and these errors may be larger than your chosen
criterion for what constitutes a solution. If you decide that all
solutions that do not satisfy exactly the original equations should be
rejected than you will often get no solutions when actually you would
expect some. On the whole I think it is better to return all solutions
and let the user himself investigate if they fall too far outside of
what he considers and "acceptable solution". There have been examples
on this list in the past when setting VerifySolutions->True returned
no solutions when in fact the equations after rationalizing had
solutions. (I can't remember the exact example, but it is not very
hard to manufacture one oneself). I think not returning solutions in
such a case would be worse than returning parasite solutions in a case
like this.
Note also that in this case, besides setting VerifySolutions to True
you can use NSolve instead of Solve. I think NSolve will give you the
correct solutions (it uses a different method from Solve) but even
NSolve can't be guaranteed always to return the desired solutions. The
reason I think, lies in the very nature of solving equations with
machine precision approximate coefficients.
I agree that this is perhaps a bit difficult to explain to students
but the same is true of the basic concepts of numerical analysis which
underlie all numerical computations in Mathematica.
Andrzej Kozlowski
On 30 Jan 2008, at 11:06, Jaccard Florian wrote:
> Dear Mathematica-specialists,
>
> One of my students needed to solve a simple system:
>
> equations =
> {(2 + 1.6*a + 8*b)^2/
> (8*a*(3 + 8*c + 1.6*b)) -
> 1.7 == 0,
> (3 + 8*c + 1.6*b)^2/
> ((8*b + 2 + 1.6*a)*
> (3 + 1.6*c)) - 1.7 == 0,
> (3 + 1.6*c)^2/(3 + 8*c +
> 1.6*b) - 1.7 == 0};
> res = Solve[equations, {a, b, c}]
>
> My student saw that there is a problem because he compared with the
> answers he obtained using another system, which were completely
> different!
>
> Just type :
>
> Chop[equations /. (expr_) == (n_) ->
> expr /. res]
>
> As you easily can see, all solutions are wrong!
>
> Looking in the Solve options, I saw that you can add the option :
> VerifySolutions->True:
>
> res2 = Solve[equations, {a, b, c},
> VerifySolutions -> True]
> And here, you can see that the solutions are all OK:
>
> Chop[equations /. (expr_) == (n_) ->
> expr /. res2]
>
> My question: Why did Wolfram make such a, I believe, stupid thing? Is
> there a good reason?
>
> I'm not sure students (ore engineers and so on) will take the time to
> verify all solutions (usually, Mathematica tells when there may be a
> problem!) ore to Rationalize all the numbers of the equations... and
> I'm
> afraid they won't think about VerifySolutions. And as Mathematica is
> used to make a good job, students usually believe in the
> Mathematica-responses...
>
> I'm also afraid the other system does in this case a better job...
>
> In a future release, I would appreciate more trustworthiness!
>
> Best Regards
>
>
> Florian Jaccard
>
>
>
>
- References:
- Strange behaviour of Solve without VerifySolutions
- From: "Jaccard Florian" <Florian.Jaccard@he-arc.ch>
- Strange behaviour of Solve without VerifySolutions