Module for the Secant Method
Check out the new Numerical Analysis Projects page.
The Newton-Raphson algorithm requires two
functions evaluations per iteration,
and
. Historically,
the calculation of a derivative could involve considerable
effort. But, with modern computer algebra software
packages such as Mathematica, this has become less of an
issue. Moreover, many functions have non-elementary forms
(integrals, sums, discrete solution to an I.V.P.), and it is
desirable to have a method for finding a root that does not depend on
the computation of a derivative. The secant method does not need a
formula for the derivative and it can be coded so that only one new
function evaluation is required per iteration.
The formula for the secant method is the same
one that was used in the regula falsi method, except that the logical
decisions regarding how to define each succeeding term are
different.
Algorithm
(Secant
Method). Find
a root of
given
two initial approximations
using
the iteration
for
.
Animations (Secant
Method Secant Method)
. Internet hyperlinks to animations.
Mathematica Subroutine (Secant Method).
![[Graphics:Images/SecantMethodMod_gr_7.gif]](Images/SecantMethodMod_gr_7.gif)
Example 1. Use the
secant method to find the three roots of the cubic
polynomial
.
Determine the secant iteration formula
that
is used.
Show details of the computations for the starting
value
.
Solution
1.
Reduce the volume of
printout.
After you have debugged you program and it is working
properly, delete the unnecessary print statements
and
and
![]()
Concise Program for the Secant Method
![[Graphics:Images/SecantMethodMod_gr_109.gif]](Images/SecantMethodMod_gr_109.gif)
Now test the example to see if it still works.
Error Checking in the Secant Method
Error checking can be added to the secant method. Here
we have added a third parameter
to
the subroutine which estimate the accuracy of the numerical
solution.
![[Graphics:Images/SecantMethodMod_gr_123.gif]](Images/SecantMethodMod_gr_123.gif)
The following subroutine call uses a maximum of 20 iterations,
just to make sure enough iterations are performed.
However, it will terminate when the difference between consecutive
iterations is less than
.
By interrogating k afterward we can see how
many iterations were actually performed.
Research Experience for Undergraduates
Secant Method Secant Method Internet hyperlinks to web sites and a bibliography of articles.
Downloads (Secant
Method Secant
Method).
Download this Mathematica notebook.
(c) John H. Mathews 2003