Class RootFinding
java.lang.Object
org.episteme.core.mathematics.analysis.rootfinding.RootFinding
Root finding algorithms for solving f(x) = 0.
Implements Newton-Raphson, Bisection, and Secant methods.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RealBisection method (bracketing method).static RealBrent's method - combination of bisection, secant, and inverse quadratic interpolation.static RealnewtonRaphson(Function<Real, Real> f, Function<Real, Real> df, Real initialGuess, Real tolerance, int maxIterations) Newton-Raphson method: xₙ₊₠= xâ‚™ - f(xâ‚™)/f'(xâ‚™)static RealSecant method: xₙ₊₠= xâ‚™ - f(xâ‚™) * (xâ‚™ - xₙ₋â‚Â) / (f(xâ‚™) - f(xₙ₋â‚Â))
-
Constructor Details
-
RootFinding
public RootFinding()
-
-
Method Details
-
newtonRaphson
public static Real newtonRaphson(Function<Real, Real> f, Function<Real, Real> df, Real initialGuess, Real tolerance, int maxIterations) Newton-Raphson method: xₙ₊₠= xₙ - f(xₙ)/f'(xₙ)Quadratic convergence near root. Requires derivative.
- Parameters:
f- the functiondf- the derivative of finitialGuess- starting pointtolerance- convergence tolerancemaxIterations- maximum iterations- Returns:
- approximate root, or null if not found
-
bisection
public static Real bisection(Function<Real, Real> f, Real a, Real b, Real tolerance, int maxIterations) Bisection method (bracketing method).Guaranteed convergence if f(a) and f(b) have opposite signs. Linear convergence but robust.
- Parameters:
f- the functiona- left bracketb- right brackettolerance- convergence tolerancemaxIterations- maximum iterations- Returns:
- approximate root, or null if not found
-
secant
public static Real secant(Function<Real, Real> f, Real x0, Real x1, Real tolerance, int maxIterations) Secant method: xₙ₊₠= xâ‚™ - f(xâ‚™) * (xâ‚™ - xₙ₋â‚Â) / (f(xâ‚™) - f(xₙ₋â‚Â))Superlinear convergence. Does not require derivative.
- Parameters:
f- the functionx0- first initial guessx1- second initial guesstolerance- convergence tolerancemaxIterations- maximum iterations- Returns:
- approximate root, or null if not found
-
brent
Brent's method - combination of bisection, secant, and inverse quadratic interpolation.Best general-purpose root finder. Guaranteed convergence with superlinear speed.
- Parameters:
f- the functiona- left bracketb- right brackettolerance- convergence tolerance- Returns:
- approximate root
-