Mathematica 9 is now available

Documentation / CalculationCenter / Functions / Solvers /

LocateRoot

FilledSmallSquare LocateRoot[f, {x, }] searches for a numerical solution to the equation f == 0, starting with x = .

FilledSmallSquare LocateRoot[f, {x, {, }}] searches for a solution using and as the first two values of x. This form must be used if symbolic derivatives of the equation cannot be found.

FilledSmallSquare LocateRoot[f, {x, xstart, xmin, xmax}] searches for a solution, stopping the search if x ever gets outside the range xmin to xmax.

FilledSmallSquare LocateRoot[{, , ... }, {x, }, {y, }, ... ] searches for a numerical solution to the simultaneous equations .

FilledSmallSquare LocateRoot returns a list of replacements for x, y, ... , in the same form as obtained from SolveEquation.

FilledSmallSquare If you specify only one starting value of x, LocateRoot searches for a solution using Newton's method. If you specify two starting values, LocateRoot uses a variant of the secant method.

FilledSmallSquare If all equations and starting values are real, then LocateRoot will search only for real roots. If any are complex, it will also search for complex roots.

FilledSmallSquare You can always tell LocateRoot to search for complex roots by adding 0. I to the starting value.

FilledSmallSquare See also: LocateMinimum, SolveEquation, SolveODE.

Examples

Using InstantCalculators

Here are the InstantCalculators for the LocateRoot function. Enter the parameters for your calculation and click Calculate to see the result.

In[1]:=

Out[1]=

In[2]:=

Out[2]=

In[3]:=

Out[3]=

Entering Commands Directly

You can paste a template for this command via the Text Input button on the LocateRoot Function Controller.

These two curves intersect at one point.

In[4]:=

This finds a numerical approximation to the x coordinate of the intersection point. The -0.5 is the initial guess.

In[5]:=

Out[5]=

Trigonometric equations typically have an infinite number of roots. If you start sufficiently close to a particular root of an equation, LocateRoot will find that root.

In[6]:=

Out[6]=

Starting closer to another root will give a different solution.

In[7]:=

Out[7]=

You can restrict LocateRoot so that it looks for solutions in one particular region only. Here the initial guess is and the solution is supposed to be between and . There is no such solution.

In[8]:=

Out[8]=

This is what happens when LocateRoot can find no solutions at all.

In[9]:=

Out[9]=

If you want LocateRoot to use complex values in its search, then you need to give a complex starting value.

In[10]:=

Out[10]=

You can use the secant method by giving two starting values.

In[11]:=

Out[11]=

This finds a solution to a set of simultaneous equations. It is a good idea to avoid taking the starting values for x and y to be equal or to take any other "special" combinations of values.

In[12]:=

Out[12]=

The criterion LocateRoot uses for convergence to a root is how close the function is to zero. If the function is very flat, it may be close to zero before the variable is close enough to the root.

In[13]:=

Out[13]=

Here LocateRoot stops when the value of the function is within the accuracy goal (6 digits) of zero, but the root is only good to one decimal place.

In[14]:=

Out[14]=



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.