Top Description Methods
org.apache.commons.math3.analysis.solvers

public Interface BaseUnivariateSolver<FUNC extends UnivariateFunction>

Known Direct Subinterfaces
org.apache.commons.math3.analysis.solvers.BracketedUnivariateSolver, org.apache.commons.math3.analysis.solvers.DifferentiableUnivariateSolver, org.apache.commons.math3.analysis.solvers.PolynomialSolver, org.apache.commons.math3.analysis.solvers.UnivariateDifferentiableSolver, org.apache.commons.math3.analysis.solvers.UnivariateSolver
Known Direct Implementers
org.apache.commons.math3.analysis.solvers.BaseAbstractUnivariateSolver
Type Parameters
<FUNC>
Type of function to solve.
Imports
org.apache.commons.math3.analysis.UnivariateFunction, org.apache.commons.math3.exception.MathIllegalArgumentException, .TooManyEvaluationsException

Interface for (univariate real) rootfinding algorithms. Implementations will search for only one zero in the given interval. This class is not intended for use outside of the Apache Commons Math library, regular user should rely on more specific interfaces like UnivariateSolver, PolynomialSolver or DifferentiableUnivariateSolver.
Since
3.0
See Also
UnivariateSolver, PolynomialSolver, DifferentiableUnivariateSolver

Method Summary

Modifier and TypeMethod and Description
public double

Returns:

the absolute accuracy.
getAbsoluteAccuracy
()

Get the absolute accuracy of the solver.

public int

Returns:

the number of evaluations of the objective function.
getEvaluations
()

Get the number of evaluations of the objective function.

public double

Returns:

the function value accuracy.
getFunctionValueAccuracy
()

Get the function value accuracy of the solver.

public int

Returns:

the maximum number of function evaluations.
getMaxEvaluations
()

Get the maximum number of function evaluations.

public double

Returns:

the relative accuracy.
getRelativeAccuracy
()

Get the relative accuracy of the solver.

public double

Returns:

a value where the function is zero.
solve
(int
Maximum number of evaluations.
maxEval
,
FUNC
Function to solve.
f
,
double
Lower bound for the interval.
min
,
double
Upper bound for the interval.
max
)

Solve for a zero root in the given interval.

public double

Returns:

a value where the function is zero.
solve
(int
Maximum number of evaluations.
maxEval
,
FUNC
Function to solve.
f
,
double
Lower bound for the interval.
min
,
double
Upper bound for the interval.
max
,
double
Start value to use.
startValue
)

Solve for a zero in the given interval, start at startValue.

public double

Returns:

a value where the function is zero.
solve
(int
Maximum number of evaluations.
maxEval
,
FUNC
Function to solve.
f
,
double
Start value to use.
startValue
)

Solve for a zero in the vicinity of startValue.

Method Detail

getAbsoluteAccuracyback to summary
public double getAbsoluteAccuracy()

Get the absolute accuracy of the solver. Solutions returned by the solver should be accurate to this tolerance, i.e., if ε is the absolute accuracy of the solver and v is a value returned by one of the solve methods, then a root of the function should exist somewhere in the interval (v - ε, v + ε).

Returns:double

the absolute accuracy.

getEvaluationsback to summary
public int getEvaluations()

Get the number of evaluations of the objective function. The number of evaluations corresponds to the last call to the optimize method. It is 0 if the method has not been called yet.

Returns:int

the number of evaluations of the objective function.

getFunctionValueAccuracyback to summary
public double getFunctionValueAccuracy()

Get the function value accuracy of the solver. If v is a value returned by the solver for a function f, then by contract, |f(v)| should be less than or equal to the function value accuracy configured for the solver.

Returns:double

the function value accuracy.

getMaxEvaluationsback to summary
public int getMaxEvaluations()

Get the maximum number of function evaluations.

Returns:int

the maximum number of function evaluations.

getRelativeAccuracyback to summary
public double getRelativeAccuracy()

Get the relative accuracy of the solver. The contract for relative accuracy is the same as getAbsoluteAccuracy(), but using relative, rather than absolute error. If ρ is the relative accuracy configured for a solver and v is a value returned, then a root of the function should exist somewhere in the interval (v - ρ v, v + ρ v).

Returns:double

the relative accuracy.

solveback to summary
public double solve(int maxEval, FUNC f, double min, double max) throws MathIllegalArgumentException, TooManyEvaluationsException

Solve for a zero root in the given interval. A solver may require that the interval brackets a single zero root. Solvers that do require bracketing should be able to handle the case where one of the endpoints is itself a root.

Parameters
maxEval:int

Maximum number of evaluations.

f:FUNC

Function to solve.

min:double

Lower bound for the interval.

max:double

Upper bound for the interval.

Returns:double

a value where the function is zero.

Exceptions
MathIllegalArgumentException:
if the arguments do not satisfy the requirements specified by the solver.
TooManyEvaluationsException:
if the allowed number of evaluations is exceeded.
solveback to summary
public double solve(int maxEval, FUNC f, double min, double max, double startValue) throws MathIllegalArgumentException, TooManyEvaluationsException

Solve for a zero in the given interval, start at startValue. A solver may require that the interval brackets a single zero root. Solvers that do require bracketing should be able to handle the case where one of the endpoints is itself a root.

Parameters
maxEval:int

Maximum number of evaluations.

f:FUNC

Function to solve.

min:double

Lower bound for the interval.

max:double

Upper bound for the interval.

startValue:double

Start value to use.

Returns:double

a value where the function is zero.

Exceptions
MathIllegalArgumentException:
if the arguments do not satisfy the requirements specified by the solver.
TooManyEvaluationsException:
if the allowed number of evaluations is exceeded.
solveback to summary
public double solve(int maxEval, FUNC f, double startValue)

Solve for a zero in the vicinity of startValue.

Parameters
maxEval:int

Maximum number of evaluations.

f:FUNC

Function to solve.

startValue:double

Start value to use.

Returns:double

a value where the function is zero.

Exceptions
MathIllegalArgumentException:
if the arguments do not satisfy the requirements specified by the solver.
TooManyEvaluationsException:
if the allowed number of evaluations is exceeded.