Re: A problem with FindRoot
- To: mathgroup at smc.vnet.net
- Subject: [mg83784] Re: [mg83728] A problem with FindRoot
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Fri, 30 Nov 2007 05:25:20 -0500 (EST)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <200711291124.GAA27273@smc.vnet.net>
- Reply-to: murray at math.umass.edu
You didn't say what error message Mathematica 5.2 gives. In Mathematica 6.0.1 (and probably in 5.2 as well), the first thing is to ensure that you use numeric values only, so define: f[x_?NumericQ] := Last@First@FindRoot[y^3 + 1 == x, {y, x}] (Except for the ?NumericQ qualification on x, this accomplishes the same thing you had.) This eliminates the error message: FindRoot::srect: "Value x in search specification {y,x} is not a number or array of numbers. " Next, just FindRoot[f[x], {x, 3}] generates a different error message, namely: 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. So do what the error message suggests: increase the allowed number of iterations or accuracy goal. For example: FindRoot[f[x], {x, 3}, AccuracyGoal -> 10^-16] {x->1.05086} Does this help? Vassilis Dimitrakas wrote: > Hi All, > > I'd like some help with respect to a problem I have with the FindRoot, > NSolve and FindInstance functions. > My version of Mathematica is 5.2 > > I define the function f as follows: > > f[x_]:={ > y/.FindRoot[y^3+1==x,{y,x}][[1]] > }[[1]] > > f[x] returns the root of the equation y^3 + 1 == x, i.e. the value > (x-1)^(1/3). f[x] has obviously a > unique root at x=1. > > If I now try to find f[x]'s root with FindRoot, for example like > > FindRoot[f[x]==0,{x,3}] > > Mathematica (v 5.2) returns error messages and no solution. The same > happens if I use instead NSolve > or FindInstance. Can you guys explain why this happens and suggest a > remedy? > > Thanks, > > Vassilis > > -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305
- References:
- A problem with FindRoot
- From: Vassilis Dimitrakas <vdimitrakas@googlemail.com>
- A problem with FindRoot