public abstract class PowerSeries extends IterativeMethod
This class provides the means to evaluate infinite power series (1). To create a power series, authors subclass this class and provided a concrete term method.
For example, this is the power series for the exponential function defined by (2):
PowerSeries exponential = new PowerSeries() {
public double getTerm(int n) {
return 1.0 / factorial(n);
}
private double factorial(int n) {
double p = 1.0;
while(n > 1.0) {
p *= n--;
}
return p;
}
}
References:
IterativeMethod.IterativeState| Modifier and Type | Method and Description |
|---|---|
double |
evaluate(double x)
Evaluate this series at the given value.
|
getMaximumIterations, getMaximumRelativeError, iterate, setMaximumIterations, setMaximumRelativeErrorpublic double evaluate(double x)
throws NumericException
x - the point of evalutation.NumericException - if the series could not be evaluated.DMelt 2.0 © DataMelt by jWork.ORG