Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

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

Search the Archive

Re: Using FindRoot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83466] Re: Using FindRoot
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Wed, 21 Nov 2007 02:49:15 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <fhu7qo$7dv$1@smc.vnet.net>

tdude wrote:

> I am trying to find the root of the following equation
> FindRoot[.15*[Pi]*(R^2)==(2*R^2*ArcCos[45.9/(2*R)])-(.5*45.9*Sqrt[4*R^2-45.9^2]),{R,.1}, MaxIterations->100000]
> 
> When I try this with two other systems, both give me an answer of 30.8773686.
> 
> However, with Mathematica, the answer I get appears to be a complex root, along with this message:
> FindRoot::lstol: The line search decreased the step size to within tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the merit function.  You may need more than MachinePrecision digits of working precision to meet these tolerances.
> {R -> 20.1137- 4.87774*10^-14 \[ImaginaryI]}
> 
> Why would the answer be a complex root when using Mathematica, yet real when using the other two packages?

(Note that you have a syntax error in your expression: [Pi] should be 
either "\[Pi]" or "Pi" -- without the double quotes.)

So you have a real function of a real variable, say,

f(x) = (2*R^2*ArcCos[45.9/(2*R)]) - (.5*45.9*Sqrt[4*R^2 - 45.9^2])
         -.15*Pi*(R^2)

which is defined on D = (-inf, -22.95] U [22.95, inf), since 4*R^2 - 
45.9^2 is negative for -22.95 < R < 22.95 and so the square root is not 
defined on this interval when dealing with real numbers only.

You are looking for x in D such that f(x) = 0.

Now, contrary to the other CAS you tried, Mathematica has no problem 
working with complex number; indeed, by default, Mathematica assume that 
this is the complex field which is used.

Consequently, if you are interested in real values and roots only, you 
must give a starting point for Newton's Method which lies on the 
interval of definition and is located on the same side of the root.

Thus 0.1 is not an option in this case. If you are unsure where to 
start, piloting the function helps to decide.

expr = -.15*
     Pi*(R^2) + (2*R^2*ArcCos[45.9/(2*R)]) - (.5*45.9*
      Sqrt[4*R^2 - 45.9^2]);

Plot[expr, {R, 0, 40}]

Now, we see that we can choose, say, 25 as starting point and we get the 
correct real answer.

In[3]:= FindRoot[expr, {R, 25}]
expr /. % // Chop

Out[3]= {R -> 30.8774}

Out[4]= 0

Regards,
-- 
Jean-Marc


  • Prev by Date: RE: Using FindRoot
  • Next by Date: Dynamic Timeout
  • Previous by thread: Re: Using FindRoot
  • Next by thread: Extra spacing in GraphicsGrid