Class RootFinding

java.lang.Object
org.episteme.core.mathematics.analysis.rootfinding.RootFinding

public class RootFinding extends Object
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 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 function
      df - the derivative of f
      initialGuess - starting point
      tolerance - convergence tolerance
      maxIterations - 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 function
      a - left bracket
      b - right bracket
      tolerance - convergence tolerance
      maxIterations - 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 function
      x0 - first initial guess
      x1 - second initial guess
      tolerance - convergence tolerance
      maxIterations - maximum iterations
      Returns:
      approximate root, or null if not found
    • brent

      public static Real brent(Function<Real,Real> f, Real a, Real b, Real tolerance)
      Brent's method - combination of bisection, secant, and inverse quadratic interpolation.

      Best general-purpose root finder. Guaranteed convergence with superlinear speed.

      Parameters:
      f - the function
      a - left bracket
      b - right bracket
      tolerance - convergence tolerance
      Returns:
      approximate root