Numerical Equation Solving

Numerical root finding.

(RefLink[NSolve, paclet:ref/NSolve]) gives you numerical approximations to all the roots of a polynomial equation:

NSolve[x^5+x+1==0,x]

You can also use (RefLink[NSolve, paclet:ref/NSolve]) to solve sets of simultaneous equations numerically:

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

If your equations involve only linear functions or polynomials, then you can use (RefLink[NSolve, paclet:ref/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 (RefLink[FindRoot, paclet:ref/FindRoot]) to search for solutions. You have to give (RefLink[FindRoot, paclet:ref/FindRoot]) a place to start its search.

This searches for a numerical solution, starting at x==1:

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

The equation has several solutions. If you start at a different x, (RefLink[FindRoot, paclet:ref/FindRoot]) may return a different solution:

FindRoot[3 Cos[x]==Log[x],{x,10}]

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

FindRoot[{x==Log[y],y==Log[x]},{{x,I},{y,2}}]