## Newton-Raphson

Given a function*:*

**g***R*→

^{n}*R*Newton-Raphson's method attempts to find a zero of

^{n}*i.e. a point*

**g***such that*

**x**∈ R^{n}*.*

**g**(**x**) =**0**If

*f*:

*R*→

^{n}*R*is of class

*C*then the function

^{2}*:*

**g***R*→

^{n}*R*defined by

^{n}*is of class*

**g**(**x**) =**grad**f (**x**)*C*. The critical points of

^{1}*f*correspond to the zeros of

*. The Jacobian of*

**g***corresponds to the Hessian of*

**g***f*at a critical point. Given an initial point

*∈*

**x**_{0}*R*, Newton-Raphson's method iteratively finds a critical point of

^{n}*f*where that critical point may be a local minimum, a local maximum, or a saddle point.

The Newton-Raphson method proceeds as follows:

**Initialization:**Choose an initial estimate,, for the location of a zero of the predetermined function**x**_{0}.**g**: R^{n}→ R^{n}**Determine the Displacement Vector**Calculate the Jacobian*d*:*J*ofevaluated at,**g**,**x**_{0}*J*. The displacement_{i,j}= ∂g_{i}(**x**) / ∂x_{0}_{j}=**d**of the approximation to the location of the zero of**x**-**x**_{0}satisfies the linear equation**g***J*.**d**= -**g****Update the estimate for the location of a local minimum:**Replace the initial estimate,**x**, with_{0}.**x**+_{0}**d****Check if the stopping criterion is satisfied:**The conventional stopping rules are: (1) Stop if |||| < ε for either the**g***max*-norm or the*l*-norm, and/or (2) Stop if_{2}

|||| < ε for either the**d***max*-norm or the*l*-norm. If the stopping criterion is not satisfied, then iterate._{2}

### Function List

- int Newton_Raphson_ndim( void (*f)(double*, double*), void (*df)(double*, double*, double*), int (*Stopping_Rule)(double*, double*, int, int), double *a, double *fa, int n )

This routine uses the Newton-Raphson method to approximately locate a zero of the function. The user-supplied function**f**(**x**)*f*(*x*,*fx*) has two arguments, the first is the location**x**where the function is evaluated and the second is the array whose*i*component is the^{th}*i*component of^{th}. The user-supplied function**f**(**x**)*df*corresponds to the Jacobian of.**f**(**x**)*df*(*x*,*fx*,*dfx*) has three arguments, the first is the location**x**where the function is evaluated, the second is the array whose*i*component is the^{th}*i*component of^{th}which is included to facilitate the evaluation of the Jacobian in the event the Jacobian depends explicitly on the value**f**(**x**), and the third argument is the Jacobian**f**(**x**)*n x n*matrix whose*i,j*element is ∂f_{i}/ ∂x_{j}evaluated at. The arguments to the user-supplied**x***stopping_rule*are: the displacement vectorbetween two successive iteratates, the function evaluated at the new estimate**d***f(*, the total number of iterations performed, and**x**)*n*the dimension of. The user-supplied**x***stopping_rule*should return a non-zero, either positive or negative, integer to halt the procedure and return zero to continue iterating, return values -1 and -2 are intrinsic return values used by the Newton-Raphson routine. Upon exiting the function returns either the return of the user-supplied*stopping-rule*, a -1 indicates that there was not enough dynamic heap memory, -2 indicates that the Jacobian matrix is singular or ill-formed. The value*a*is set to the current estimate and the argument*fa*is set to the value of the function evaluated there.

*C* Source Code

- The file, newton_raphson_ndim.c, contains the version of Newton_Raphson_ndim( ) written in
*C*.