Implements the Secant Method where the initial bracketing interval needs to be given.
0.0001 then the result will be returned to within 0.0001 etc, assuming that an solution to this level of accuracy is found within the maximum number of iterations allowed. A reasonable value to take for this parameter is 0.00001. For smaller values of the precision parameter the solution will be more precise however the procedure will require more iterations and hence time in order to find the solution to the desired level of accuracy. Generally speaking, if using if for the precision 0.00001, we require t ms; then using a precision of 0.001, will take 0.6t ms, and using a precision of 0.0000001, will take 1.4t.A solution of the equation set using SetFunction, to the given level of precision required or NaN if the algorithm fails to produce such a solution.
Though the Secant method will bracket the root (i.e. [x1, x2]),
before being applied this bracketing does not ensure that the algorithm will
converge. However assuming that the algorithm converges this algorithm can be
very efficient and particularly applicable when the equation considered
exhibits linear characteristics.
The main idea behind this algorithm is to assume that the function is linear in the neighborhood of interest. We then use a linear approximation of the function and get an improved bound by replacing one of the bracketed bounds with the root of the linear equation in order to produce an interval which we hope is a smaller bracketing interval. After which we just then repeat this process until the solution has been found to a given level of accuracy or the maximum number of iterations has been exceeded.
Remark: This approach is closely related to the Newton-Raphson approach where the linear approximation takes the place of the derivative within the Newton-Raphson approach.
Formally, we use the following relationship to calculate successive approximations:
xn = xn-1 - ƒ(xn-1).(xn-1 - xn-2) / ƒ(xn-1) - ƒ(xn-2), for n ≥ 2.
until the desired level of tolerance has been achieved.
Speed of Convergence: It can be shown that the order of convergence is the golden ratio 1.618..., so that:
limk → ∞ | ek+1 | ≈ c.| ek |1.618
where c is a constant and en is the order of error after n iterations.
The disadvantage with the secant method is that if the equation is insufficiently linear in the neighborhood of interest then the root may not lie within the bracketed region and hence the method will not always converge is such cases. However, when the equation being considered is linear in nature then the Secant method is a very efficient and robust approach to use.
EquationSolver Class | WebCab.COM.Math.EquationSolver Namespace | EquationSolver.Secant Overload List | Secant - Applies the Secant algorithm without the need to provide the initial bracketing algorithm or maximum number of iterations.