Re: Possible bug in FindRoot[] in Mathematica 3.0
- To: mathgroup@smc.vnet.net
- Subject: [mg11182] Re: [mg11131] Possible bug in FindRoot[] in Mathematica 3.0
- From: Daniel Lichtblau <danl@wolfram.com>
- Date: Wed, 25 Feb 1998 03:31:52 -0500
- References: <199802240240.VAA21762@smc.vnet.net.>
Adrian Cable wrote:
>
> Hi there,
> I think I've possibly found a bug in Mathematica 3.0. Consider the
> equation:
>
> 2^x + 3^x = 5^x
>
> Well, it's obvious that x = 1 is a solution, and you can check with
> Plot[] that x = 1 is indeed the only solution. When I try to Solve[]
> this with Mathematica, it says:
>
> Solve::"tdep":
> "The equations appear to involve transcendental functions of the \
> variables in an essentially non-algebraic way."
>
> This is fair enough - I have no idea how to solve this type of equation
> without some numerical method either. The problem comes when I try to
> use FindRoot:
>
> In[83]:= FindRoot[2^x+3^x==5^x,{x,0}] Out[83]:= {x -> -21.1781}
>
> -21? I'm sorry? Obviously, the iterative formula it has created
> (presumably by the Newton-Raphson process) for the equation diverges
> when the starting point is taken as x = 0. However, if I do something
> like this, it handles it correctly:
>
> In[86]:= FindRoot[2^x+3^x==5^x,{x,-1}] FindRoot::"cvnwt":
> "Newton's method failed to converge to the prescribed accuracy after
> \
> 15 iterations."
> Out[86]:= {x -> -21.0059}
>
> So, why does Mathematica correctly recognise that the iterative sequence
> does not converge in the second case, yet it doesn't recognise this in
> the first case and thus returns a totally bogus result without any
> error message?
>
> This looks like a bug to me. Or am I just missing something here?
>
> Thanks, cheers,
> Adrian Cable.
It is converging. To a value outside the complex plane, unfortunately.
Numeric routines can be like that.
In[9]:= ee = 2^x + 3^x - 5^x;
In[10]:= Limit[ee, x->-Infinity]
Out[10]= 0
In[11]:= FindRoot[ee, {x,0}]
Out[11]= {x -> -21.1781}
In[12]:= ee /. %
-7
Out[12]= 4.21538 10
To get values for x that leave smaller residuals, you might do
In[14]:= FindRoot[ee, {x,0}, AccuracyGoal->32, MaxIterations->500]
Out[14]= {x -> -107.739}
In[15]:= ee /. %
-33
Out[15]= 3.69142 10
Just a guess, but possibly when your starting point is -1 and it gives
{x -> -21.0059} the residual is just large enough that it fails to
satisfy the Automatic AccuracyGoal.
In[24]:= FindRoot[ee, {x,-1}, AccuracyGoal->5] Out[24]= {x -> -16.6796}
In[25]:= ee /. %
-6
Out[25]= 9.53764 10
By the way, the expression ee is entire, that is, analytic throughout
the complex plane. Hence the equation ee == constant will have
infinitely many solutions for all but at most one value of constant. It
is straightforward to show that x->1 is the only real root, hence the
other solutions are complex-valued. Here is one I found by
trial-and-error.
In[32]:= FindRoot[ee, {x,4+40I}]
Out[32]= {x -> -0.638232 + 40.1885 I}
In[33]:= ee /. %
-10 -10 Out[33]= 2.47291 10 - 1.65612
10 I
Daniel Lichtblau
Wolfram Research
- References:
- Possible bug in FindRoot[] in Mathematica 3.0
- From: Adrian Cable <megalith@jimc.demon.co.uk>
- Possible bug in FindRoot[] in Mathematica 3.0