You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2017/07/03 14:24:38 UTC

[4/5] commons-numbers git commit: Javadoc.

Javadoc.


Project: http://git-wip-us.apache.org/repos/asf/commons-numbers/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-numbers/commit/9c04d444
Tree: http://git-wip-us.apache.org/repos/asf/commons-numbers/tree/9c04d444
Diff: http://git-wip-us.apache.org/repos/asf/commons-numbers/diff/9c04d444

Branch: refs/heads/master
Commit: 9c04d444c3338196412f5583a7da1035bd741472
Parents: bc83d14
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
Authored: Mon Jul 3 16:21:57 2017 +0200
Committer: Gilles Sadowski <gi...@harfang.homelinux.org>
Committed: Mon Jul 3 16:21:57 2017 +0200

----------------------------------------------------------------------
 .../numbers/fraction/ContinuedFraction.java     | 58 ++++++++++++--------
 1 file changed, 34 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/9c04d444/commons-numbers-fraction/src/main/java/org/apache/commons/numbers/fraction/ContinuedFraction.java
----------------------------------------------------------------------
diff --git a/commons-numbers-fraction/src/main/java/org/apache/commons/numbers/fraction/ContinuedFraction.java b/commons-numbers-fraction/src/main/java/org/apache/commons/numbers/fraction/ContinuedFraction.java
index 5c5648d..155c700 100644
--- a/commons-numbers-fraction/src/main/java/org/apache/commons/numbers/fraction/ContinuedFraction.java
+++ b/commons-numbers-fraction/src/main/java/org/apache/commons/numbers/fraction/ContinuedFraction.java
@@ -29,39 +29,51 @@ public abstract class ContinuedFraction {
     private static final double DEFAULT_EPSILON = 10e-9;
 
     /**
-     * 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.
-     * @param n the coefficient index to retrieve.
-     * @param x the evaluation point.
-     * @return the n-th a coefficient.
+     * Defines the <a href="http://mathworld.wolfram.com/ContinuedFraction.html">
+     * {@code n}-th "a" coefficient</a> of the continued fraction.
+     *
+     * @param n Index of the coefficient to retrieve.
+     * @param x Evaluation point.
+     * @return the coefficient <code>a<sub>n</sub></code>.
      */
     protected abstract double getA(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.
-     * @param n the coefficient index to retrieve.
-     * @param x the evaluation point.
-     * @return the n-th b coefficient.
+     * Defines the <a href="http://mathworld.wolfram.com/ContinuedFraction.html">
+     * {@code n}-th "b" coefficient</a> of the continued fraction.
+     *
+     * @param n Index of the coefficient to retrieve.
+     * @param x Evaluation point.
+     * @return the coefficient <code>b<sub>n</sub></code>.
      */
     protected abstract double getB(int n, double x);
 
     /**
-     * Evaluates the continued fraction at the value x.
-     * @param x the evaluation point.
-     * @return the value of the continued fraction evaluated at x.
+     * Evaluates the continued fraction.
+     *
+     * @param x Point at which to evaluate the continued fraction.
+     * @return the value of the continued fraction evaluated at {@code x}.
      * @throws ArithmeticException if the algorithm fails to converge.
+     * @throws ArithmeticException if the maximal number of iterations is reached
+     * before the expected convergence is achieved.
+     *
+     * @see #evaluate(double,double,int)
      */
     public double evaluate(double x) {
         return evaluate(x, DEFAULT_EPSILON, Integer.MAX_VALUE);
     }
 
     /**
-     * Evaluates the continued fraction at the value x.
+     * Evaluates the continued fraction.
+     *
      * @param x the evaluation point.
-     * @param epsilon maximum error allowed.
-     * @return the value of the continued fraction evaluated at x.
+     * @param epsilon Maximum error allowed.
+     * @return the value of the continued fraction evaluated at {@code x}.
      * @throws ArithmeticException if the algorithm fails to converge.
+     * @throws ArithmeticException if the maximal number of iterations is reached
+     * before the expected convergence is achieved.
+     *
+     * @see #evaluate(double,double,int)
      */
     public double evaluate(double x, double epsilon) {
         return evaluate(x, epsilon, Integer.MAX_VALUE);
@@ -70,10 +82,13 @@ public abstract class ContinuedFraction {
     /**
      * Evaluates the continued fraction at the value x.
      * @param x the evaluation point.
-     * @param maxIterations maximum number of convergents
-     * @return the value of the continued fraction evaluated at x.
+     * @param maxIterations Maximum number of iterations.
+     * @return the value of the continued fraction evaluated at {@code x}.
      * @throws ArithmeticException if the algorithm fails to converge.
-     * @throws ArithmeticException if maximal number of iterations is reached
+     * @throws ArithmeticException if the maximal number of iterations is reached
+     * before the expected convergence is achieved.
+     *
+     * @see #evaluate(double,double,int)
      */
     public double evaluate(double x, int maxIterations) {
         return evaluate(x, DEFAULT_EPSILON, maxIterations);
@@ -94,11 +109,6 @@ public abstract class ContinuedFraction {
      *   </li>
      * </ul>
      *
-     * <p>
-     * <b>Note:</b> the implementation uses the terms a<sub>i</sub> and b<sub>i</sub> as defined in
-     * <a href="http://mathworld.wolfram.com/ContinuedFraction.html">Continued Fraction @ MathWorld</a>.
-     * </p>
-     *
      * @param x Point at which to evaluate the continued fraction.
      * @param epsilon Maximum error allowed.
      * @param maxIterations Maximum number of iterations.