Package org.hipparchus.util
Class FieldContinuedFraction
- java.lang.Object
-
- org.hipparchus.util.FieldContinuedFraction
-
public abstract class FieldContinuedFraction extends Object
Provides a generic means to evaluate continued fractions. Subclasses simply provided the a and b coefficients to evaluate the continued fraction.References:
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
FieldContinuedFraction()
Default constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <T extends CalculusFieldElement<T>>
Tevaluate(T x)
Evaluates the continued fraction at the value x.<T extends CalculusFieldElement<T>>
Tevaluate(T x, double epsilon)
Evaluates the continued fraction at the value x.<T extends CalculusFieldElement<T>>
Tevaluate(T x, double epsilon, int maxIterations)
Evaluates the continued fraction at the value x.<T extends CalculusFieldElement<T>>
Tevaluate(T x, int maxIterations)
Evaluates the continued fraction at the value x.abstract <T extends CalculusFieldElement<T>>
TgetA(int n, T x)
Access the n-th a coefficient of the continued fraction.abstract <T extends CalculusFieldElement<T>>
TgetB(int n, T x)
Access the n-th b coefficient of the continued fraction.
-
-
-
Method Detail
-
getA
public abstract <T extends CalculusFieldElement<T>> T getA(int n, T x)
Access the n-th a coefficient of the continued fraction. Since a can be a function of the evaluation point, x, that is passed in as well.- Type Parameters:
T
- type of the field elements.- Parameters:
n
- the coefficient index to retrieve.x
- the evaluation point.- Returns:
- the n-th a coefficient.
-
getB
public abstract <T extends CalculusFieldElement<T>> T getB(int n, T x)
Access the n-th b coefficient of the continued fraction. Since b can be a function of the evaluation point, x, that is passed in as well.- Type Parameters:
T
- type of the field elements.- Parameters:
n
- the coefficient index to retrieve.x
- the evaluation point.- Returns:
- the n-th b coefficient.
-
evaluate
public <T extends CalculusFieldElement<T>> T evaluate(T x) throws MathIllegalStateException
Evaluates the continued fraction at the value x.- Type Parameters:
T
- type of the field elements.- Parameters:
x
- the evaluation point.- Returns:
- the value of the continued fraction evaluated at x.
- Throws:
MathIllegalStateException
- if the algorithm fails to converge.
-
evaluate
public <T extends CalculusFieldElement<T>> T evaluate(T x, double epsilon) throws MathIllegalStateException
Evaluates the continued fraction at the value x.- Type Parameters:
T
- type of the field elements.- Parameters:
x
- the evaluation point.epsilon
- maximum error allowed.- Returns:
- the value of the continued fraction evaluated at x.
- Throws:
MathIllegalStateException
- if the algorithm fails to converge.
-
evaluate
public <T extends CalculusFieldElement<T>> T evaluate(T x, int maxIterations) throws MathIllegalStateException
Evaluates the continued fraction at the value x.- Type Parameters:
T
- type of the field elements.- Parameters:
x
- the evaluation point.maxIterations
- maximum number of convergents- Returns:
- the value of the continued fraction evaluated at x.
- Throws:
MathIllegalStateException
- if the algorithm fails to converge.MathIllegalStateException
- if maximal number of iterations is reached
-
evaluate
public <T extends CalculusFieldElement<T>> T evaluate(T x, double epsilon, int maxIterations) throws MathIllegalStateException
Evaluates the continued fraction at the value x.The implementation of this method is based on the modified Lentz algorithm as described on page 18 ff. in:
- I. J. Thompson, A. R. Barnett. "Coulomb and Bessel Functions of Complex Arguments and Order." http://www.fresco.org.uk/papers/Thompson-JCP64p490.pdf
Note: the implementation uses the terms ai and bi as defined in Continued Fraction @ MathWorld.
- Type Parameters:
T
- type of the field elements.- Parameters:
x
- the evaluation point.epsilon
- maximum error allowed.maxIterations
- maximum number of convergents- Returns:
- the value of the continued fraction evaluated at x.
- Throws:
MathIllegalStateException
- if the algorithm fails to converge.MathIllegalStateException
- if maximal number of iterations is reached
-
-