WebCab Functions for COM v2.0

EquationSolver.NewtonRaphson Method (Double)

Implements the Newton-Raphson method where the initial point is taken to be the origin and the maximum number of iterations is 1,000.

public double NewtonRaphson(
   double precision
);

Parameters

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 a precision of 0.00001, we require t ms; then using a precision of 0.001, will require 0.6t ms, and using a precision of 0.0000001, will require 1.4t.

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

Further Details

The Newton-Raphson method is the mostly widely used method for finding the roots of an equation of one real variable. The Newton-Raphson approach does not depend on bracketing the solution (unlike the other algorithms provided) and instead will locally approximate the equation by a linear equation and then solve this approximation which will provide the next point within the iterative sequence which will lead to a solution. The successful application of this approach will depend on:

  1. Provide Initial Point: When applying this approach an initial point (rather than a bracketing interval) will need to be provided, and moreover the particular point selected will determine the speed and effect whether or not the algorithm converges. As a rule of thumb the closer to the solution the initial point can be chosen the more likely the convergence and the faster that convergence will be.
  2. Evaluation of the Derivative: The Newton-Raphson approach requires that the derivative of the equation considered is evaluated at a sequence of points. The reason for this is that the derivative is used to find the linear approximation of the equation at a given point.

Assuming that an initial starting point x0, from which a solution to an equation ƒ(x)=0 has been given, the Newton-Raphson method will produce a sequence of points: x0, x1, ..., xn,..., using the iterative formula:

xn+1 = xn - ƒ(xn) / ƒ'(xn),

where ƒ'(xn) is the derivative of the equation ƒ, evaluated at the point xn. The idea behind the above formula is to draw the tangent to the curve at xn and then trace this line down to the x-axis which will give us our next estimate of the solution xn+1. By repeating this process the resulting sequence of points will converge to a solution of the equation in question.

When to use this Approach?

The Newton-Raphson method requires that the derivative is evaluated at a sequence of points and therefore often the viability of this approach will depend on how expensive it is to evaluate the derivative for the equation being considered. However, if the derivative is not particularly expensive to evaluate then the Newton-Raphson approach is generally a very efficient approach.

See Also

EquationSolver Class | WebCab.COM.Math.EquationSolver Namespace | EquationSolver.NewtonRaphson Overload List | Newton-Raphson - Offers the Newton-Raphson method which allows the initial point and the maximum number of iterations to be set.