RE: Using FindRoot
- To: mathgroup at smc.vnet.net
- Subject: [mg83469] RE: [mg83429] Using FindRoot
- From: "Jaccard Florian" <Florian.Jaccard at he-arc.ch>
- Date: Wed, 21 Nov 2007 02:50:52 -0500 (EST)
- References: <200711200851.DAA07277@smc.vnet.net>
Hello! First of all, you have to be aware of the fact that FindRoot is using Newton method starting with the point you give. So you have first to draw you function to be able to see where the root you search is located and to be able to give an intelligent starting point, i.e. a starting point which is near the root (more near than a maximum or minimum). In your example : f[R_] := 0.15*Pi*R^2 - (2*R^2*ArcCos[45.9/(2*R)] - 0.5*45.9*Sqrt[4*R^2 - 45.9^2]) Plot[f[R], {R, 0, 40}] You will see that the definition domain of f(R) is R>22.95. So, if you look for a real root, it is a very strange idea to give R=0.1 as the starting point for FindRoot. You better try : In[27]:= FindRoot[f[R], {R, 30}] Out[27]= {R -> 30.87736860938116} And you obtain exactly what you expect. Remember : Never use FindRoot if you are looking for a real root of a one-variabled function wihout first having drawed the function ! Regards F.Jaccard -----Message d'origine----- De=A0: tdude [mailto:stiletto at bigfoot.com] Envoy=E9=A0: mardi, 20. novembre 2007 09:52 =C0=A0: mathgroup at smc.vnet.net Objet=A0: [mg83429] Using FindRoot 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? Thanks Tony.
- References:
- Using FindRoot
- From: tdude <stiletto@bigfoot.com>
- Using FindRoot