MathGroup Archive 1992

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

Search the Archive

why does this crash the kernel

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: why does this crash the kernel
  • From: fateman at mammoth.berkeley.edu (Richard Fateman)
  • Date: Fri, 31 Jul 92 09:28:18 -0700

[Note that this problem is fixed in Mathematica version 2.1 - smc]


It is apparently a bug in NSolve, in Howard Fink's example.
Consider this problem (derived from his input) computed on MIPS in
Mathematica 2.0.  Perhaps it is an inadequate handling of overflow in
the root-finding program.
                                         2            3            4
Out[15]= -10272.2 + 103.437 x + 72899.6 x  - 763.675 x  + 2.88889 x  - 
 
                 5             -6  6
>    0.00465585 x  + 2.70961 10   x

In[16]:= NSolve[%15==0,x]

/usr/src/local/algebra/bin/math: 11699 Bus error - core dumped

Process math exited abnormally with code 138
....

However, if you just type this problem in, you get

NSolve[  -10272.2 + 103.437*x + 72899.6*x^2 - 763.675*x^3 + 2.88889*x^4 - 
   0.00465585*x^5 + 2.70961*10^-6*x^6==0,x]
Out[10]= {{x -> -0.375349}, {x -> 0.375406}, {x -> 285.799}, {x -> 286.962}, 
 
>    {x -> 571.009}, {x -> 574.503}}


But then, in Mathematica, numbers are not what they seem.  Consider this
In[11]:= 72899.6

Out[11]= 72899.6

In[12]:= InputForm[%]

Out[12]//InputForm= 72899.60000000001


Here's an equivalent polynomial for Howard Fink's problem, and an
attempt to get NSolve to work by increasing accuracy.  (This may not
be the recommended way to increase precision, but it should not,
in any case, respond this way..
Mathematica 2.0 for MIPS
Copyright 1988-91 Wolfram Research, Inc.
 -- X11 windows graphics initialized -- 

In[1]:=  -(1.895513906249999*10^9) + 1.908711012126377*10^7*x + 
   1.345203049375*10^10*x^2 - 1.409194659861589*10^8*x^3 + 
   533081.1875000001*x^4 - 859.134739141655*x^5 + 0.5*x^6

                   9             7              10  2             8  3
Out[1]= -1.89551 10  + 1.90871 10  x + 1.3452 10   x  - 1.40919 10  x  + 
 
              4            5        6
>    533081. x  - 859.135 x  + 0.5 x

In[2]:= N[%,40]

                             9                       7
Out[2]= -1.895513906249999 10  + 1.908711012126377 10  x + 
 
                      10  2                       8  3
>    1.345203049375 10   x  - 1.409194659861589 10  x  + 
 
                        4                     5        6
>    533081.1875000001 x  - 859.134739141655 x  + 0.5 x

In[3]:= SetAccuracy[%,40]

                                           9
Out[3]= -1.89551390624999904632568359375 10  + 
 
                                          7                      10  2.
>    1.90871101212637722492218017578125 10  x + 1.345203049375 10   x   - 
 
                                          8  3.
>    1.40919465986158907413482666015625 10  x   + 
 
                                               4.
>    533081.187500000116415321826934814453125 x   - 
 
                                                   5.        6.
>    859.1347391416550181020284071564674377441406 x   + 0.5 x

In[4]:= NSolve[%==0,x]

Solve::ifun: Warning: Inverse functions are being used by Solve, so some
     solutions may not be found.

Out[4]= {}

In[5]:= NSolve[%2==0,x]

Process math exited abnormally with code 138
....................


PS, picking this problem apart was what showed the inconsistency
with the Part command reported earlier..

        3 (-1 + x)
Out[4]= ----------
          -2 + x

In[5]:= Part[%4,3]

Out[5]= -1 + x   (* uh, sure. *)



RJF





  • Prev by Date: Re:Derivative
  • Next by Date: Re: Derivative
  • Previous by thread: Re: Derivative