Class ContinuedFraction


  • public abstract class ContinuedFraction
    extends Object
    Provides a generic means to evaluate continued fractions. Subclasses simply provided the a and b coefficients to evaluate the continued fraction.

    References:

    • Method Detail

      • evaluate

        public double evaluate​(double x)
                        throws MathException
        Evaluates the continued fraction at the value x.
        Parameters:
        x - the evaluation point.
        Returns:
        the value of the continued fraction evaluated at x.
        Throws:
        MathException - if the algorithm fails to converge.
      • evaluate

        public double evaluate​(double x,
                               double epsilon)
                        throws MathException
        Evaluates the continued fraction at the value x.
        Parameters:
        x - the evaluation point.
        epsilon - maximum error allowed.
        Returns:
        the value of the continued fraction evaluated at x.
        Throws:
        MathException - if the algorithm fails to converge.
      • evaluate

        public double evaluate​(double x,
                               int maxIterations)
                        throws MathException
        Evaluates the continued fraction at the value x.
        Parameters:
        x - the evaluation point.
        maxIterations - maximum number of convergents
        Returns:
        the value of the continued fraction evaluated at x.
        Throws:
        MathException - if the algorithm fails to converge.
      • evaluate

        public double evaluate​(double x,
                               double epsilon,
                               int maxIterations)
                        throws MathException

        Evaluates the continued fraction at the value x.

        The implementation of this method is based on equations 14-17 of:

        The recurrence relationship defined in those equations can result in very large intermediate results which can result in numerical overflow. As a means to combat these overflow conditions, the intermediate results are scaled whenever they threaten to become numerically unstable.

        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:
        MathException - if the algorithm fails to converge.