Next: Exercises Up: The Newton-Raphson Method Previous: Background

## Maple Usage

The CalcP package (which must be called using the with(CalcP); command) contains an implementation of the Newton-Raphson method called Newton. This Newton command takes three arguments. The first is the function that is set equal to zero, next is the initial guess , and third is the number of repetitions of Newton-Raphson.

For instance, to see the first 15 approximations to a root of when is taken as -9, the syntax would be as follows.

```  > with(CalcP);
```

```  > f := x -> x^5-6*x^4+x^3+2*x^2-5*x+7;
```

```  > Newton(f,x=-9,15);
```

This will display and and and for n equal 1 to 15. By looking at the , one can see if is tending to 0 as n increases.

If an expression is used as the first argument of Newton as in

```  > Newton(x^7-5*x^3-3*x+7,x=2,10);
```

then each line of output will be of the form

.

In the CalcP package there is a routine called NewtonPlot which can help you visualize the action of the Newton-Raphson algorithm. You may find it useful in dealing with some of the exercises below. Basically, it plots the sequence of approximations to a root generated by Newton-Raphson. The syntax is as follows where a is the initial guess for a root.

```  > NewtonPlot(f,x=a);
```

Sean O Anderson
Tue Oct 1 12:37:24 EDT 1996