Module

for

The Secant Method

 

    The Newton-Raphson algorithm requires two functions evaluations per iteration, [Graphics:Images/SecantMethodMod_gr_1.gif] and  [Graphics:Images/SecantMethodMod_gr_2.gif].  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.  

 

Theorem (Secant Method).  Assume that [Graphics:Images/SecantMethodMod_gr_3.gif] and there exists a number [Graphics:Images/SecantMethodMod_gr_4.gif], where [Graphics:Images/SecantMethodMod_gr_5.gif].  If   [Graphics:Images/SecantMethodMod_gr_6.gif], then there exists a [Graphics:Images/SecantMethodMod_gr_7.gif] such that the sequence [Graphics:Images/SecantMethodMod_gr_8.gif] defined by the iteration  

    [Graphics:Images/SecantMethodMod_gr_9.gif]    for    [Graphics:Images/SecantMethodMod_gr_10.gif]  

will converge to [Graphics:Images/SecantMethodMod_gr_11.gif] for certain initial approximations  [Graphics:Images/SecantMethodMod_gr_12.gif].  

Proof  Secant Method  Secant Method  

 

Algorithm (Secant Method).  Find a root of  [Graphics:Images/SecantMethodMod_gr_13.gif]  given two initial approximations  [Graphics:Images/SecantMethodMod_gr_14.gif]  using the iteration  

    [Graphics:Images/SecantMethodMod_gr_15.gif]   for    [Graphics:Images/SecantMethodMod_gr_16.gif].

 

Computer Programs  Secant Method  Secant Method  

 

Mathematica Subroutine (Secant Method).

[Graphics:Images/SecantMethodMod_gr_17.gif]

Example 1.  Use the secant method to find the three roots of the cubic polynomial  [Graphics:Images/SecantMethodMod_gr_18.gif].  
Determine the secant iteration formula  [Graphics:Images/SecantMethodMod_gr_19.gif]  that is used.  
Show details of the computations for the starting value  [Graphics:Images/SecantMethodMod_gr_20.gif].
Solution 1.

 

Example 2.  Use Newton's method to find the roots of the cubic polynomial  [Graphics:Images/SecantMethodMod_gr_120.gif].  
2 (a) Fast Convergence.  Investigate quadratic convergence at the simple root  [Graphics:Images/SecantMethodMod_gr_121.gif],  using the starting value  [Graphics:Images/SecantMethodMod_gr_122.gif]
2 (b) Slow Convergence.  Investigate linear convergence at the double root  [Graphics:Images/SecantMethodMod_gr_123.gif],  using the starting value  [Graphics:Images/SecantMethodMod_gr_124.gif]
Solution 2.

 

Reduce the volume of printout.

After you have debugged you program and it is working properly, delete the unnecessary print statements  

[Graphics:Images/SecantMethodMod_gr_263.gif]  and  
[Graphics:Images/SecantMethodMod_gr_264.gif]  and  
[Graphics:Images/SecantMethodMod_gr_265.gif]

Concise Program for the Secant Method

[Graphics:Images/SecantMethodMod_gr_266.gif]

Now test this subroutine using the function in Example 1.

[Graphics:Images/SecantMethodMod_gr_267.gif]
[Graphics:Images/SecantMethodMod_gr_268.gif]

[Graphics:Images/SecantMethodMod_gr_269.gif]
[Graphics:Images/SecantMethodMod_gr_270.gif]
[Graphics:Images/SecantMethodMod_gr_271.gif]
[Graphics:Images/SecantMethodMod_gr_272.gif]

[Graphics:Images/SecantMethodMod_gr_273.gif]
[Graphics:Images/SecantMethodMod_gr_274.gif]
[Graphics:Images/SecantMethodMod_gr_275.gif]
[Graphics:Images/SecantMethodMod_gr_276.gif]

[Graphics:Images/SecantMethodMod_gr_277.gif]
[Graphics:Images/SecantMethodMod_gr_278.gif]
[Graphics:Images/SecantMethodMod_gr_279.gif]
[Graphics:Images/SecantMethodMod_gr_280.gif]

