# Numerical Analysis/Newton's method exercises

In this section we are going to look at a method for approximating solutions to equations. We all know that equations need to be solved on occasion and in fact we’ve solved quite a few equations ourselves to this point. we were able to actually find the solutions, but it’s not always possible to do that exactly and/or do the work by hand. That is where this application comes into play. So, let’s see what this application is all about.

Let’s suppose that we want to approximate the solution to f(x_{0}) and let’s also suppose that we have somehow found an initial approximation to this solution say, x0. This initial approximation is probably not all that good and so we’d like to find a better approximation. This is easy enough to do. First we will get the tangent line to f(x) at x0.

y=f(x_{0})+f'(x_{0})(x-x_{0})

**Example**:

1)Find a nonzero root of equation x^{2}-sin x using newton's method.

Solution:

Let us take our initial guess as .5

f'(x)=2x-cos x.

now we will use newton's formula to find x_{2}=x_{1}-f'(x_{1})f(x_{1})

x_{2}=.5-sin(.5)2(.5)-cos(.5)=2.374

In this way we get x_{3}=1.4702,x_{4}=1.0594,x_{5}=0.9057,x_{6}=0.8727,x_{7}=0.8766,x_{8}=0.8767

2)Find an approximation to 5^{1/2} to ten decimal places with starting point as 2.

5^{1/2} is the root of f(x)=x^{2}-5

so now using the formula,x_{2}=x_{1}-f'(x_{1})f(x_{1})

we get,x_{1}=2

x_{2}=2.25

x_{3}=2.236111111111

x_{4}=2.236067977915

x_{5}=2.236067977499

x_{6}=2.236067977499

**Exercise**

Use Newton's method to approxmate the zero's of function f(x) = x^{3}+2x+2

Solution:

0.358

**Algorithm Failures**:
In some cases the conditions on function necessary for convergence are satisfied, but the point chosen as the initial point is not in the interval where the method converges. In such cases a different method, such as bisection, should be used to obtain a better estimate for the zero to use as an initial point.

**Example**:Use x_{0}=1 to find the approximation to the solution to f(x)=x^{1/3} .

using Newton's Formula x_{n+1}=-2x_{n}.

x_{1}=-2

x_{2}=4

x_{3}=-8

x_{4}=16
..

Because each step produces new approxmation that is far from the root , method fails.

**Exercise**

Find the roots of the polynomial f(x)=e^{x}-2x with starting point as 1

Solution:

Method fails

## Quiz[edit | edit source]