MathGroup Archive 2000

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

Search the Archive

A strange bug in Solve

I have long ago learned to be careful when making claims about kernel bugs
in Mathematica, but this time I am pretty sure I have found a fairly serious
one, even though it looks rather strange.

I asked Mathematica to solve a system of two trigonometric equations:

eqns = {2*Cos[2*t]*Cos[u/2] + Cos[t]*Sin[u/2] == 0,
    (Cos[u/2]*Sin[t])/2 - (Sin[2*t]*Sin[u/2])/2 == 0};

To my surprise Solve returned the empty list (I knew these equations do have
solutions for geometric reasons):

Solve[eqns, {u, t}]

I then tried Reduce, and guess what, it gave the right answers:

sols = Reduce[eqns, {u, t}]
Reduce::ifun: Inverse functions are being used by Reduce, so some solutions
may not be found.
                             1                                     1
t == 0 && u == 2 ArcCos[-(-------)] || t == 0 && u == -2 ArcCos[-------] ||
                          Sqrt[5]                               Sqrt[5]
       -Pi                     Pi
  t == --- && u == -Pi || t == -- && u == Pi ||
        2                      2
                    2                          3
  t == ArcCos[--------] && u == 2 ArcCos[-Sqrt[-]] ||
                 2                             5
                   2                         3
  t == ArcCos[-------] && u == 2 ArcCos[Sqrt[-]]
                 2                           5

We can check them as follows:

solrules = sols /. {Or -> List, And -> List, Equal -> Rule};
FullSimplify[Unevaluated[eqns /. solrules]]
{{True, True}, {True, True}, {True, True}, {True, True}, {True, True},
{True, True}}

Here one might ask: why did I need to define solrules? Why not use the
options MakeRules->True in Reduce? The answer is: try and see what happens!

This is  peculiar and rather unpleasant. When Solve returns an
ampty list it ought to mean that there are no generic solutions (although
solutions might exist for some particular values of the parameters). Reduce
is supposed to try to work out these special cases. However, the solutions
found by Reduce in this case are perfectly generic. Moreover, the
spectacular failure of Reduce[eqns, MakeRules->True] suggest than somehting
else than the difficulty of finding the solutions that is causing the
problem here.

Andrzej Kozlowski

Andrzej Kozlowski
Toyama International University, JAPAN

For Mathematica related links and resources try:

  • Prev by Date: Re: Mathematica gives bad integral ??
  • Next by Date: Re: Divisors
  • Previous by thread: Keeping Invisible Commas invisible
  • Next by thread: Re: A strange bug in Solve