OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
findroot.h File Reference

Header file for root finding method. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

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.
 

Functions

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.
 
double findroot_Ridder (double x1, double x2, double xacc, ridder_callback func, void *p)
 Finds the root of a function using Ridder's method.
 

Detailed Description

Header file for root finding method.

Author
L. Rossman
Date
Created: 2013-11-19
Last updated: 2025-01-02

Typedef Documentation

◆ newton_callback

newton_callback

Callback function for Newton-Raphson root finder.

Parameters
xValue of the independent variable.
fValue of the function at x.
dfValue of the derivative of the function at x.
pPointer to additional data.

◆ ridder_callback

ridder_callback

Callback function for Ridder's root finder.

Parameters
xValue of the independent variable.
pPointer to additional data.

Function Documentation

◆ 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
x1Lower bound of the bracketing interval.
x2Upper bound of the bracketing interval.
rtsPointer to the root.
xaccDesired accuracy of the root.
funcCallback function for the function and its derivative.
pPointer 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
x1Lower bound of the bracketing interval.
x2Upper bound of the bracketing interval.
xaccDesired accuracy of the root.
funcCallback function for the function.
pPointer to additional data.
Returns
The root of the function.