Dmitriy Tserekhman
Analysis:
Part 1 - Division by Zero Example
Main Page
Part 2 - Method does not converge
A The following example shows the situation when the secant method fails to produce an approximation because of division by zero:
Files used and generated:
f5.m run_me5.m
output5.txt
| >> run_me5
*************** Specifications on Given Computing Machine *********************** Floating point relative accuracy (eps) is: 2.220446e-016 Smallest positive floating point number is: 2.225074e-308 Largest positive floating point number is: 1.797693e+308 ********************************************************************************* Function Name: f5 ************************** Initial Input Values: ********************************
n= 0 a= -2.000000e+000, f(a)= -1.000000e+000
*** ERROR ocurred: Division by Zero - Function values of
Error in ==> D:\MATLAB6p5\work\run_me5.m
>> |
The above example shows that the implemented secant method detects the division by zero and notifies user about such error condition.
The next output shows results produced by running the secant method on the same function as in the previous example, only with different initial points. This time, it clearly shows that the method does not converge in 100 iterations.
Files used and generated: f5.m
run_me6.m
output6.txt
| Function Name: f5
************************** Initial Input Values: ********************************
n= 0 a= -1.700000e+000, f(a)= -8.183306e-001
|
| The following convergence graph was generated from function f(x)
= e^x - 3x^2 analyzed in Testing Procedures section.
Files used: f2.m run_me2_2.m From the produced graph it can be seen that the slope gets very steep after the 4th iteration, which make the result to converge very fast. Therefore, the shown convergence is superlinear. |
![]() |
| This convergence graph was produced from problem 8 on page 132
listed in the testing section under the case
when k = 1.
Files used: f4_1.m run_me4_1_2.m Based on the same assertions, the received convergence is also superlinear. |
![]() |
From the above convergence examples, it can be concluded that in most cases the secant method converges superlinearly. It can also be concluded that the convergence is superlinear based on the outputs shown in Testing Section. It was seen that no matter how small the error tolerance value was, the result would still converge within about 10 iterations, provided that convergence exists.