MathGroup Archive 2004

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

Search the Archive

Re: Re: Reduce/Solve

On 17 Aug 2004, at 11:01, Andy Kowar wrote:

> andrzej <andrzej at> wrote in message 
> news:<cfomtv$l1a$1 at>...
> ...deleted...
>> Not quite. You are forgetting limitations that are due to mathematics,
>> or algorithms that we know, which is what happens in this case.
> You seem to possess knowledge about the algorithm used by Wolfram for
> Solve. Would you disclose what exactly it does, if that is not a trade
> secret? Until that happens, I am leaning to claim a bug based on the
> following.

I do not claim any knowledge of the algorithms used by Mathematica. I 
am however a professional mathematician, (a university professor of 
mathematics, in fact), so I do claim to know something about my 

Of course your particular problem is easy to do by hand and Mathematica 
could deal with it had it been programed to consider versions of such 
simple special problems separately from the general algorithms it uses. 
But it is not and most likely will never be.

The equations you have given Solv eare non-polynomial equations. Solve 
can *only* solve polynomial equations and equations that can be 
converted to polynomial equations,  by using inverse functions and 
operations such as exponentiation. In general when you use 
exponentiation "phantom" solutions appear. For example consider the 

(x + 1)^(1/2) == 1 - x

By squaring both sides you get

x+1 == (1-x)^2

which has two solutions x==0 and x ==3. However, the second is a 
phantom solution.

You can see this with Mathematica:

Solve[(x + 1)^(1/2) == 1 - x, x]

{{x -> 0}}

Solve[(x + 1)^(1/2) == 1 - x, x, VerifySolutions -> False]

{{x -> 0}, {x -> 3}}

Mathematica was able to remove the phantom solution because by default 
VersifySolutions is set to True.

Now replace the equation by:

l = Solve[eq = (x + a)^(1/2) == 1 - x, x]

{{x -> (1/2)*(3 - Sqrt[4*a + 5])}, {x -> (1/2)*(Sqrt[4*a + 5] + 3)}}

Are these correct solutions? Well, let's see if Mathematica can check 
them. To make it easier let's assume that a>0 in the starting example:

FullSimplify[eq /. l, a > 0]

{Sqrt[4*a + 5] == Sqrt[4*a - 2*Sqrt[4*a + 5] + 6] + 1,
   Sqrt[4*a + 5] + Sqrt[2]*Sqrt[2*a + Sqrt[4*a + 5] + 3] + 1 == 0}

  Mathematica returned two solutions, the second of which is obviously a 
phantom at least for positive values of a, but there is no bug of any 
kind involved (Also, as you can see, I , a human being can do something 
easily that Mathematica can't.)  Mathematica made no attempt to verify 
the correctness of the solutions Solve returned because in almost all 
cases (except the simplest ones) it can't do this sort of thing.

Now, in your particular examples Mathematica obviously could if 
somebody programmed it to do try to isolate the simple cases it can do 
from the vast majority of cases that it can't. But one can argue, and I 
agree with this argument, that there is no point of implementing in 
Mathematica the ability to solve a few trivial cases that can be done 
by hand if one at the same time this does not give it the ability to 
solve at least a fair number of cases that can't be done by hand. 
Serious computer algebra programs like Mathematica are meant for 
dealing with the sort of computations that skillful people have can't 
do by hand, not for solving homework problems (I am sure there are 
other programs that do that) and not for giving satisfying feeling that 
the computer produced the same (trivial) answer that they managed to 
obtain by hand.

Finally the fact that a human being can solve a certain type of problem 
easily and Mathematica can't is no argument that there is anything 
wrong with Mathematica. I can certainly produce immediately a long list 
of problems that I can solve in a few lines and that Mathematica's 
can't and none of them involves any bug in Mathematica. Computer 
algebra programs work using general algorithms that wokr by trying to 
reduce expressions to certain standard cases, while  human being work 
using particular tricks and almost never use general algorithms. These 
abilities are complementary and are likely to remain so for many years 
to come.

I have written this sort of thing more times than I can remember and it 
is becoming tedious, so I think I shall stop this thread at this point. 
I have no particular interest in trying to persuade to use Mathematica, 
if you can find a program that solves this sort of problems more to 
your satisfaction I certainly think you should use it. The alternative 
would be to learn a little more maths.

Andrzej Kozlowski

> In[1]:=Solve[{-Sin[t],Cos[t]}=={Sin[a],Cos[a]},{t}]
> \!\(\*
> RowBox[{\(Solve::"ifun"\), \(\(:\)\(\ \)\), "\<\"Inverse functions are
> being used by \\!\\(
> Solve\\), so some solutions may not be found; use Reduce for complete
> \
> solution information. \\!\\(\\*ButtonBox[\\\"More…\\\", \
> ButtonStyle->\\\"RefGuideLinkText\\\", ButtonFrame->None, \
> ButtonData:>\\\"Solve::ifun\\\"]\\)\"\>"}]\)
> Out[1]=
> {{t->a}}
> Following the advice from the above warning, I tried Reduce.
> In[2]:=Reduce[{{-Sin[t], Cos[t]} == {Sin[a], Cos[a]}, 0 < t < 2 Pi, 0
> < a < 2 Pi}, {t}]
> Out[2]=
> \!\(1\/2 + a\/\(2\ &#65533;逅姉\) &#8713; Integers && \((&#65533;逅姉 < a
> &#8804; 2\ &#65533;逅姉 && t == \(-2\)\
> ArcTan[Tan[a\/2]] || 0 < a < &#65533;逅姉 && t == 2\ \((&#65533;逅姉 -
> ArcTan[Tan[a\/2]])\))\) || a == &#65533;逅姉 && t == &#65533;逅姉\)
> The result doesn't seem to be much useful, I would rather expect
> simple {t->2*Pi-a}.
> The behavior of Mathematica is somehow disappointing because the
> solution of the original problem:
> r[t_]:={a*Cos[t],b*Sin[t]}
> dr[t_]:=Evaluate[D[r[t],t]]
> q={k,l};
> eq=dr[t]==lambda q
> sol=Simplify[Solve[eq,{t,lambda}],{k\[Element]Reals,l\[Element]Reals}]
> can be obtained trivially by hand
> {{t -> ArcTan[k/a, l/b], lambda ->  1/Sqrt[(k/a)2 + (l/b)2]},
>  {t -> ArcTan[k/a, l/b], lambda -> -1/Sqrt[(k/a)2 + (l/b)2]}}
>> What I meant in my reply was this: the only algorithms that exist for
>> solving this kind of equations  in general lead to phantom solutions 
>> as
>> well as "correct solutions. This is a feature of "mathematics" not
>> Mathematica.
> That seems to be a very strong claim, unless I misunderstood
> the meaning of "mathematics".
> ...deleted...
>> Andrzej
>> P.S. Of course this and anything I write may not be true in partiular
>> cases where bugs are involved, when my memory fails or when some new
>> discovieries have been made of which I am not aware. Fortunately, such
>> cases can be settled by "divine intervention", that is, a response 
>> form
>> Daniel Lichtblau ;-)
> divine == relating to, or proceeding directly from God
> You referred to bugs as acts of God. Now you apparently claim Mr.
> Daniel Lichtblau is God. Are you saying that he is responsible for
> bugs in Solve? :-)
> AK
> ...deleted...

  • Prev by Date: Re: can this be solved in Mathematica 5.0?
  • Next by Date: Re: Re: Simplify stuck in simple expression
  • Previous by thread: Re: Reduce/Solve
  • Next by thread: Re: Reduce/Solve