org.apache.commons.math3.analysis.solvers

## Class RegulaFalsiSolver

• All Implemented Interfaces:
BaseUnivariateSolver<UnivariateFunction>, BracketedUnivariateSolver<UnivariateFunction>, UnivariateSolver

public class RegulaFalsiSolver
extends BaseSecantSolver
Implements the Regula Falsi or False position method for root-finding (approximating a zero of a univariate real function). It is a modified Secant method.

The Regula Falsi method is included for completeness, for testing purposes, for educational purposes, for comparison to other algorithms, etc. It is however not intended to be used for actual problems, as one of the bounds often remains fixed, resulting in very slow convergence. Instead, one of the well-known modified Regula Falsi algorithms can be used (Illinois or Pegasus). These two algorithms solve the fundamental issues of the original Regula Falsi algorithm, and greatly out-performs it for most, if not all, (practical) functions.

Unlike the Secant method, the Regula Falsi guarantees convergence, by maintaining a bracketed solution. Note however, that due to the finite/limited precision of Java's double type, which is used in this implementation, the algorithm may get stuck in a situation where it no longer makes any progress. Such cases are detected and result in a ConvergenceException exception being thrown. In other words, the algorithm theoretically guarantees convergence, but the implementation does not.

The Regula Falsi method assumes that the function is continuous, but not necessarily smooth.

Implementation based on the following article: M. Dowell and P. Jarratt, A modified regula falsi method for computing the root of an equation, BIT Numerical Mathematics, volume 11, number 2, pages 168-174, Springer, 1971.

Since:
3.0

• ### Nested classes/interfaces inherited from class org.apache.commons.math3.analysis.solvers.BaseSecantSolver

BaseSecantSolver.Method

• ### Fields inherited from class org.apache.commons.math3.analysis.solvers.BaseSecantSolver

DEFAULT_ABSOLUTE_ACCURACY
• ### Constructor Summary

Constructors
Constructor and Description
RegulaFalsiSolver()
Construct a solver with default accuracy (1e-6).
RegulaFalsiSolver(double absoluteAccuracy)
Construct a solver.
RegulaFalsiSolver(double relativeAccuracy, double absoluteAccuracy)
Construct a solver.
RegulaFalsiSolver(double relativeAccuracy, double absoluteAccuracy, double functionValueAccuracy)
Construct a solver.

• ### Methods inherited from class org.apache.commons.math3.analysis.solvers.BaseSecantSolver

doSolve, solve, solve, solve
• ### Methods inherited from class org.apache.commons.math3.analysis.solvers.BaseAbstractUnivariateSolver

computeObjectiveValue, getAbsoluteAccuracy, getEvaluations, getFunctionValueAccuracy, getMax, getMaxEvaluations, getMin, getRelativeAccuracy, getStartValue, incrementEvaluationCount, isBracketing, isSequence, setup, solve, solve, verifyBracketing, verifyInterval, verifySequence
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Methods inherited from interface org.apache.commons.math3.analysis.solvers.BaseUnivariateSolver

getAbsoluteAccuracy, getEvaluations, getFunctionValueAccuracy, getMaxEvaluations, getRelativeAccuracy, solve, solve
• ### Constructor Detail

• #### RegulaFalsiSolver

public RegulaFalsiSolver()
Construct a solver with default accuracy (1e-6).
• #### RegulaFalsiSolver

public RegulaFalsiSolver(double absoluteAccuracy)
Construct a solver.
Parameters:
absoluteAccuracy - Absolute accuracy.
• #### RegulaFalsiSolver

public RegulaFalsiSolver(double relativeAccuracy,
double absoluteAccuracy)
Construct a solver.
Parameters:
relativeAccuracy - Relative accuracy.
absoluteAccuracy - Absolute accuracy.
• #### RegulaFalsiSolver

public RegulaFalsiSolver(double relativeAccuracy,
double absoluteAccuracy,
double functionValueAccuracy)
Construct a solver.
Parameters:
relativeAccuracy - Relative accuracy.
absoluteAccuracy - Absolute accuracy.
functionValueAccuracy - Maximum function value error.