next up previous contents
Next: Return value Up: Newton method for solving Previous: Mathematical background   Contents

Implementation

The procedure for using Newton method is:
 
int Newton(int n,VECTOR (* TheFunction)(VECTOR &), 
        MATRIX (* Gradient)(VECTOR &),
        VECTOR &Input,double Accuracy,int MaxIter,VECTOR &Residu)
with

Note that it also possible to use in the Newton method the interval evaluation of the equation and of the Jacobian matrix which are necessary for the general purpose solving algorithm with Jacobian (see section 2.4). The syntax of this implementation is:

 
int Newton(int Dimension,
        INTERVAL_VECTOR (* IntervalFunction)(int,int,INTERVAL_VECTOR &), 
        INTERVAL_MATRIX (* IntervalGradient)(int, int, INTERVAL_VECTOR &),
        VECTOR &Input,double Accuracy,int MaxIter,VECTOR &Residu)

To avoid overflow problem it is possible to use the vector ALIAS_Newton_Max_Dim that must be resized to the number of unknowns and in which will be indicated the maximal possible value of each variable after each Newton operation. If one of these values is exceeded Newton will return 0.

The version of Newton method with constant $J^{-1}$ matrix is implemented as:

 
int Newton(int n,VECTOR (* TheFunction)(VECTOR &), 
        MATRIX &InvGrad,VECTOR &Input,double Accuracy,int MaxIter,VECTOR &Residu)
There is a special implementation of Newton method for univariate polynomial $P$:
 
int Newton(int Degree,REAL *Input,VECTOR &Coeff,double Accuracy,int Max_Iter,REAL *Residu)
with: In that case we may have a problem if the Accuracy cannot be reached due to numerical errors. If you have determined that Newton should converge (using for example Kantorovitch theorem, see section 3.1.2) then you may use the procedure Newton_Safe with the same argument: this procedure will return the solution which has led to the lowest Residu during the Newton scheme.

An example of use of the Newton method is presented in section 15.1.1, where it is compared to alternative methods.



Subsections
next up previous contents
Next: Return value Up: Newton method for solving Previous: Mathematical background   Contents
Jean-Pierre Merlet 2012-12-20