jsat.math
Class ContinuedFraction
- java.lang.Object
-
- jsat.math.ContinuedFraction
-
public abstract class ContinuedFraction extends java.lang.ObjectThis class provides a means to represent and evaluate continued fractions in a multitude of ways.
-
-
Constructor Summary
Constructors Constructor and Description ContinuedFraction()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description doublebackwardNaive(int n, double... args)Approximates the continued fraction using a naive approximationabstract doublegetA(int pos, double... args)The a term of a continued fraction is the value that occurs as one of the numerators, an its depth starts at 1.abstract doublegetB(int pos, double... args)The b term of a continued fraction is the value that is added to the continuing fraction, its depth starts at 0.doublelentz(double... args)Uses Thompson and Barnett's modified Lentz's algorithm create an approximation that should be accurate to full precision.
-
-
-
Method Detail
-
getA
public abstract double getA(int pos, double... args)The a term of a continued fraction is the value that occurs as one of the numerators, an its depth starts at 1.- Parameters:
pos- the depth of the continued fraction to evaluate atargs- the values for the variables of the continued fraction- Returns:
- the value that would be computed for the a coefficient at the specified depth of the fraction
-
getB
public abstract double getB(int pos, double... args)The b term of a continued fraction is the value that is added to the continuing fraction, its depth starts at 0.- Parameters:
pos- the depth of the continued fraction to evaluate atargs- the values for the variables of the continued fraction- Returns:
- the value that would be computed for the b coefficient at the specified depth of the fraction
-
backwardNaive
public double backwardNaive(int n, double... args)Approximates the continued fraction using a naive approximation- Parameters:
n- the number of iterations to performargs- the values to input for the variables of the continued fraction- Returns:
- an approximation of the value of the continued fraciton
-
lentz
public double lentz(double... args)
Uses Thompson and Barnett's modified Lentz's algorithm create an approximation that should be accurate to full precision.- Parameters:
args- the numeric inputs to the continued fraction- Returns:
- the approximate value of the continued fraction
-
-
DataMelt 3.0 © DataMelt by jWork.ORG