MathGroup Archive 2000

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

Search the Archive

A strange bug in Solve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg24354] A strange bug in Solve
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Sun, 9 Jul 2000 04:52:57 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

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:

In[1]:=
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):

In[2]:=
Solve[eqns, {u, t}]
Out[2]=
{}

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

In[3]:=
sols = Reduce[eqns, {u, t}]
Reduce::ifun: Inverse functions are being used by Reduce, so some solutions
may not be found.
Out[3]=
                             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
 
                    3
              -Sqrt[-]
                    2                          3
  t == ArcCos[--------] && u == 2 ArcCos[-Sqrt[-]] ||
                 2                             5
 
                   3
              Sqrt[-]
                   2                         3
  t == ArcCos[-------] && u == 2 ArcCos[Sqrt[-]]
                 2                           5


We can check them as follows:

solrules = sols /. {Or -> List, And -> List, Equal -> Rule};
In[5]:=
FullSimplify[Unevaluated[eqns /. solrules]]
Out[5]=
{{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:
<http://www.sstreams.com/Mathematica/>




  • 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