MNEWT - Solve non-linear system of equations f(x) = 0 via Newton's method
mnewt Solve non-linear system of equations f(x) = 0 via Newton's method
Function Prototype:
int mnewt (int maxiter, float ftol, float dxtol, int n, float *x, void *aux,
void (*fdfdx)(int n, float *x, float *f, float **dfdx, void *aux));
Input:
maxiter maximum number of iterations
ftol converged when sum of absolute values of f less than ftol
dxtol converged when sum of absolute values of dx less than dxtol
n number of equations
x array[n] containing initial guess of solution
aux pointer to auxiliary parameters to be passed to fdfdx
fdfdx pointer to function to evaluate f(x) and f'(x)
Output:
x array[n] containing solution
Returned: number of iterations; -1 if failed to converge in maxiter
Input to the user-supplied function fdfdx:
n number of equations
x array[n] of x0, x1, ...
aux pointer to auxiliary variables required by fdfdx.
Output from the user-supplied function fdfdx:
f array[n] of f0(x), f1(x), ...
dfdx array[n][n] of f'(x); dfdx[j][i] = dfi/dxj
Author: Dave Hale, Colorado School of Mines, 06/06/91