public abstract class ContinuedFraction extends IterativeMethod
This class provides the means to evaluate continued fractions (1). To create a continued fraction, authors subclass this class and provided concrete a and b coefficient methods.
For example, this is the continued fraction for the exponential function defined by (2):
ContinuedFraction exponential = new ContinuedFraction() {
public double getA(int n, double x) {
if (n == 0) {
return 1.0;
} else if (n % 2 == 0) { // even
return 2.0;
} else { // odd
return n;
}
}
public double getB(int n, double x) {
if (n % 2 == 0) { // even
return x;
} else { // odd
return -x;
}
}
References:
| Modifier and Type | Method and Description |
|---|---|
double |
evaluate(double x)
Evaluate this continued fraction at the given value.
|
getMaximumIterations, getMaximumRelativeError, iterate, setMaximumIterations, setMaximumRelativeErrorpublic double evaluate(double x)
throws NumericException
x - the point of evalutation.NumericException - if the continued fraction could not be
evaluated.DMelt 2.0 © DataMelt by jWork.ORG