NSolve

NSolve[expr,vars]
attempts to find numerical approximations to the solutions of the system expr of equations or inequalities for the variables vars.

NSolve[expr,vars,Reals]
finds solutions over the domain of real numbers.

Details and OptionsDetails and Options

  • The system expr can be any logical combination of:
  • lhs==rhsequations
    lhs!=rhsinequations
    or inequalities
    exprdomdomain specifications
    {x,y,}regregion specification
    ForAll[x,cond,expr]universal quantifiers
    Exists[x,cond,expr]existential quantifiers
  • NSolve[{expr1,expr2,},vars] is equivalent to NSolve[expr1&&expr2&&,vars].
  • A single variable or a list of variables can be specified.
  • NSolve gives solutions in terms of rules of the form:
  • {}no solutions
    {{x->solx,y->soly,},}several solutions
    {{}}solution set is full dimensional
  • 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[expr,vars] assumes by default that quantities appearing algebraically in inequalities are real, while all other quantities are complex.
  • In NSolve[expr,vars,Reals] 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[,xreg,Reals] constrains x to be in the region reg. The different coordinates for x can be referred to using Indexed[x,i].
  • NSolve deals primarily with linear and polynomial equations.
  • The following options can be given:
  • MethodAutomaticwhat method should be used
    VerifySolutionsAutomaticwhether to verify solutions
    WorkingPrecisionAutomaticprecision to be used in computations
  • Possible Method settings include and .

ExamplesExamplesopen allclose all

Basic Examples  (5)Basic Examples  (5)

Approximate solutions to a polynomial equation:

In[1]:=
Click for copyable input
Out[1]=

Approximate real solutions to a polynomial equation:

In[1]:=
Click for copyable input
Out[1]=

Approximate solutions to a system of polynomial equations:

In[1]:=
Click for copyable input
Out[1]=

Approximate real solutions to a system of polynomial equations:

In[1]:=
Click for copyable input
Out[1]=

Solve equations in a geometric region:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
Introduced in 1991
(2.0)
| Updated in 2014
(10.0)