This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

FindRoot

FindRoot
searches for a numerical root of f, starting from the point .
FindRoot
searches for a numerical solution to the equation .
FindRoot
searches for a simultaneous numerical root of all the .
FindRoot
searches for a numerical solution to the simultaneous equations .
  • If the starting point for a variable is given as a list, the values of the variable are taken to be lists with the same dimensions.
  • FindRoot returns a list of replacements for x, y, ... , in the same form as obtained from Solve.
  • FindRoot first localizes the values of all variables, then evaluates f with the variables being symbolic, and then repeatedly evaluates the result numerically.
  • FindRoot searches for a solution using and as the first two values of x, avoiding the use of derivatives.
  • FindRoot searches for a solution, stopping the search if x ever gets outside the range to .
  • If you specify only one starting value of x, FindRoot searches for a solution using Newton methods. If you specify two starting values, FindRoot uses a variant of the secant method.
  • If all equations and starting values are real, then FindRoot will search only for real roots. If any are complex, it will also search for complex roots.
  • You can always tell FindRoot to search for complex roots by adding I to the starting value.
  • The following options can be given:
AccuracyGoalAutomaticthe accuracy sought
EvaluationMonitorNoneexpression to evaluate whenever equations are evaluated
JacobianAutomaticthe Jacobian of the system
MaxIterations100maximum number of iterations to use
PrecisionGoalAutomaticthe precision sought
StepMonitorNoneexpression to evaluate whenever a step is taken
WorkingPrecisionMachinePrecisionthe precision to use in internal computations
  • The setting for AccuracyGoal specifies the number of digits of accuracy to seek in both the value of the position of the root, and the value of the function at the root.
  • The setting for PrecisionGoal specifies the number of digits of precision to seek in the value of the position of the root.
  • If FindRoot does not succeed in finding a solution to the accuracy you specify within MaxIterations steps, it returns the most recent approximation to a solution that it found. You can then apply FindRoot again, with this approximation as a starting point.
Find a root of near :
Find a solution to near :
Solve a nonlinear system of equations:
Find a root of near :
In[1]:=
Click for copyable input
Out[1]=
 
Find a solution to near :
In[1]:=
Click for copyable input
Out[1]=
 
Solve a nonlinear system of equations:
In[1]:=
Click for copyable input
Out[1]=
Find the solution of a system of two nonlinear equations:
Find a root for a three-component function of three variables:
You can cause the search to use complex values by giving a complex starting value:
When the function is complex for real input, a real starting value may give a complex result:
A variable may be considered as vector valued if specified in the starting value:
Change tolerances for error estimates:
Relax error tolerances for stopping:
Make estimated relative distance to the root the main criterion for stopping:
can be used to help speed convergence to higher-order roots:
EvaluationMonitor can be used to keep track of function evaluations used:
Specify the Jacobian for a "black-box" function:
Without a specified Jacobian, extra evaluations are used to compute finite differences:
If you just know the sparse form, specifying the sparse pattern template saves evaluations:
Limit or increase the number of steps taken:
The default number of iterations is 100:
Eventually the algorithm stalls out since this mollifier function has all derivatives 0 at :
Find a root for using different methods:
The default (Newton's) method:
Brent's root-bracketing method requiring two initial conditions bracketing the root:
Secant method, starting with two initial conditions:
Monitor when iterative steps have been taken:
Show the steps on a contour plot of :
Show steps (red) and evaluations (green). A step may require several evaluations:
Find a root using 100-digit precision arithmetic:
Find the root starting with machine precision and adaptively working up to precision 100:
For an isomorphism , the inverse is the root of :
An approximate inverse for the exponential function:
It is very close to the built-in Log function:
A "black-box" function giving the period of an oscillation:
Plot its inverse:
Solve a boundary value problem , using a shooting method:
Use points on either side of the root to give bracketing starting values:
Plot the solution:
Solve the boundary-value problem , with n collocation points:
Consider as a first-order system :
Equations for collocation using the trapezoidal rule:
Use 0 as a starting value:
Find a solution for a particular value of :
For a polynomial system of equations, NSolve finds all solutions and FindRoot finds one:
FindRoot will find a single solution using an iterative method:
NSolve will find all solutions using a direct method:
For equations involving parameters or exact solutions use Solve, Reduce, or FindInstance:
Solve will return some solutions:
Reduce will enumerate all solutions:
FindInstance will find particular instances:
If a function is complex, variables are allowed to have complex values:
If the function is kept real, variables are also taken to be real:
It can be time-consuming to compute functions symbolically:
Restricting the function definition avoids symbolic evaluation:
New in 1 | Last modified in 5