WebCab Functions for COM v2.0

EquationSolver.Ridders Method (Double, Double, Double, Int64)

Implements Ridders' Method which is a powerful variant of the Secant method.

public double Ridders(
   double beginningOfInterval,
   double endOfInterval,
   double precision,
   long maxIterations
);

Parameters

beginningOfInterval
The coordinate value of the lower bound of the interval over which a solution to the equation is known to exist.
endOfInterval
The coordinate value of the upper bound of the interval over which a solution to the equation is known to exist.
precision
The level of precision of a solution required before it is returned and the algorithm exists. That is, if the precision is set to 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.
maxIterations
The maximum number of iterations performed before the result will be returned. If the method fails for a given level of precision you may need to increase the maximum number of iterations.

Return Value

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.

Remarks

This implementation allows the user to provide the initial bracketing interval and set the number of iterations, in contrast with Ridders which does not.

Further Details

This powerful variant on the Secant method was developed by C.J.F.Ridders in the article: Ridders, C.J.F. 1979, IEEE Transactions on Circuits and Systems, vol. CAS-26, pp. 979-980}. The basic idea is to improve the initial bracketing interval by the following procedure. If the root is bracketed between x1 and x2, Ridders' method first evaluates function at the midpoint:

x3 = (x1 + x2)/2

Then we update our initial bracketed interval by:

x4 = x3 + (x3 - x1) . (sign[ƒ(x1)-ƒ(x2)]ƒ(x3))/(√{ƒ(x3)2 - ƒ(x1)ƒ(x2)}),

where sign[...] is the sign function and √{...} is the square root. The new estimate x4 is guaranteed to lie in the bracketed interval and therefore this approach can be seen as a variant of the bisection method.

The speed at which Ridders' method converges is given by:

limk → ∞ | ek+1 | ≈ c.| ek |√2,

where c is a constant, en is the order of the error after n iterations.

When to use this approach?

Ridders' method given an initial bracketing interval is certain to converge. Moreover, Ridders' method is a powerful variant of the Secant method which is most case is the preferred choice.

See Also

EquationSolver Class | WebCab.COM.Math.EquationSolver Namespace | EquationSolver.Ridders Overload List | Ridders - Applies Ridders' algorithm without the need to provide the initial bracketing algorithm or maximum number of iterations.