public abstract class ContinuedFraction extends Object
a and b
coefficients to evaluate the continued fraction.| Constructor and Description |
|---|
ContinuedFraction() |
| Modifier and Type | Method and Description |
|---|---|
double |
evaluate(double x)
Evaluates the continued fraction.
|
double |
evaluate(double x,
double epsilon)
Evaluates the continued fraction.
|
double |
evaluate(double x,
double epsilon,
int maxIterations)
Evaluates the continued fraction.
|
double |
evaluate(double x,
int maxIterations)
Evaluates the continued fraction at the value x.
|
protected abstract double |
getA(int n,
double x)
Defines the
n-th "a" coefficient of the continued fraction. |
protected abstract double |
getB(int n,
double x)
Defines the
n-th "b" coefficient of the continued fraction. |
protected abstract double getA(int n,
double x)
n-th "a" coefficient of the continued fraction.n - Index of the coefficient to retrieve.x - Evaluation point.an.protected abstract double getB(int n,
double x)
n-th "b" coefficient of the continued fraction.n - Index of the coefficient to retrieve.x - Evaluation point.bn.public double evaluate(double x)
x - Point at which to evaluate the continued fraction.x.ArithmeticException - if the algorithm fails to converge.ArithmeticException - if the maximal number of iterations is reached
before the expected convergence is achieved.evaluate(double,double,int)public double evaluate(double x,
double epsilon)
x - the evaluation point.epsilon - Maximum error allowed.x.ArithmeticException - if the algorithm fails to converge.ArithmeticException - if the maximal number of iterations is reached
before the expected convergence is achieved.evaluate(double,double,int)public double evaluate(double x,
int maxIterations)
x - the evaluation point.maxIterations - Maximum number of iterations.x.ArithmeticException - if the algorithm fails to converge.ArithmeticException - if the maximal number of iterations is reached
before the expected convergence is achieved.evaluate(double,double,int)public double evaluate(double x,
double epsilon,
int maxIterations)
The implementation of this method is based on the modified Lentz algorithm as described on page 18 ff. in:
x - Point at which to evaluate the continued fraction.epsilon - Maximum error allowed.maxIterations - Maximum number of iterations.x.ArithmeticException - if the algorithm fails to converge.ArithmeticException - if the maximal number of iterations is reached
before the expected convergence is achieved.Copyright © 2017–2018 The Apache Software Foundation. All rights reserved.