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

NSolve

NSolve
attempts to find numerical approximations to the solutions of the system expr of equations or inequalities for the variables vars.
NSolve
finds solutions over the domain of real numbers.
  • The system expr can be any logical combination of:
lhs==rhsequations
lhs!=rhsinequations
or inequalities
exprdomdomain specifications
ForAll[x,cond,expr]universal quantifiers
Exists[x,cond,expr]existential quantifiers
  • A single variable or a list of variables can be specified.
  • NSolve gives solutions in terms of rules of the form .
  • When there are several variables, the solution is given in terms of lists of rules: .
  • When there are several solutions, NSolve gives a list of them.
  • When a single variable is specified and a particular root of an equation has multiplicity greater than one, NSolve gives several copies of the corresponding solution.
  • NSolve assumes by default that quantities appearing algebraically in inequalities are real, while all other quantities are complex.
  • In NSolve all variables, parameters, constants, and function values are restricted to be real.
  • NSolve[expr&&varsReals, vars, Complexes] solves for real values of variables, but function values are allowed to be complex.
  • NSolve deals primarily with linear and polynomial equations.
  • The following options can be given:
MethodAutomaticwhat method should be used
WorkingPrecisionAutomaticprecision to be used in computations
  • NSolve gives if there are no solutions to the equations.
  • NSolve gives if the set of solutions is full dimensional.
Approximate solutions to a polynomial equation:
Approximate real solutions to a polynomial equation:
Approximate solutions to a system of polynomial equations:
Approximate real solutions to a system of polynomial equations:
Approximate solutions to a polynomial equation:
In[1]:=
Click for copyable input
Out[1]=
Approximate real solutions to a polynomial equation:
In[2]:=
Click for copyable input
Out[2]=
Approximate solutions to a system of polynomial equations:
In[3]:=
Click for copyable input
Out[3]=
Approximate real solutions to a system of polynomial equations:
In[4]:=
Click for copyable input
Out[4]=
Univariate polynomial equations:
Polynomial equations with inexact coefficients:
Polynomial equations with multiple roots:
Algebraic equations:
Transcendental equations:
Univariate elementary function equations over bounded regions:
Univariate holomorphic function equations over bounded regions:
Here NSolve finds some solutions but is not able to prove there are no other solutions:
Equation with a purely imaginary period over a vertical stripe in the complex plane:
Systems of linear equations:
Linear equations with inexact coefficients:
Underdetermined systems of linear equations:
Linear equations with no solutions:
Systems of polynomial equations:
Underdetermined systems of polynomial equations:
Algebraic equations:
Transcendental equations:
Polynomial equations:
Polynomial equations with multiple roots:
Algebraic equations:
Piecewise equations:
Transcendental equations, solvable using inverse functions:
Transcendental equations, solvable using special function zeros:
Transcendental inequalities, solvable using special function zeros:
Exp-log equations:
High-degree sparse polynomial equations:
Algebraic equations involving high-degree radicals:
Equations involving irrational real powers:
Equation with a double root:
Tame elementary function equations:
Elementary function equations in bounded intervals:
Holomorphic function equations in bounded intervals:
Linear systems:
Polynomial systems:
Quantified polynomial systems:
Algebraic systems:
Piecewise systems:
Transcendental systems solvable using inverse functions:
Systems exp-log in the first variable and polynomial in the other variables:
Quantified system:
Systems elementary and bounded in the first variable and polynomial in the other variables:
Quantified system:
Systems holomorphic and bounded in the first variable and polynomial in the other variables:
Quantified system:
Mixed real and complex variables:
All variables are solved for:
Working precision can be given as the last argument:
By default NSolve introduces slicing hyperplanes for underdetermined complex systems:
With Method->{"UseSlicingHyperplanes"->False}, NSolve gives parametric solutions:
By default, NSolve finds solutions of exact equations using machine-precision computations:
This computes the solutions using 50-digit precision:
Approximate solutions of a polynomial equation:
Find intersection points of a circle and a parabola:
Solutions approximately satisfy the equations:
Solutions are given as replacement rules and can be directly used for substitution:
NSolve uses to represent the empty or no solution:
NSolve uses to represent the universal solution or that all points satisfy the equations:
For univariate equations, NSolve repeats solutions according to their multiplicity:
Find solutions over specified domains:
NSolve is a global equation solver:
FindRoot is a local equation solver:
NSolve gives approximate results:
Use Solve to get exact solutions:
Use FindInstance to get exact solution instances:
Use NDSolve to solve differential equations numerically:
Solutions obtained with machine-precision numeric computations may not be accurate:
With higher WorkingPrecision more accurate results are produced:
Approximate solutions may not satisfy the equations due to numeric errors:
The equations are satisfied up to a certain tolerance:
Using higher WorkingPrecision will give solutions with smaller tolerance:
If the solutions set is infinite, NSolve gives its intersection with random hyperplanes:
Use ContourPlot and ContourPlot3D to view the real part of solutions:
Solve the equation :
New in 2 | Last modified in 8