Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.math.util
Class ContinuedFraction

    java.lang.Object
      org.apache.commons.math.util.ContinuedFraction

All Implemented Interfaces:
  Serializable

public abstract class ContinuedFraction
extends Object
implements Serializable

Provides a generic means to evaluate continued fractions. Subclasses simply provided the a and b coefficients to evaluate the continued fraction.

References:

- Continued Fraction

Version:
  $Revision: 1.14 $ $Date: 2004/06/23 16:26:16 $
See Also:
  Serialized Form

Field Summary
`(package private) static long` | `serialVersionUID` Serialization UID

Constructor Summary
`protected` | `ContinuedFraction()` Default constructor.

Method Summary
`double` | `evaluate(double x)` Evaluates the continued fraction at the value x.
`double` | `evaluate(double x, double epsilon)` Evaluates the continued fraction at the value x.
`double` | `evaluate(double x, double epsilon, int maxIterations)` Evaluates the continued fraction at the value x.
`double` | `evaluate(double x, int maxIterations)` Evaluates the continued fraction at the value x.
`protected abstract double` | `getA(int n, double x)` Access the n-th a coefficient of the continued fraction.
`protected abstract double` | `getB(int n, double x)` Access the n-th b coefficient of the continued fraction.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### serialVersionUID

    static final long serialVersionUID

  Serialization UID

  See Also:
    Constant Field Values

Constructor Detail

### ContinuedFraction

    protected ContinuedFraction()

  Default constructor.

Method Detail

### getA

    protected abstract double getA(int n,
                                   double x)

  Access the n-th a coefficient of the continued fraction. Since a can be a function of the evaluation point, x, that is passed in as well.

  Parameters:
    `n` - the coefficient index to retrieve.
    `x` - the evaluation point.
  Returns:
    the n-th a coefficient.

### getB

    protected abstract double getB(int n,
                                   double x)

  Access the n-th b coefficient of the continued fraction. Since b can be a function of the evaluation point, x, that is passed in as well.

  Parameters:
    `n` - the coefficient index to retrieve.
    `x` - the evaluation point.
  Returns:
    the n-th b coefficient.

### 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:
  - O. E-gecio-glu, C . K. Koc, J. Rifa i Coma, On Fast Computation of Continued Fractions, Computers Math. Applic., 21(2--3), 1991, 167--169.

  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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2004 The Apache Software Foundation. All Rights Reserved.