Error Checking in the Secant Method

Error checking can be added to the secant method.  Here we have added a third parameter  [Graphics:Images/SecantMethodMod_gr_281.gif]  to the subroutine which estimate the accuracy of the numerical solution.

[Graphics:Images/SecantMethodMod_gr_282.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  [Graphics:Images/SecantMethodMod_gr_283.gif].  
By interrogating  k  afterward we can see how many iterations were actually performed.

[Graphics:Images/SecantMethodMod_gr_284.gif]
[Graphics:Images/SecantMethodMod_gr_285.gif]

[Graphics:Images/SecantMethodMod_gr_286.gif]
[Graphics:Images/SecantMethodMod_gr_287.gif]
[Graphics:Images/SecantMethodMod_gr_288.gif]
[Graphics:Images/SecantMethodMod_gr_289.gif]
[Graphics:Images/SecantMethodMod_gr_290.gif]

[Graphics:Images/SecantMethodMod_gr_291.gif]
[Graphics:Images/SecantMethodMod_gr_292.gif]
[Graphics:Images/SecantMethodMod_gr_293.gif]
[Graphics:Images/SecantMethodMod_gr_294.gif]
[Graphics:Images/SecantMethodMod_gr_295.gif]

[Graphics:Images/SecantMethodMod_gr_296.gif]
[Graphics:Images/SecantMethodMod_gr_297.gif]
[Graphics:Images/SecantMethodMod_gr_298.gif]
[Graphics:Images/SecantMethodMod_gr_299.gif]
[Graphics:Images/SecantMethodMod_gr_300.gif]

Various Scenarios and Animations for the Secant Method.

Example 3. Fast Convergence  Find the solution to  [Graphics:Images/SecantMethodMod_gr_302.gif].  
Use the Secant Method and the starting approximations  [Graphics:Images/SecantMethodMod_gr_303.gif]  and  [Graphics:Images/SecantMethodMod_gr_304.gif].  
Solution 3.

 

Example 4. Slow Convergence  Find the solution to  [Graphics:Images/SecantMethodMod_gr_324.gif].  
Use the Secant Method and the starting approximations  [Graphics:Images/SecantMethodMod_gr_325.gif]  and  [Graphics:Images/SecantMethodMod_gr_326.gif].  
Solution 4.

 

Example 5. Convergence, Oscillation  Find the solution to  [Graphics:Images/SecantMethodMod_gr_365.gif].  
Use the Secant Method and the starting approximations  [Graphics:Images/SecantMethodMod_gr_366.gif]  and  [Graphics:Images/SecantMethodMod_gr_367.gif].  
Solution 5.

 

Example 6. Convergence  Find the solution to  [Graphics:Images/SecantMethodMod_gr_384.gif].  
Use the Secant Method and the starting approximations  [Graphics:Images/SecantMethodMod_gr_385.gif]  and  [Graphics:Images/SecantMethodMod_gr_386.gif].  
Solution 6.

 

Example 7. NON Convergence, Diverging to Infinity  Find the solution to  [Graphics:Images/SecantMethodMod_gr_413.gif].  
Use the Secant Method and the starting approximations  [Graphics:Images/SecantMethodMod_gr_414.gif]  and  [Graphics:Images/SecantMethodMod_gr_415.gif].  
Solution 7.

 

Example 8. Convergence  Find the solution to  [Graphics:Images/SecantMethodMod_gr_442.gif].  
Use the Secant Method and the starting approximations  [Graphics:Images/SecantMethodMod_gr_443.gif]  and  [Graphics:Images/SecantMethodMod_gr_444.gif].  
Solution 8.

 

Animations (Secant Method  Secant  Method) .  Internet hyperlinks to animations.

 

Research Experience for Undergraduates

Secant Method  Secant Method  Internet hyperlinks to web sites and a bibliography of articles.  

 

Download this Mathematica Notebook Secant Method

 

Return to Numerical Methods - Numerical Analysis

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(c) John H. Mathews 2004