Mathematica 9 is now available
Previous section-----Next section

1.6.3 Numerical Equation Solving

NSolve[lhsEqualrhs, x] solve a polynomial equation numerically
NSolve[{ Equal ,  Equal , ... }, {x, y, ... }]
solve a system of polynomial equations numerically
FindRoot[lhsEqualrhs, {x,  }] search for a numerical solution to an equation, starting at x =
FindRoot[{ Equal ,  Equal , ... }, {{x,  }, {y,  }, ... }]
search for numerical solutions to simultaneous equations

Numerical root finding.
NSolve gives you numerical approximations to all the roots of a polynomial equation.

In[1]:=  NSolve[ x^5 + x + 1 Equal 0, x ]

Out[1]=

You can also use NSolve to solve sets of simultaneous equations numerically.

In[2]:=  NSolve[{x + y Equal 2, x - 3 y + z Equal 3, x - y + z Equal 0},
{x, y, z}]

Out[2]=

If your equations involve only linear functions or polynomials, then you can use NSolve to get numerical approximations to all the solutions. However, when your equations involve more complicated functions, there is in general no systematic procedure for finding all solutions, even numerically. In such cases, you can use FindRoot to search for solutions. You have to give FindRoot a place to start its search.

This searches for a numerical solution, starting at  .

In[3]:=  FindRoot[ 3 Cos[x] Equal Log[x], {x, 1} ]

Out[3]=

The equation has several solutions. If you start at a different  , FindRoot may return a different solution.

In[4]:=  FindRoot[ 3 Cos[x] Equal Log[x], {x, 10} ]

Out[4]=

You can search for solutions to sets of equations. Here the solution involves complex numbers.

In[5]:=  FindRoot[{xEqualLog[y], yEqualLog[x]}, {{x, I}, {y, 2}}]

Out[5]=



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