diff --git a/src/main/java/org/apache/commons/math/analysis/FunctionUtils.java b/src/main/java/org/apache/commons/math/analysis/FunctionUtils.java index 1afe65872..93c518629 100644 --- a/src/main/java/org/apache/commons/math/analysis/FunctionUtils.java +++ b/src/main/java/org/apache/commons/math/analysis/FunctionUtils.java @@ -32,10 +32,12 @@ public class FunctionUtils { private FunctionUtils() {} /** - * Compose functions. + * Compose functions. The functions in the argument list are composed + * sequentially, in the order given. For example, compose(f1,f2,f3) + * acts like f1(f2(f3(x))). * * @param f List of functions. - * @return the composed function. + * @return the composite function. */ public static UnivariateRealFunction compose(final UnivariateRealFunction ... f) { return new UnivariateRealFunction() { @@ -54,7 +56,7 @@ public class FunctionUtils { * Add functions. * * @param f List of functions. - * @return a function that computes the addition of the functions. + * @return a function that computes the sum of the functions. */ public static UnivariateRealFunction add(final UnivariateRealFunction ... f) { return new UnivariateRealFunction() { @@ -73,7 +75,7 @@ public class FunctionUtils { * Multiply functions. * * @param f List of functions. - * @return a function that computes the multiplication of the functions. + * @return a function that computes the product of the functions. */ public static UnivariateRealFunction multiply(final UnivariateRealFunction ... f) { return new UnivariateRealFunction() { @@ -89,12 +91,13 @@ public class FunctionUtils { } /** - * Combine functions. + * Returns the univariate function
+ * {@code h(x) = combiner(f(x), g(x))}. * * @param combiner Combiner function. * @param f Function. * @param g Function. - * @return the composed function. + * @return the composite function. */ public static UnivariateRealFunction combine(final BivariateRealFunction combiner, final UnivariateRealFunction f, @@ -108,7 +111,9 @@ public class FunctionUtils { } /** - * Generate a collector function. + * Returns a MultivariateRealFunction h(x[]) defined by
 
+     * h(x[]) = combiner(...combiner(combiner(initialValue,f(x[0])),f(x[1]))...),f(x[x.length-1]))
+     * 
* * @param combiner Combiner function. * @param f Function. @@ -131,7 +136,9 @@ public class FunctionUtils { } /** - * Generate a collector function. + * Returns a MultivariateRealFunction h(x[]) defined by
 
+     * h(x[]) = combiner(...combiner(combiner(initialValue,x[0]),x[1])...),x[x.length-1])
+     * 
* * @param combiner Combiner function. * @param initialValue Initial value. @@ -147,7 +154,7 @@ public class FunctionUtils { * * @param f Binary function. * @param fixed Value to which the first argument of {@code f} is set. - * @return a unary function. + * @return the unary function h(x) = f(fixed, x) */ public static UnivariateRealFunction fix1stArgument(final BivariateRealFunction f, final double fixed) { @@ -163,7 +170,7 @@ public class FunctionUtils { * * @param f Binary function. * @param fixed Value to which the second argument of {@code f} is set. - * @return a unary function. + * @return the unary function h(x) = f(x, fixed) */ public static UnivariateRealFunction fix2ndArgument(final BivariateRealFunction f, final double fixed) { diff --git a/src/main/java/org/apache/commons/math/analysis/ParametricUnivariateRealFunction.java b/src/main/java/org/apache/commons/math/analysis/ParametricUnivariateRealFunction.java index edfc58333..8949de234 100644 --- a/src/main/java/org/apache/commons/math/analysis/ParametricUnivariateRealFunction.java +++ b/src/main/java/org/apache/commons/math/analysis/ParametricUnivariateRealFunction.java @@ -21,6 +21,7 @@ package org.apache.commons.math.analysis; * An interface representing a real function that depends on one independent * variable plus some extra parameters. * + * @since 3.0 * @version $Id$ */ public interface ParametricUnivariateRealFunction { diff --git a/src/main/java/org/apache/commons/math/analysis/function/Cbrt.java b/src/main/java/org/apache/commons/math/analysis/function/Cbrt.java index 6a0da05d9..f5b3c9bfe 100644 --- a/src/main/java/org/apache/commons/math/analysis/function/Cbrt.java +++ b/src/main/java/org/apache/commons/math/analysis/function/Cbrt.java @@ -21,7 +21,7 @@ import org.apache.commons.math.analysis.UnivariateRealFunction; import org.apache.commons.math.util.FastMath; /** - * Cubic-root function. + * Cube root function. * * @version $Id$ * @since 3.0 diff --git a/src/main/java/org/apache/commons/math/analysis/function/HarmonicOscillator.java b/src/main/java/org/apache/commons/math/analysis/function/HarmonicOscillator.java index 7c705c24c..38569049d 100644 --- a/src/main/java/org/apache/commons/math/analysis/function/HarmonicOscillator.java +++ b/src/main/java/org/apache/commons/math/analysis/function/HarmonicOscillator.java @@ -34,7 +34,7 @@ import org.apache.commons.math.util.FastMath; public class HarmonicOscillator implements DifferentiableUnivariateRealFunction { /** Amplitude. */ private final double amplitude; - /** Angular requency. */ + /** Angular frequency. */ private final double omega; /** Phase. */ private final double phase; diff --git a/src/main/java/org/apache/commons/math/analysis/function/Sinc.java b/src/main/java/org/apache/commons/math/analysis/function/Sinc.java index 4709ad213..a54bca87e 100644 --- a/src/main/java/org/apache/commons/math/analysis/function/Sinc.java +++ b/src/main/java/org/apache/commons/math/analysis/function/Sinc.java @@ -21,7 +21,11 @@ import org.apache.commons.math.analysis.UnivariateRealFunction; import org.apache.commons.math.util.FastMath; /** - * Sinc function. + * Sinc function, defined by

+ *
+ * sinc(x) = 1 if abs(x) < 1e-9;
+ *           sin(x) / x; otherwise
+ * 
* * @version $Id$ * @since 3.0 diff --git a/src/main/java/org/apache/commons/math/analysis/interpolation/DividedDifferenceInterpolator.java b/src/main/java/org/apache/commons/math/analysis/interpolation/DividedDifferenceInterpolator.java index b75b68ba4..303294ef2 100644 --- a/src/main/java/org/apache/commons/math/analysis/interpolation/DividedDifferenceInterpolator.java +++ b/src/main/java/org/apache/commons/math/analysis/interpolation/DividedDifferenceInterpolator.java @@ -22,7 +22,7 @@ import org.apache.commons.math.analysis.polynomials.PolynomialFunctionNewtonForm /** * Implements the + * http://mathworld.wolfram.com/NewtonsDividedDifferenceInterpolationFormula.html"> * Divided Difference Algorithm for interpolation of real univariate * functions. For reference, see Introduction to Numerical Analysis, * ISBN 038795452X, chapter 2. diff --git a/src/main/java/org/apache/commons/math/analysis/interpolation/LoessInterpolator.java b/src/main/java/org/apache/commons/math/analysis/interpolation/LoessInterpolator.java index df0fcf9f2..58303dd8c 100644 --- a/src/main/java/org/apache/commons/math/analysis/interpolation/LoessInterpolator.java +++ b/src/main/java/org/apache/commons/math/analysis/interpolation/LoessInterpolator.java @@ -40,7 +40,7 @@ import org.apache.commons.math.util.MathUtils; * Scatterplots *

* This class implements both the loess method and serves as an interpolation - * adapter to it, allowing to build a spline on the obtained loess fit. + * adapter to it, allowing one to build a spline on the obtained loess fit. * * @version $Id$ * @since 2.0 diff --git a/src/main/java/org/apache/commons/math/analysis/interpolation/NevilleInterpolator.java b/src/main/java/org/apache/commons/math/analysis/interpolation/NevilleInterpolator.java index a11390ca0..ce6f37dc1 100644 --- a/src/main/java/org/apache/commons/math/analysis/interpolation/NevilleInterpolator.java +++ b/src/main/java/org/apache/commons/math/analysis/interpolation/NevilleInterpolator.java @@ -26,7 +26,7 @@ import org.apache.commons.math.analysis.polynomials.PolynomialFunctionLagrangeFo * reference, see Introduction to Numerical Analysis, ISBN 038795452X, * chapter 2. *

- * The actual code of Neville's evalution is in PolynomialFunctionLagrangeForm, + * The actual code of Neville's algorithm is in PolynomialFunctionLagrangeForm, * this class provides an easy-to-use interface to it.

* * @version $Id$ diff --git a/src/main/java/org/apache/commons/math/analysis/interpolation/UnivariateRealPeriodicInterpolator.java b/src/main/java/org/apache/commons/math/analysis/interpolation/UnivariateRealPeriodicInterpolator.java index f3d1bda7c..9e614110d 100644 --- a/src/main/java/org/apache/commons/math/analysis/interpolation/UnivariateRealPeriodicInterpolator.java +++ b/src/main/java/org/apache/commons/math/analysis/interpolation/UnivariateRealPeriodicInterpolator.java @@ -21,7 +21,7 @@ import org.apache.commons.math.util.MathUtils; import org.apache.commons.math.exception.NumberIsTooSmallException; /** - * Adapter for class implementing the {@link UnivariateRealInterpolator} + * Adapter for classes implementing the {@link UnivariateRealInterpolator} * interface. * The data to be interpolated is assumed to be periodic. Thus values that are * outside of the range can be passed to the interpolation function: They will diff --git a/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java b/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java index d0128b66d..c12dacd7f 100644 --- a/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java +++ b/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunction.java @@ -366,6 +366,8 @@ public class PolynomialFunction implements DifferentiableUnivariateRealFunction, /** * Dedicated parametric polynomial class. + * + * @since 3.0 */ public static class Parametric implements ParametricUnivariateRealFunction { /** {@inheritDoc} */ diff --git a/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java b/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java index 2fcd836bd..e31e01ad3 100644 --- a/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java +++ b/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java @@ -352,7 +352,7 @@ public class BOBYQAOptimizer * @return */ private double bobyqb( - ArrayRealVector xbase, + ArrayRealVector xbase, Array2DRowRealMatrix xpt, ArrayRealVector fval, ArrayRealVector xopt, @@ -831,7 +831,7 @@ public class BOBYQAOptimizer } f = computeObjectiveValue(currentBest.toArray()); - + if (!isMinimize) f = -f; if (ntrits == -1) { @@ -1740,7 +1740,7 @@ public class BOBYQAOptimizer currentBest.setEntry(j, upperBound[j]); } } - + final double objectiveValue = computeObjectiveValue(currentBest.toArray()); final double f = isMinimize ? objectiveValue : -objectiveValue; final int numEval = getEvaluations(); // nfm + 1 @@ -1901,7 +1901,7 @@ public class BOBYQAOptimizer double ds; int iu; double dhd, dhs, cth, shs, sth, ssq, beta=0, sdec, blen; - int iact = -1; + int iact = -1; int nact = 0; double angt = 0, qred; int isav; @@ -2329,7 +2329,7 @@ public class BOBYQAOptimizer if (pq.getEntry(k) != ZERO) { for (int i = 0; i < n; i++) { hs.setEntry(i, hs.getEntry(i) + tmp.getEntry(k) * xpt.getEntry(k, i)); - } + } } } if (crvmin != ZERO) { diff --git a/src/main/java/org/apache/commons/math/optimization/fitting/CurveFitter.java b/src/main/java/org/apache/commons/math/optimization/fitting/CurveFitter.java index a3efc2a14..b265d0803 100644 --- a/src/main/java/org/apache/commons/math/optimization/fitting/CurveFitter.java +++ b/src/main/java/org/apache/commons/math/optimization/fitting/CurveFitter.java @@ -139,6 +139,7 @@ public class CurveFitter { * if the number of allowed evaluations is exceeded. * @throws org.apache.commons.math.exception.DimensionMismatchException * if the start point dimension is wrong. + * @since 3.0 */ public double[] fit(int maxEval, final ParametricUnivariateRealFunction f, final double[] initialGuess) { diff --git a/src/main/java/org/apache/commons/math/optimization/fitting/GaussianFitter.java b/src/main/java/org/apache/commons/math/optimization/fitting/GaussianFitter.java index b874417f2..d919f89f8 100644 --- a/src/main/java/org/apache/commons/math/optimization/fitting/GaussianFitter.java +++ b/src/main/java/org/apache/commons/math/optimization/fitting/GaussianFitter.java @@ -79,6 +79,7 @@ public class GaussianFitter extends CurveFitter { * * @return the parameters of the Gaussian function that best fits the * observed points (in the same order as above). + * @since 3.0 */ public double[] fit(double[] initialGuess) { final ParametricUnivariateRealFunction f = new ParametricUnivariateRealFunction() {