You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ps...@apache.org on 2015/12/28 16:29:37 UTC
[3/3] [math] Javadoc fixes.
Javadoc fixes.
Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/7b62d015
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/7b62d015
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/7b62d015
Branch: refs/heads/master
Commit: 7b62d0155efebb2748918a5e4f67ac0ee2e759da
Parents: 85a4fdd
Author: Phil Steitz <ph...@gmail.com>
Authored: Mon Dec 28 08:29:28 2015 -0700
Committer: Phil Steitz <ph...@gmail.com>
Committed: Mon Dec 28 08:29:28 2015 -0700
----------------------------------------------------------------------
.../gauss/LegendreHighPrecisionRuleFactory.java | 2 +-
.../interpolation/LoessInterpolator.java | 26 ++---
.../interpolation/SplineInterpolator.java | 2 +-
.../polynomials/PolynomialFunction.java | 10 +-
.../polynomials/PolynomialSplineFunction.java | 4 +-
.../analysis/polynomials/PolynomialsUtils.java | 100 +++++++++----------
6 files changed, 71 insertions(+), 73 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-math/blob/7b62d015/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java
index 81e6727..e4108a2 100644
--- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java
+++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java
@@ -27,7 +27,7 @@ import org.apache.commons.math4.util.Pair;
* In this implementation, the lower and upper bounds of the natural interval
* of integration are -1 and 1, respectively.
* The Legendre polynomials are evaluated using the recurrence relation
- * presented in <a href="http://en.wikipedia.org/wiki/Abramowitz_and_Stegun"
+ * presented in <a href="http://en.wikipedia.org/wiki/Abramowitz_and_Stegun">
* Abramowitz and Stegun, 1964</a>.
*
* @since 3.1
http://git-wip-us.apache.org/repos/asf/commons-math/blob/7b62d015/src/main/java/org/apache/commons/math4/analysis/interpolation/LoessInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/LoessInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/LoessInterpolator.java
index f256c17..1209df5 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/LoessInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/LoessInterpolator.java
@@ -36,14 +36,14 @@ import org.apache.commons.math4.util.MathUtils;
* Implements the <a href="http://en.wikipedia.org/wiki/Local_regression">
* Local Regression Algorithm</a> (also Loess, Lowess) for interpolation of
* real univariate functions.
- * <p/>
+ * <p>
* For reference, see
- * <a href="http://www.math.tau.ac.il/~yekutiel/MA seminar/Cleveland 1979.pdf">
+ * <a href="http://amstat.tandfonline.com/doi/abs/10.1080/01621459.1979.10481038">
* William S. Cleveland - Robust Locally Weighted Regression and Smoothing
- * Scatterplots</a>
- * <p/>
+ * Scatterplots</a></p>
+ * <p>
* This class implements both the loess method and serves as an interpolation
- * adapter to it, allowing one to build a spline on the obtained loess fit.
+ * adapter to it, allowing one to build a spline on the obtained loess fit.</p>
*
* @since 2.0
*/
@@ -65,16 +65,16 @@ public class LoessInterpolator
* a particular point, this fraction of source points closest
* to the current point is taken into account for computing
* a least-squares regression.
- * <p/>
- * A sensible value is usually 0.25 to 0.5.
+ * <p>
+ * A sensible value is usually 0.25 to 0.5.</p>
*/
private final double bandwidth;
/**
* The number of robustness iterations parameter: this many
* robustness iterations are done.
- * <p/>
+ * <p>
* A sensible value is usually 0 (just the initial fit without any
- * robustness iterations) to 4.
+ * robustness iterations) to 4.</p>
*/
private final int robustnessIters;
/**
@@ -109,10 +109,10 @@ public class LoessInterpolator
* @param bandwidth when computing the loess fit at
* a particular point, this fraction of source points closest
* to the current point is taken into account for computing
- * a least-squares regression.</br>
+ * a least-squares regression.
* A sensible value is usually 0.25 to 0.5, the default value is
* {@link #DEFAULT_BANDWIDTH}.
- * @param robustnessIters This many robustness iterations are done.</br>
+ * @param robustnessIters This many robustness iterations are done.
* A sensible value is usually 0 (just the initial fit without any
* robustness iterations) to 4, the default value is
* {@link #DEFAULT_ROBUSTNESS_ITERS}.
@@ -130,10 +130,10 @@ public class LoessInterpolator
* @param bandwidth when computing the loess fit at
* a particular point, this fraction of source points closest
* to the current point is taken into account for computing
- * a least-squares regression.</br>
+ * a least-squares regression.
* A sensible value is usually 0.25 to 0.5, the default value is
* {@link #DEFAULT_BANDWIDTH}.
- * @param robustnessIters This many robustness iterations are done.</br>
+ * @param robustnessIters This many robustness iterations are done.
* A sensible value is usually 0 (just the initial fit without any
* robustness iterations) to 4, the default value is
* {@link #DEFAULT_ROBUSTNESS_ITERS}.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/7b62d015/src/main/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolator.java
index 99d725c..8de5532 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolator.java
@@ -29,7 +29,7 @@ import org.apache.commons.math4.util.MathArrays;
* <p>
* The {@link #interpolate(double[], double[])} method returns a {@link PolynomialSplineFunction}
* consisting of n cubic polynomials, defined over the subintervals determined by the x values,
- * x[0] < x[i] ... < x[n]. The x values are referred to as "knot points."</p>
+ * @code{x[0] < x[i] ... < x[n].} The x values are referred to as "knot points."</p>
* <p>
* The value of the PolynomialSplineFunction at a point x that is greater than or equal to the smallest
* knot point and strictly less than the largest knot point is computed by finding the subinterval to which
http://git-wip-us.apache.org/repos/asf/commons-math/blob/7b62d015/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunction.java b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunction.java
index 9d40a1b..9333c1e 100644
--- a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunction.java
@@ -79,8 +79,8 @@ public class PolynomialFunction implements UnivariateDifferentiableFunction, Ser
/**
* Compute the value of the function for the given argument.
* <p>
- * The value returned is <br/>
- * <code>coefficients[n] * x^n + ... + coefficients[1] * x + coefficients[0]</code>
+ * The value returned is </p><p>
+ * {@code coefficients[n] * x^n + ... + coefficients[1] * x + coefficients[0]}
* </p>
*
* @param x Argument for which the function value should be computed.
@@ -189,7 +189,7 @@ public class PolynomialFunction implements UnivariateDifferentiableFunction, Ser
* Subtract a polynomial from the instance.
*
* @param p Polynomial to subtract.
- * @return a new polynomial which is the difference the instance minus {@code p}.
+ * @return a new polynomial which is the instance minus {@code p}.
*/
public PolynomialFunction subtract(final PolynomialFunction p) {
// identify the lowest degree polynomial
@@ -216,7 +216,7 @@ public class PolynomialFunction implements UnivariateDifferentiableFunction, Ser
/**
* Negate the instance.
*
- * @return a new polynomial.
+ * @return a new polynomial with all coefficients negated
*/
public PolynomialFunction negate() {
double[] newCoefficients = new double[coefficients.length];
@@ -230,7 +230,7 @@ public class PolynomialFunction implements UnivariateDifferentiableFunction, Ser
* Multiply the instance by a polynomial.
*
* @param p Polynomial to multiply by.
- * @return a new polynomial.
+ * @return a new polynomial equal to this times {@code p}
*/
public PolynomialFunction multiply(final PolynomialFunction p) {
double[] newCoefficients = new double[coefficients.length + p.coefficients.length - 1];
http://git-wip-us.apache.org/repos/asf/commons-math/blob/7b62d015/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunction.java b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunction.java
index afa7eef..b842a40 100644
--- a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunction.java
@@ -57,8 +57,8 @@ import org.apache.commons.math4.util.MathArrays;
* than the largest one, an <code>IllegalArgumentException</code>
* is thrown.</li>
* <li> Let <code>j</code> be the index of the largest knot point that is less
- * than or equal to <code>x</code>. The value returned is <br>
- * <code>polynomials[j](x - knot[j])</code></li></ol></p>
+ * than or equal to <code>x</code>. The value returned is
+ * {@code polynomials[j](x - knot[j])}</li></ol>
*
*/
public class PolynomialSplineFunction implements UnivariateDifferentiableFunction {
http://git-wip-us.apache.org/repos/asf/commons-math/blob/7b62d015/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtils.java b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtils.java
index 346644e..c406979 100644
--- a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtils.java
+++ b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtils.java
@@ -90,14 +90,15 @@ public class PolynomialsUtils {
/**
* Create a Chebyshev polynomial of the first kind.
- * <p><a href="http://mathworld.wolfram.com/ChebyshevPolynomialoftheFirstKind.html">Chebyshev
+ * <p><a href="https://en.wikipedia.org/wiki/Chebyshev_polynomials">Chebyshev
* polynomials of the first kind</a> are orthogonal polynomials.
- * They can be defined by the following recurrence relations:
- * <pre>
- * T<sub>0</sub>(X) = 1
- * T<sub>1</sub>(X) = X
- * T<sub>k+1</sub>(X) = 2X T<sub>k</sub>(X) - T<sub>k-1</sub>(X)
- * </pre></p>
+ * They can be defined by the following recurrence relations:</p><p>
+ * \(
+ * T_0(x) = 1 \\
+ * T_1(x) = x \\
+ * T_{k+1}(x) = 2x T_k(x) - T_{k-1}(x)
+ * \)
+ * </p>
* @param degree degree of the polynomial
* @return Chebyshev polynomial of specified degree
*/
@@ -118,12 +119,13 @@ public class PolynomialsUtils {
* Create a Hermite polynomial.
* <p><a href="http://mathworld.wolfram.com/HermitePolynomial.html">Hermite
* polynomials</a> are orthogonal polynomials.
- * They can be defined by the following recurrence relations:
- * <pre>
- * H<sub>0</sub>(X) = 1
- * H<sub>1</sub>(X) = 2X
- * H<sub>k+1</sub>(X) = 2X H<sub>k</sub>(X) - 2k H<sub>k-1</sub>(X)
- * </pre></p>
+ * They can be defined by the following recurrence relations:</p><p>
+ * \(
+ * H_0(x) = 1 \\
+ * H_1(x) = 2x \\
+ * H_{k+1}(x) = 2x H_k(X) - 2k H_{k-1}(x)
+ * \)
+ * </p>
* @param degree degree of the polynomial
* @return Hermite polynomial of specified degree
@@ -146,12 +148,13 @@ public class PolynomialsUtils {
* Create a Laguerre polynomial.
* <p><a href="http://mathworld.wolfram.com/LaguerrePolynomial.html">Laguerre
* polynomials</a> are orthogonal polynomials.
- * They can be defined by the following recurrence relations:
- * <pre>
- * L<sub>0</sub>(X) = 1
- * L<sub>1</sub>(X) = 1 - X
- * (k+1) L<sub>k+1</sub>(X) = (2k + 1 - X) L<sub>k</sub>(X) - k L<sub>k-1</sub>(X)
- * </pre></p>
+ * They can be defined by the following recurrence relations:</p><p>
+ * \(
+ * L_0(x) = 1 \\
+ * L_1(x) = 1 - x \\
+ * (k+1) L_{k+1}(x) = (2k + 1 - x) L_k(x) - k L_{k-1}(x)
+ * \)
+ * </p>
* @param degree degree of the polynomial
* @return Laguerre polynomial of specified degree
*/
@@ -174,12 +177,13 @@ public class PolynomialsUtils {
* Create a Legendre polynomial.
* <p><a href="http://mathworld.wolfram.com/LegendrePolynomial.html">Legendre
* polynomials</a> are orthogonal polynomials.
- * They can be defined by the following recurrence relations:
- * <pre>
- * P<sub>0</sub>(X) = 1
- * P<sub>1</sub>(X) = X
- * (k+1) P<sub>k+1</sub>(X) = (2k+1) X P<sub>k</sub>(X) - k P<sub>k-1</sub>(X)
- * </pre></p>
+ * They can be defined by the following recurrence relations:</p><p>
+ * \(
+ * P_0(x) = 1 \\
+ * P_1(x) = x \\
+ * (k+1) P_{k+1}(x) = (2k+1) x P_k(x) - k P_{k-1}(x)
+ * \)
+ * </p>
* @param degree degree of the polynomial
* @return Legendre polynomial of specified degree
*/
@@ -202,14 +206,15 @@ public class PolynomialsUtils {
* Create a Jacobi polynomial.
* <p><a href="http://mathworld.wolfram.com/JacobiPolynomial.html">Jacobi
* polynomials</a> are orthogonal polynomials.
- * They can be defined by the following recurrence relations:
- * <pre>
- * P<sub>0</sub><sup>vw</sup>(X) = 1
- * P<sub>-1</sub><sup>vw</sup>(X) = 0
- * 2k(k + v + w)(2k + v + w - 2) P<sub>k</sub><sup>vw</sup>(X) =
- * (2k + v + w - 1)[(2k + v + w)(2k + v + w - 2) X + v<sup>2</sup> - w<sup>2</sup>] P<sub>k-1</sub><sup>vw</sup>(X)
- * - 2(k + v - 1)(k + w - 1)(2k + v + w) P<sub>k-2</sub><sup>vw</sup>(X)
- * </pre></p>
+ * They can be defined by the following recurrence relations:</p><p>
+ * \(
+ * P_0^{vw}(x) = 1 \\
+ * P_{-1}^{vw}(x) = 0 \\
+ * 2k(k + v + w)(2k + v + w - 2) P_k^{vw}(x) = \\
+ * (2k + v + w - 1)[(2k + v + w)(2k + v + w - 2) x + v^2 - w^2] P_{k-1}^{vw}(x) \\
+ * - 2(k + v - 1)(k + w - 1)(2k + v + w) P_{k-2}^{vw}(x)
+ * \)
+ * </p>
* @param degree degree of the polynomial
* @param v first exponent
* @param w second exponent
@@ -301,27 +306,20 @@ public class PolynomialsUtils {
}
/**
- * Compute the coefficients of the polynomial <code>P<sub>s</sub>(x)</code>
+ * Compute the coefficients of the polynomial \(P_s(x)\)
* whose values at point {@code x} will be the same as the those from the
- * original polynomial <code>P(x)</code> when computed at {@code x + shift}.
- * Thus, if <code>P(x) = Σ<sub>i</sub> a<sub>i</sub> x<sup>i</sup></code>,
- * then
- * <pre>
- * <table>
- * <tr>
- * <td><code>P<sub>s</sub>(x)</td>
- * <td>= Σ<sub>i</sub> b<sub>i</sub> x<sup>i</sup></code></td>
- * </tr>
- * <tr>
- * <td></td>
- * <td>= Σ<sub>i</sub> a<sub>i</sub> (x + shift)<sup>i</sup></code></td>
- * </tr>
- * </table>
- * </pre>
+ * original polynomial \(P(x)\) when computed at {@code x + shift}.
+ * <p>
+ * More precisely, let \(\Delta = \) {@code shift} and let
+ * \(P_s(x) = P(x + \Delta)\). The returned array
+ * consists of the coefficients of \(P_s\). So if \(a_0, ..., a_{n-1}\)
+ * are the coefficients of \(P\), then the returned array
+ * \(b_0, ..., b_{n-1}\) satisfies the identity
+ * \(\sum_{i=0}^{n-1} b_i x^i = \sum_{i=0}^{n-1} a_i (x + \Delta)^i\) for all \(x\).
*
* @param coefficients Coefficients of the original polynomial.
* @param shift Shift value.
- * @return the coefficients <code>b<sub>i</sub></code> of the shifted
+ * @return the coefficients \(b_i\) of the shifted
* polynomial.
*/
public static double[] shift(final double[] coefficients,
@@ -444,7 +442,7 @@ public class PolynomialsUtils {
* Generate recurrence coefficients.
* @param k highest degree of the polynomials used in the recurrence
* @return an array of three coefficients such that
- * P<sub>k+1</sub>(X) = (a[0] + a[1] X) P<sub>k</sub>(X) - a[2] P<sub>k-1</sub>(X)
+ * \( P_{k+1}(x) = (a[0] + a[1] x) P_k(x) - a[2] P_{k-1}(x) \)
*/
BigFraction[] generate(int k);
}