SDDSlib
|
Implements the zeroNewton function for finding zeros of a function using Newton's method with numerical derivatives. More...
#include "mdb.h"
Go to the source code of this file.
Functions | |
double | zeroNewton (double(*fn)(), double value, double x_i, double dx, long n_passes, double _zero) |
Finds the zero of a function using Newton's method with numerical derivative computation. | |
Implements the zeroNewton function for finding zeros of a function using Newton's method with numerical derivatives.
Definition in file zeroNewton.c.
double zeroNewton | ( | double(* | fn )(), |
double | value, | ||
double | x_i, | ||
double | dx, | ||
long | n_passes, | ||
double | _zero ) |
Finds the zero of a function using Newton's method with numerical derivative computation.
This function attempts to find a value x
such that fn(x)
is approximately equal to the given value
. It employs Newton's iterative method, where the derivative is estimated numerically using finite differences.
fn | Pointer to the function for which the zero is to be found. |
value | The target value to solve for, i.e., find x such that fn(x) = value . |
x_i | Initial guess for the independent variable. |
dx | Increment used for numerical derivative computation. |
n_passes | Number of iterations to perform. |
_zero | Acceptable tolerance for the zero, determining when to stop the iterations. |
x
value where fn(x)
is approximately equal to value
, or DBL_MAX
if no zero is found within the iteration limit. Definition at line 33 of file zeroNewton.c.