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
    or inequalities
    exprdomdomain specifications
    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 .
  • 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[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 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.

ExamplesExamplesopen allclose all

Basic Examples (1)Basic Examples (1)

Approximate solutions to a polynomial equation:

Click for copyable input

Approximate real solutions to a polynomial equation:

Click for copyable input

Approximate solutions to a system of polynomial equations:

Click for copyable input

Approximate real solutions to a system of polynomial equations:

Click for copyable input
New in 2 | Last modified in 8
New to Mathematica? Find your learning path »
Have a question? Ask support »