Header file for root finding method.
More...
Go to the source code of this file.
|
| typedef void(* | newton_callback) (double x, double *f, double *df, void *p) |
| | Callback function for Newton-Raphson root finder.
|
| |
| typedef double(* | ridder_callback) (double x, void *p) |
| | Callback function for Ridder's root finder.
|
| |
Header file for root finding method.
- Author
- L. Rossman
- Date
- Created: 2013-11-19
-
Last updated: 2025-01-02
◆ newton_callback
Callback function for Newton-Raphson root finder.
- Parameters
-
| x | Value of the independent variable. |
| f | Value of the function at x. |
| df | Value of the derivative of the function at x. |
| p | Pointer to additional data. |
◆ ridder_callback
Callback function for Ridder's root finder.
- Parameters
-
| x | Value of the independent variable. |
| p | Pointer to additional data. |
◆ findroot_Newton()
| int findroot_Newton |
( |
double |
x1, |
|
|
double |
x2, |
|
|
double * |
rts, |
|
|
double |
xacc, |
|
|
newton_callback |
func, |
|
|
void * |
p |
|
) |
| |
Finds the root of a function using Newton's method.
- Parameters
-
| x1 | Lower bound of the bracketing interval. |
| x2 | Upper bound of the bracketing interval. |
| rts | Pointer to the root. |
| xacc | Desired accuracy of the root. |
| func | Callback function for the function and its derivative. |
| p | Pointer to additional data. |
- Returns
- Number of function evaluations used or 0 if the maximum allowed iterations were exceeded.
◆ findroot_Ridder()
| double findroot_Ridder |
( |
double |
x1, |
|
|
double |
x2, |
|
|
double |
xacc, |
|
|
ridder_callback |
func, |
|
|
void * |
p |
|
) |
| |
Finds the root of a function using Ridder's method.
- Parameters
-
| x1 | Lower bound of the bracketing interval. |
| x2 | Upper bound of the bracketing interval. |
| xacc | Desired accuracy of the root. |
| func | Callback function for the function. |
| p | Pointer to additional data. |
- Returns
- The root of the function.