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 2009/09/05 19:37:05 UTC
svn commit: r811685 [3/24] - in /commons/proper/math/trunk: ./
src/main/java/org/apache/commons/math/
src/main/java/org/apache/commons/math/analysis/
src/main/java/org/apache/commons/math/analysis/integration/
src/main/java/org/apache/commons/math/anal...
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/package.html
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/package.html?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/package.html (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/package.html Sat Sep 5 17:36:48 2009
@@ -19,4 +19,4 @@
<body>
Root finding algorithms, for univariate real functions.
</body>
-</html>
\ No newline at end of file
+</html>
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/Complex.java Sat Sep 5 17:36:48 2009
@@ -26,29 +26,29 @@
import org.apache.commons.math.util.MathUtils;
/**
- * Representation of a Complex number - a number which has both a
+ * Representation of a Complex number - a number which has both a
* real and imaginary part.
* <p>
* Implementations of arithmetic operations handle <code>NaN</code> and
* infinite values according to the rules for {@link java.lang.Double}
* arithmetic, applying definitional formulas and returning <code>NaN</code> or
- * infinite values in real or imaginary parts as these arise in computation.
+ * infinite values in real or imaginary parts as these arise in computation.
* See individual method javadocs for details.</p>
* <p>
- * {@link #equals} identifies all values with <code>NaN</code> in either real
+ * {@link #equals} identifies all values with <code>NaN</code> in either real
* or imaginary part - e.g., <pre>
* <code>1 + NaNi == NaN + i == NaN + NaNi.</code></pre></p>
*
* implements Serializable since 2.0
- *
+ *
* @version $Revision$ $Date$
*/
public class Complex implements FieldElement<Complex>, Serializable {
-
+
/** Serializable version identifier */
private static final long serialVersionUID = -6195664516687396620L;
- /** The square root of -1. A number representing "0.0 + 1.0i" */
+ /** The square root of -1. A number representing "0.0 + 1.0i" */
public static final Complex I = new Complex(0.0, 1.0);
// CHECKSTYLE: stop ConstantName
@@ -59,32 +59,32 @@
/** A complex number representing "+INF + INFi" */
public static final Complex INF = new Complex(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
- /** A complex number representing "1.0 + 0.0i" */
+ /** A complex number representing "1.0 + 0.0i" */
public static final Complex ONE = new Complex(1.0, 0.0);
-
- /** A complex number representing "0.0 + 0.0i" */
+
+ /** A complex number representing "0.0 + 0.0i" */
public static final Complex ZERO = new Complex(0.0, 0.0);
-
- /**
- * The imaginary part
+
+ /**
+ * The imaginary part
*/
private final double imaginary;
-
- /**
- * The real part
+
+ /**
+ * The real part
*/
private final double real;
-
+
/**
* Record whether this complex number is equal to NaN
*/
private final transient boolean isNaN;
-
+
/**
* Record whether this complex number is infinite
*/
private final transient boolean isInfinite;
-
+
/**
* Create a complex number given the real and imaginary parts.
*
@@ -95,7 +95,7 @@
super();
this.real = real;
this.imaginary = imaginary;
-
+
isNaN = Double.isNaN(real) || Double.isNaN(imaginary);
isInfinite = !isNaN &&
(Double.isInfinite(real) || Double.isInfinite(imaginary));
@@ -115,11 +115,11 @@
if (isNaN()) {
return Double.NaN;
}
-
+
if (isInfinite()) {
return Double.POSITIVE_INFINITY;
}
-
+
if (Math.abs(real) < Math.abs(imaginary)) {
if (imaginary == 0.0) {
return Math.abs(real);
@@ -134,11 +134,11 @@
return (Math.abs(real) * Math.sqrt(1 + q*q));
}
}
-
+
/**
* Return the sum of this complex number and the given complex number.
* <p>
- * Uses the definitional formula
+ * Uses the definitional formula
* <pre>
* (a + bi) + (c + di) = (a+c) + (b+d)i
* </pre></p>
@@ -146,25 +146,25 @@
* If either this or <code>rhs</code> has a NaN value in either part,
* {@link #NaN} is returned; otherwise Inifinite and NaN values are
* returned in the parts of the result according to the rules for
- * {@link java.lang.Double} arithmetic.</p>
+ * {@link java.lang.Double} arithmetic.</p>
*
* @param rhs the other complex number
* @return the complex number sum
* @throws NullPointerException if <code>rhs</code> is null
*/
- public Complex add(Complex rhs) {
+ public Complex add(Complex rhs) {
return createComplex(real + rhs.getReal(),
imaginary + rhs.getImaginary());
}
-
+
/**
* Return the conjugate of this complex number. The conjugate of
- * "A + Bi" is "A - Bi".
+ * "A + Bi" is "A - Bi".
* <p>
* {@link #NaN} is returned if either the real or imaginary
* part of this Complex number equals <code>Double.NaN</code>.</p>
* <p>
- * If the imaginary part is infinite, and the real part is not NaN,
+ * If the imaginary part is infinite, and the real part is not NaN,
* the returned value has infinite imaginary part of the opposite
* sign - e.g. the conjugate of <code>1 + POSITIVE_INFINITY i</code>
* is <code>1 - NEGATIVE_INFINITY i</code></p>
@@ -174,10 +174,10 @@
public Complex conjugate() {
if (isNaN()) {
return NaN;
- }
+ }
return createComplex(real, -imaginary);
}
-
+
/**
* Return the quotient of this complex number and the given complex number.
* <p>
@@ -187,7 +187,7 @@
* ----------- = -------------------------
* c + di c<sup>2</sup> + d<sup>2</sup>
* </code></pre>
- * but uses
+ * but uses
* <a href="http://doi.acm.org/10.1145/1039813.1039814">
* prescaling of operands</a> to limit the effects of overflows and
* underflows in the computation.</p>
@@ -202,13 +202,13 @@
* <li>If this and <code>rhs</code> are both infinite,
* {@link #NaN} is returned.</li>
* <li>If this is finite (i.e., has no infinite or NaN parts) and
- * <code>rhs</code> is infinite (one or both parts infinite),
+ * <code>rhs</code> is infinite (one or both parts infinite),
* {@link #ZERO} is returned.</li>
* <li>If this is infinite and <code>rhs</code> is finite, NaN values are
* returned in the parts of the result if the {@link java.lang.Double}
* rules applied to the definitional formula force NaN results.</li>
* </ul></p>
- *
+ *
* @param rhs the other complex number
* @return the complex number quotient
* @throws NullPointerException if <code>rhs</code> is null
@@ -223,7 +223,7 @@
if (c == 0.0 && d == 0.0) {
return NaN;
}
-
+
if (rhs.isInfinite() && !isInfinite()) {
return ZERO;
}
@@ -246,7 +246,7 @@
(imaginary - real * q) / denominator);
}
}
-
+
/**
* Test for the equality of two Complex objects.
* <p>
@@ -256,20 +256,20 @@
* <p>
* All <code>NaN</code> values are considered to be equal - i.e, if either
* (or both) real and imaginary parts of the complex number are equal
- * to <code>Double.NaN</code>, the complex number is equal to
+ * to <code>Double.NaN</code>, the complex number is equal to
* <code>Complex.NaN</code>.</p>
*
* @param other Object to test for equality to this
* @return true if two Complex objects are equal, false if
* object is null, not an instance of Complex, or
* not equal to this Complex instance
- *
+ *
*/
@Override
public boolean equals(Object other) {
boolean ret;
-
- if (this == other) {
+
+ if (this == other) {
ret = true;
} else if (other == null) {
ret = false;
@@ -279,22 +279,22 @@
if (rhs.isNaN()) {
ret = this.isNaN();
} else {
- ret = (real == rhs.real) && (imaginary == rhs.imaginary);
+ ret = (real == rhs.real) && (imaginary == rhs.imaginary);
}
} catch (ClassCastException ex) {
// ignore exception
ret = false;
}
}
-
+
return ret;
}
-
+
/**
* Get a hashCode for the complex number.
* <p>
* All NaN values have the same hash code.</p>
- *
+ *
* @return a hash code value for this object
*/
@Override
@@ -302,7 +302,7 @@
if (isNaN()) {
return 7;
}
- return 37 * (17 * MathUtils.hash(imaginary) +
+ return 37 * (17 * MathUtils.hash(imaginary) +
MathUtils.hash(real));
}
@@ -323,7 +323,7 @@
public double getReal() {
return real;
}
-
+
/**
* Returns true if either or both parts of this complex number is NaN;
* false otherwise
@@ -332,22 +332,22 @@
* false otherwise
*/
public boolean isNaN() {
- return isNaN;
+ return isNaN;
}
-
+
/**
* Returns true if either the real or imaginary part of this complex number
- * takes an infinite value (either <code>Double.POSITIVE_INFINITY</code> or
+ * takes an infinite value (either <code>Double.POSITIVE_INFINITY</code> or
* <code>Double.NEGATIVE_INFINITY</code>) and neither part
* is <code>NaN</code>.
- *
+ *
* @return true if one or both parts of this complex number are infinite
* and neither part is <code>NaN</code>
*/
public boolean isInfinite() {
- return isInfinite;
+ return isInfinite;
}
-
+
/**
* Return the product of this complex number and the given complex number.
* <p>
@@ -370,7 +370,7 @@
* Returns finite values in components of the result per the
* definitional formula in all remaining cases.
* </p>
- *
+ *
* @param rhs the other complex number
* @return the complex number product
* @throws NullPointerException if <code>rhs</code> is null
@@ -387,7 +387,7 @@
return createComplex(real * rhs.real - imaginary * rhs.imaginary,
real * rhs.imaginary + imaginary * rhs.real);
}
-
+
/**
* Return the product of this complex number and the given scalar number.
* <p>
@@ -410,7 +410,7 @@
* Returns finite values in components of the result per the
* definitional formula in all remaining cases.
* </p>
- *
+ *
* @param rhs the scalar number
* @return the complex number product
*/
@@ -425,7 +425,7 @@
}
return createComplex(real * rhs, imaginary * rhs);
}
-
+
/**
* Return the additive inverse of this complex number.
* <p>
@@ -438,15 +438,15 @@
if (isNaN()) {
return NaN;
}
-
+
return createComplex(-real, -imaginary);
}
-
+
/**
* Return the difference between this complex number and the given complex
* number.
* <p>
- * Uses the definitional formula
+ * Uses the definitional formula
* <pre>
* (a + bi) - (c + di) = (a-c) + (b-d)i
* </pre></p>
@@ -455,7 +455,7 @@
* {@link #NaN} is returned; otherwise inifinite and NaN values are
* returned in the parts of the result according to the rules for
* {@link java.lang.Double} arithmetic. </p>
- *
+ *
* @param rhs the other complex number
* @return the complex number difference
* @throws NullPointerException if <code>rhs</code> is null
@@ -464,22 +464,22 @@
if (isNaN() || rhs.isNaN()) {
return NaN;
}
-
+
return createComplex(real - rhs.getReal(),
imaginary - rhs.getImaginary());
}
-
+
/**
- * Compute the
+ * Compute the
* <a href="http://mathworld.wolfram.com/InverseCosine.html" TARGET="_top">
* inverse cosine</a> of this complex number.
* <p>
* Implements the formula: <pre>
* <code> acos(z) = -i (log(z + i (sqrt(1 - z<sup>2</sup>))))</code></pre></p>
* <p>
- * Returns {@link Complex#NaN} if either real or imaginary part of the
+ * Returns {@link Complex#NaN} if either real or imaginary part of the
* input argument is <code>NaN</code> or infinite.</p>
- *
+ *
* @return the inverse cosine of this complex number
* @since 1.2
*/
@@ -491,18 +491,18 @@
return this.add(this.sqrt1z().multiply(Complex.I)).log()
.multiply(Complex.I.negate());
}
-
+
/**
- * Compute the
+ * Compute the
* <a href="http://mathworld.wolfram.com/InverseSine.html" TARGET="_top">
* inverse sine</a> of this complex number.
* <p>
* Implements the formula: <pre>
* <code> asin(z) = -i (log(sqrt(1 - z<sup>2</sup>) + iz)) </code></pre></p>
* <p>
- * Returns {@link Complex#NaN} if either real or imaginary part of the
+ * Returns {@link Complex#NaN} if either real or imaginary part of the
* input argument is <code>NaN</code> or infinite.</p>
- *
+ *
* @return the inverse sine of this complex number.
* @since 1.2
*/
@@ -514,18 +514,18 @@
return sqrt1z().add(this.multiply(Complex.I)).log()
.multiply(Complex.I.negate());
}
-
+
/**
- * Compute the
+ * Compute the
* <a href="http://mathworld.wolfram.com/InverseTangent.html" TARGET="_top">
* inverse tangent</a> of this complex number.
* <p>
* Implements the formula: <pre>
* <code> atan(z) = (i/2) log((i + z)/(i - z)) </code></pre></p>
* <p>
- * Returns {@link Complex#NaN} if either real or imaginary part of the
+ * Returns {@link Complex#NaN} if either real or imaginary part of the
* input argument is <code>NaN</code> or infinite.</p>
- *
+ *
* @return the inverse tangent of this complex number
* @since 1.2
*/
@@ -533,13 +533,13 @@
if (isNaN()) {
return Complex.NaN;
}
-
+
return this.add(Complex.I).divide(Complex.I.subtract(this)).log()
.multiply(Complex.I.divide(createComplex(2.0, 0.0)));
}
-
+
/**
- * Compute the
+ * Compute the
* <a href="http://mathworld.wolfram.com/Cosine.html" TARGET="_top">
* cosine</a>
* of this complex number.
@@ -547,20 +547,20 @@
* Implements the formula: <pre>
* <code> cos(a + bi) = cos(a)cosh(b) - sin(a)sinh(b)i</code></pre>
* where the (real) functions on the right-hand side are
- * {@link java.lang.Math#sin}, {@link java.lang.Math#cos},
+ * {@link java.lang.Math#sin}, {@link java.lang.Math#cos},
* {@link MathUtils#cosh} and {@link MathUtils#sinh}.</p>
* <p>
- * Returns {@link Complex#NaN} if either real or imaginary part of the
+ * Returns {@link Complex#NaN} if either real or imaginary part of the
* input argument is <code>NaN</code>.</p>
* <p>
* Infinite values in real or imaginary parts of the input may result in
* infinite or NaN values returned in parts of the result.<pre>
- * Examples:
+ * Examples:
* <code>
* cos(1 ± INFINITY i) = 1 ∓ INFINITY i
* cos(±INFINITY + i) = NaN + NaN i
* cos(±INFINITY ± INFINITY i) = NaN + NaN i</code></pre></p>
- *
+ *
* @return the cosine of this complex number
* @since 1.2
*/
@@ -568,33 +568,33 @@
if (isNaN()) {
return Complex.NaN;
}
-
+
return createComplex(Math.cos(real) * MathUtils.cosh(imaginary),
-Math.sin(real) * MathUtils.sinh(imaginary));
}
-
+
/**
- * Compute the
+ * Compute the
* <a href="http://mathworld.wolfram.com/HyperbolicCosine.html" TARGET="_top">
* hyperbolic cosine</a> of this complex number.
* <p>
* Implements the formula: <pre>
* <code> cosh(a + bi) = cosh(a)cos(b) + sinh(a)sin(b)i</code></pre>
* where the (real) functions on the right-hand side are
- * {@link java.lang.Math#sin}, {@link java.lang.Math#cos},
+ * {@link java.lang.Math#sin}, {@link java.lang.Math#cos},
* {@link MathUtils#cosh} and {@link MathUtils#sinh}.</p>
* <p>
- * Returns {@link Complex#NaN} if either real or imaginary part of the
+ * Returns {@link Complex#NaN} if either real or imaginary part of the
* input argument is <code>NaN</code>.</p>
* <p>
* Infinite values in real or imaginary parts of the input may result in
* infinite or NaN values returned in parts of the result.<pre>
- * Examples:
+ * Examples:
* <code>
* cosh(1 ± INFINITY i) = NaN + NaN i
* cosh(±INFINITY + i) = INFINITY ± INFINITY i
* cosh(±INFINITY ± INFINITY i) = NaN + NaN i</code></pre></p>
- *
+ *
* @return the hyperbolic cosine of this complex number.
* @since 1.2
*/
@@ -602,11 +602,11 @@
if (isNaN()) {
return Complex.NaN;
}
-
+
return createComplex(MathUtils.cosh(real) * Math.cos(imaginary),
MathUtils.sinh(real) * Math.sin(imaginary));
}
-
+
/**
* Compute the
* <a href="http://mathworld.wolfram.com/ExponentialFunction.html" TARGET="_top">
@@ -618,18 +618,18 @@
* {@link java.lang.Math#exp}, {@link java.lang.Math#cos}, and
* {@link java.lang.Math#sin}.</p>
* <p>
- * Returns {@link Complex#NaN} if either real or imaginary part of the
+ * Returns {@link Complex#NaN} if either real or imaginary part of the
* input argument is <code>NaN</code>.</p>
* <p>
* Infinite values in real or imaginary parts of the input may result in
* infinite or NaN values returned in parts of the result.<pre>
- * Examples:
+ * Examples:
* <code>
* exp(1 ± INFINITY i) = NaN + NaN i
* exp(INFINITY + i) = INFINITY + INFINITY i
* exp(-INFINITY + i) = 0 + 0i
* exp(±INFINITY ± INFINITY i) = NaN + NaN i</code></pre></p>
- *
+ *
* @return <i>e</i><sup><code>this</code></sup>
* @since 1.2
*/
@@ -637,13 +637,13 @@
if (isNaN()) {
return Complex.NaN;
}
-
+
double expReal = Math.exp(real);
return createComplex(expReal * Math.cos(imaginary), expReal * Math.sin(imaginary));
}
-
+
/**
- * Compute the
+ * Compute the
* <a href="http://mathworld.wolfram.com/NaturalLogarithm.html" TARGET="_top">
* natural logarithm</a> of this complex number.
* <p>
@@ -653,12 +653,12 @@
* <code>|a + bi|</code> is the modulus, {@link Complex#abs}, and
* <code>arg(a + bi) = {@link java.lang.Math#atan2}(b, a)</code></p>
* <p>
- * Returns {@link Complex#NaN} if either real or imaginary part of the
+ * Returns {@link Complex#NaN} if either real or imaginary part of the
* input argument is <code>NaN</code>.</p>
* <p>
* Infinite (or critical) values in real or imaginary parts of the input may
* result in infinite or NaN values returned in parts of the result.<pre>
- * Examples:
+ * Examples:
* <code>
* log(1 ± INFINITY i) = INFINITY ± (π/2)i
* log(INFINITY + i) = INFINITY + 0i
@@ -667,7 +667,7 @@
* log(-INFINITY ± INFINITY i) = INFINITY ± (3π/4)i
* log(0 + 0i) = -INFINITY + 0i
* </code></pre></p>
- *
+ *
* @return ln of this complex number.
* @since 1.2
*/
@@ -677,21 +677,21 @@
}
return createComplex(Math.log(abs()),
- Math.atan2(imaginary, real));
+ Math.atan2(imaginary, real));
}
-
+
/**
* Returns of value of this complex number raised to the power of <code>x</code>.
* <p>
* Implements the formula: <pre>
- * <code> y<sup>x</sup> = exp(x·log(y))</code></pre>
+ * <code> y<sup>x</sup> = exp(x·log(y))</code></pre>
* where <code>exp</code> and <code>log</code> are {@link #exp} and
* {@link #log}, respectively.</p>
* <p>
- * Returns {@link Complex#NaN} if either real or imaginary part of the
+ * Returns {@link Complex#NaN} if either real or imaginary part of the
* input argument is <code>NaN</code> or infinite, or if <code>y</code>
* equals {@link Complex#ZERO}.</p>
- *
+ *
* @param x the exponent.
* @return <code>this</code><sup><code>x</code></sup>
* @throws NullPointerException if x is null
@@ -703,9 +703,9 @@
}
return this.log().multiply(x).exp();
}
-
+
/**
- * Compute the
+ * Compute the
* <a href="http://mathworld.wolfram.com/Sine.html" TARGET="_top">
* sine</a>
* of this complex number.
@@ -713,20 +713,20 @@
* Implements the formula: <pre>
* <code> sin(a + bi) = sin(a)cosh(b) - cos(a)sinh(b)i</code></pre>
* where the (real) functions on the right-hand side are
- * {@link java.lang.Math#sin}, {@link java.lang.Math#cos},
+ * {@link java.lang.Math#sin}, {@link java.lang.Math#cos},
* {@link MathUtils#cosh} and {@link MathUtils#sinh}.</p>
* <p>
- * Returns {@link Complex#NaN} if either real or imaginary part of the
+ * Returns {@link Complex#NaN} if either real or imaginary part of the
* input argument is <code>NaN</code>.</p>
* <p>
* Infinite values in real or imaginary parts of the input may result in
* infinite or NaN values returned in parts of the result.<pre>
- * Examples:
+ * Examples:
* <code>
* sin(1 ± INFINITY i) = 1 ± INFINITY i
* sin(±INFINITY + i) = NaN + NaN i
* sin(±INFINITY ± INFINITY i) = NaN + NaN i</code></pre></p>
- *
+ *
* @return the sine of this complex number.
* @since 1.2
*/
@@ -734,33 +734,33 @@
if (isNaN()) {
return Complex.NaN;
}
-
+
return createComplex(Math.sin(real) * MathUtils.cosh(imaginary),
Math.cos(real) * MathUtils.sinh(imaginary));
}
-
+
/**
- * Compute the
+ * Compute the
* <a href="http://mathworld.wolfram.com/HyperbolicSine.html" TARGET="_top">
* hyperbolic sine</a> of this complex number.
* <p>
* Implements the formula: <pre>
* <code> sinh(a + bi) = sinh(a)cos(b)) + cosh(a)sin(b)i</code></pre>
* where the (real) functions on the right-hand side are
- * {@link java.lang.Math#sin}, {@link java.lang.Math#cos},
+ * {@link java.lang.Math#sin}, {@link java.lang.Math#cos},
* {@link MathUtils#cosh} and {@link MathUtils#sinh}.</p>
* <p>
- * Returns {@link Complex#NaN} if either real or imaginary part of the
+ * Returns {@link Complex#NaN} if either real or imaginary part of the
* input argument is <code>NaN</code>.</p>
* <p>
* Infinite values in real or imaginary parts of the input may result in
* infinite or NaN values returned in parts of the result.<pre>
- * Examples:
+ * Examples:
* <code>
* sinh(1 ± INFINITY i) = NaN + NaN i
* sinh(±INFINITY + i) = ± INFINITY + INFINITY i
* sinh(±INFINITY ± INFINITY i) = NaN + NaN i</code></pre></p>
- *
+ *
* @return the hyperbolic sine of this complex number
* @since 1.2
*/
@@ -768,17 +768,17 @@
if (isNaN()) {
return Complex.NaN;
}
-
+
return createComplex(MathUtils.sinh(real) * Math.cos(imaginary),
MathUtils.cosh(real) * Math.sin(imaginary));
}
-
+
/**
- * Compute the
+ * Compute the
* <a href="http://mathworld.wolfram.com/SquareRoot.html" TARGET="_top">
* square root</a> of this complex number.
* <p>
- * Implements the following algorithm to compute <code>sqrt(a + bi)</code>:
+ * Implements the following algorithm to compute <code>sqrt(a + bi)</code>:
* <ol><li>Let <code>t = sqrt((|a| + |a + bi|) / 2)</code></li>
* <li><pre>if <code> a ≥ 0</code> return <code>t + (b/2t)i</code>
* else return <code>|b|/2t + sign(b)t i </code></pre></li>
@@ -789,12 +789,12 @@
* <li><code>sign(b) = {@link MathUtils#indicator}(b) </code>
* </ul></p>
* <p>
- * Returns {@link Complex#NaN} if either real or imaginary part of the
+ * Returns {@link Complex#NaN} if either real or imaginary part of the
* input argument is <code>NaN</code>.</p>
* <p>
* Infinite values in real or imaginary parts of the input may result in
* infinite or NaN values returned in parts of the result.<pre>
- * Examples:
+ * Examples:
* <code>
* sqrt(1 ± INFINITY i) = INFINITY + NaN i
* sqrt(INFINITY + i) = INFINITY + 0i
@@ -802,7 +802,7 @@
* sqrt(INFINITY ± INFINITY i) = INFINITY + NaN i
* sqrt(-INFINITY ± INFINITY i) = NaN ± INFINITY i
* </code></pre></p>
- *
+ *
* @return the square root of this complex number
* @since 1.2
*/
@@ -810,11 +810,11 @@
if (isNaN()) {
return Complex.NaN;
}
-
+
if (real == 0.0 && imaginary == 0.0) {
return createComplex(0.0, 0.0);
}
-
+
double t = Math.sqrt((Math.abs(real) + abs()) / 2.0);
if (real >= 0.0) {
return createComplex(t, imaginary / (2.0 * t));
@@ -823,52 +823,52 @@
MathUtils.indicator(imaginary) * t);
}
}
-
+
/**
- * Compute the
+ * Compute the
* <a href="http://mathworld.wolfram.com/SquareRoot.html" TARGET="_top">
* square root</a> of 1 - <code>this</code><sup>2</sup> for this complex
* number.
* <p>
- * Computes the result directly as
+ * Computes the result directly as
* <code>sqrt(Complex.ONE.subtract(z.multiply(z)))</code>.</p>
* <p>
- * Returns {@link Complex#NaN} if either real or imaginary part of the
+ * Returns {@link Complex#NaN} if either real or imaginary part of the
* input argument is <code>NaN</code>.</p>
* <p>
* Infinite values in real or imaginary parts of the input may result in
* infinite or NaN values returned in parts of the result.</p>
- *
+ *
* @return the square root of 1 - <code>this</code><sup>2</sup>
* @since 1.2
*/
public Complex sqrt1z() {
return createComplex(1.0, 0.0).subtract(this.multiply(this)).sqrt();
}
-
+
/**
- * Compute the
+ * Compute the
* <a href="http://mathworld.wolfram.com/Tangent.html" TARGET="_top">
* tangent</a> of this complex number.
* <p>
* Implements the formula: <pre>
* <code>tan(a + bi) = sin(2a)/(cos(2a)+cosh(2b)) + [sinh(2b)/(cos(2a)+cosh(2b))]i</code></pre>
* where the (real) functions on the right-hand side are
- * {@link java.lang.Math#sin}, {@link java.lang.Math#cos},
+ * {@link java.lang.Math#sin}, {@link java.lang.Math#cos},
* {@link MathUtils#cosh} and {@link MathUtils#sinh}.</p>
* <p>
- * Returns {@link Complex#NaN} if either real or imaginary part of the
+ * Returns {@link Complex#NaN} if either real or imaginary part of the
* input argument is <code>NaN</code>.</p>
* <p>
* Infinite (or critical) values in real or imaginary parts of the input may
* result in infinite or NaN values returned in parts of the result.<pre>
- * Examples:
+ * Examples:
* <code>
* tan(1 ± INFINITY i) = 0 + NaN i
* tan(±INFINITY + i) = NaN + NaN i
* tan(±INFINITY ± INFINITY i) = NaN + NaN i
* tan(±π/2 + 0 i) = ±INFINITY + NaN i</code></pre></p>
- *
+ *
* @return the tangent of this complex number
* @since 1.2
*/
@@ -876,14 +876,14 @@
if (isNaN()) {
return Complex.NaN;
}
-
+
double real2 = 2.0 * real;
double imaginary2 = 2.0 * imaginary;
double d = Math.cos(real2) + MathUtils.cosh(imaginary2);
-
+
return createComplex(Math.sin(real2) / d, MathUtils.sinh(imaginary2) / d);
}
-
+
/**
* Compute the
* <a href="http://mathworld.wolfram.com/HyperbolicTangent.html" TARGET="_top">
@@ -892,15 +892,15 @@
* Implements the formula: <pre>
* <code>tan(a + bi) = sinh(2a)/(cosh(2a)+cos(2b)) + [sin(2b)/(cosh(2a)+cos(2b))]i</code></pre>
* where the (real) functions on the right-hand side are
- * {@link java.lang.Math#sin}, {@link java.lang.Math#cos},
+ * {@link java.lang.Math#sin}, {@link java.lang.Math#cos},
* {@link MathUtils#cosh} and {@link MathUtils#sinh}.</p>
* <p>
- * Returns {@link Complex#NaN} if either real or imaginary part of the
+ * Returns {@link Complex#NaN} if either real or imaginary part of the
* input argument is <code>NaN</code>.</p>
* <p>
* Infinite values in real or imaginary parts of the input may result in
* infinite or NaN values returned in parts of the result.<pre>
- * Examples:
+ * Examples:
* <code>
* tanh(1 ± INFINITY i) = NaN + NaN i
* tanh(±INFINITY + i) = NaN + 0 i
@@ -914,34 +914,34 @@
if (isNaN()) {
return Complex.NaN;
}
-
+
double real2 = 2.0 * real;
double imaginary2 = 2.0 * imaginary;
double d = MathUtils.cosh(real2) + Math.cos(imaginary2);
-
+
return createComplex(MathUtils.sinh(real2) / d, Math.sin(imaginary2) / d);
}
-
-
-
+
+
+
/**
* <p>Compute the argument of this complex number.
* </p>
* <p>The argument is the angle phi between the positive real axis and the point
- * representing this number in the complex plane. The value returned is between -PI (not inclusive)
+ * representing this number in the complex plane. The value returned is between -PI (not inclusive)
* and PI (inclusive), with negative values returned for numbers with negative imaginary parts.
* </p>
* <p>If either real or imaginary part (or both) is NaN, NaN is returned. Infinite parts are handled
* as java.Math.atan2 handles them, essentially treating finite parts as zero in the presence of
* an infinite coordinate and returning a multiple of pi/4 depending on the signs of the infinite
* parts. See the javadoc for java.Math.atan2 for full details.</p>
- *
+ *
* @return the argument of this complex number
*/
public double getArgument() {
return Math.atan2(getImaginary(), getReal());
}
-
+
/**
* <p>Computes the n-th roots of this complex number.
* </p>
@@ -954,7 +954,7 @@
* {@link #NaN} is returned.</p>
* <p>if neither part is NaN, but at least one part is infinite, the result is a one-element
* list containing {@link #INF}.</p>
- *
+ *
* @param n degree of root
* @return List<Complex> all nth roots of this complex number
* @throws IllegalArgumentException if parameter n is less than or equal to 0
@@ -967,14 +967,14 @@
"cannot compute nth root for null or negative n: {0}",
n);
}
-
+
List<Complex> result = new ArrayList<Complex>();
-
+
if (isNaN()) {
result.add(Complex.NaN);
return result;
}
-
+
if (isInfinite()) {
result.add(Complex.INF);
return result;
@@ -1012,14 +1012,14 @@
/**
* <p>Resolve the transient fields in a deserialized Complex Object.</p>
- * <p>Subclasses will need to override {@link #createComplex} to deserialize properly</p>
+ * <p>Subclasses will need to override {@link #createComplex} to deserialize properly</p>
* @return A Complex instance with all fields resolved.
* @since 2.0
*/
protected final Object readResolve() {
return createComplex(real, imaginary);
}
-
+
/** {@inheritDoc} */
public ComplexField getField() {
return ComplexField.getInstance();
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexField.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexField.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexField.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexField.java Sat Sep 5 17:36:48 2009
@@ -70,7 +70,7 @@
*/
private Object readResolve() {
// return the singleton instance
- return LazyHolder.INSTANCE;
+ return LazyHolder.INSTANCE;
}
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexFormat.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexFormat.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexFormat.java Sat Sep 5 17:36:48 2009
@@ -35,22 +35,22 @@
* @version $Revision$ $Date$
*/
public class ComplexFormat extends CompositeFormat {
-
+
/** Serializable version identifier */
private static final long serialVersionUID = -3343698360149467646L;
/** The default imaginary character. */
private static final String DEFAULT_IMAGINARY_CHARACTER = "i";
-
+
/** The notation used to signify the imaginary part of the complex number. */
private String imaginaryCharacter;
-
+
/** The format used for the imaginary part. */
private NumberFormat imaginaryFormat;
/** The format used for the real part. */
private NumberFormat realFormat;
-
+
/**
* Create an instance with the default imaginary character, 'i', and the
* default number format for both real and imaginary parts.
@@ -67,7 +67,7 @@
public ComplexFormat(NumberFormat format) {
this(DEFAULT_IMAGINARY_CHARACTER, format);
}
-
+
/**
* Create an instance with a custom number format for the real part and a
* custom number format for the imaginary part.
@@ -77,7 +77,7 @@
public ComplexFormat(NumberFormat realFormat, NumberFormat imaginaryFormat) {
this(DEFAULT_IMAGINARY_CHARACTER, realFormat, imaginaryFormat);
}
-
+
/**
* Create an instance with a custom imaginary character, and the default
* number format for both real and imaginary parts.
@@ -86,7 +86,7 @@
public ComplexFormat(String imaginaryCharacter) {
this(imaginaryCharacter, getDefaultNumberFormat());
}
-
+
/**
* Create an instance with a custom imaginary character, and a custom number
* format for both real and imaginary parts.
@@ -96,7 +96,7 @@
public ComplexFormat(String imaginaryCharacter, NumberFormat format) {
this(imaginaryCharacter, format, (NumberFormat)format.clone());
}
-
+
/**
* Create an instance with a custom imaginary character, a custom number
* format for the real part, and a custom number format for the imaginary
@@ -115,7 +115,7 @@
/**
* Get the set of locales for which complex formats are available.
- * <p>This is the same set as the {@link NumberFormat} set.</p>
+ * <p>This is the same set as the {@link NumberFormat} set.</p>
* @return available complex format locales.
*/
public static Locale[] getAvailableLocales() {
@@ -132,7 +132,7 @@
public static String formatComplex(Complex c) {
return getInstance().format(c);
}
-
+
/**
* Formats a {@link Complex} object to produce a string.
*
@@ -144,14 +144,14 @@
*/
public StringBuffer format(Complex complex, StringBuffer toAppendTo,
FieldPosition pos) {
-
+
pos.setBeginIndex(0);
pos.setEndIndex(0);
// format real
double re = complex.getReal();
formatDouble(re, getRealFormat(), toAppendTo, pos);
-
+
// format sign and imaginary
double im = complex.getImaginary();
if (im < 0.0) {
@@ -163,12 +163,12 @@
formatDouble(im, getImaginaryFormat(), toAppendTo, pos);
toAppendTo.append(getImaginaryCharacter());
}
-
+
return toAppendTo;
}
-
+
/**
- * Formats a object to produce a string. <code>obj</code> must be either a
+ * Formats a object to produce a string. <code>obj</code> must be either a
* {@link Complex} object or a {@link Number} object. Any other type of
* object will result in an {@link IllegalArgumentException} being thrown.
*
@@ -183,20 +183,20 @@
@Override
public StringBuffer format(Object obj, StringBuffer toAppendTo,
FieldPosition pos) {
-
+
StringBuffer ret = null;
-
+
if (obj instanceof Complex) {
ret = format( (Complex)obj, toAppendTo, pos);
} else if (obj instanceof Number) {
ret = format( new Complex(((Number)obj).doubleValue(), 0.0),
toAppendTo, pos);
- } else {
+ } else {
throw MathRuntimeException.createIllegalArgumentException(
"cannot format a {0} instance as a complex number",
obj.getClass().getName());
}
-
+
return ret;
}
@@ -207,7 +207,7 @@
public String getImaginaryCharacter() {
return imaginaryCharacter;
}
-
+
/**
* Access the imaginaryFormat.
* @return the imaginaryFormat.
@@ -215,7 +215,7 @@
public NumberFormat getImaginaryFormat() {
return imaginaryFormat;
}
-
+
/**
* Returns the default complex format for the current locale.
* @return the default complex format.
@@ -223,7 +223,7 @@
public static ComplexFormat getInstance() {
return getInstance(Locale.getDefault());
}
-
+
/**
* Returns the default complex format for the given locale.
* @param locale the specific locale used by the format.
@@ -233,7 +233,7 @@
NumberFormat f = getDefaultNumberFormat(locale);
return new ComplexFormat(f);
}
-
+
/**
* Access the realFormat.
* @return the realFormat.
@@ -260,7 +260,7 @@
}
return result;
}
-
+
/**
* Parses a string to produce a {@link Complex} object.
*
@@ -327,7 +327,7 @@
return new Complex(re.doubleValue(), im.doubleValue() * sign);
}
-
+
/**
* Parses a string to produce a object.
*
@@ -354,7 +354,7 @@
}
this.imaginaryCharacter = imaginaryCharacter;
}
-
+
/**
* Modify the imaginaryFormat.
* @param imaginaryFormat The new imaginaryFormat value.
@@ -368,7 +368,7 @@
}
this.imaginaryFormat = imaginaryFormat;
}
-
+
/**
* Modify the realFormat.
* @param realFormat The new realFormat value.
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexUtils.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexUtils.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/ComplexUtils.java Sat Sep 5 17:36:48 2009
@@ -20,39 +20,39 @@
import org.apache.commons.math.MathRuntimeException;
/**
- * Static implementations of common
+ * Static implementations of common
* {@link org.apache.commons.math.complex.Complex} utilities functions.
*
* @version $Revision$ $Date$
*/
public class ComplexUtils {
-
+
/**
* Default constructor.
*/
private ComplexUtils() {
super();
}
-
+
/**
* Creates a complex number from the given polar representation.
* <p>
* The value returned is <code>r·e<sup>i·theta</sup></code>,
* computed as <code>r·cos(theta) + r·sin(theta)i</code></p>
* <p>
- * If either <code>r</code> or <code>theta</code> is NaN, or
+ * If either <code>r</code> or <code>theta</code> is NaN, or
* <code>theta</code> is infinite, {@link Complex#NaN} is returned.</p>
* <p>
- * If <code>r</code> is infinite and <code>theta</code> is finite,
+ * If <code>r</code> is infinite and <code>theta</code> is finite,
* infinite or NaN values may be returned in parts of the result, following
* the rules for double arithmetic.<pre>
- * Examples:
+ * Examples:
* <code>
* polar2Complex(INFINITY, π/4) = INFINITY + INFINITY i
* polar2Complex(INFINITY, 0) = INFINITY + NaN i
* polar2Complex(INFINITY, -π/4) = INFINITY - INFINITY i
* polar2Complex(INFINITY, 5π/4) = -INFINITY - INFINITY i </code></pre></p>
- *
+ *
* @param r the modulus of the complex number to create
* @param theta the argument of the complex number to create
* @return <code>r·e<sup>i·theta</sup></code>
@@ -66,5 +66,5 @@
}
return new Complex(r * Math.cos(theta), r * Math.sin(theta));
}
-
+
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/package.html
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/package.html?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/package.html (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/complex/package.html Sat Sep 5 17:36:48 2009
@@ -20,4 +20,4 @@
Complex number type and implementations of complex transcendental
functions.
</body>
-</html>
\ No newline at end of file
+</html>
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java Sat Sep 5 17:36:48 2009
@@ -29,7 +29,7 @@
* Base class for continuous distributions. Default implementations are
* provided for some of the methods that do not vary from distribution to
* distribution.
- *
+ *
* @version $Revision$ $Date$
*/
public abstract class AbstractContinuousDistribution
@@ -38,7 +38,7 @@
/** Serializable version identifier */
private static final long serialVersionUID = -38038050983108802L;
-
+
/**
* Default constructor.
*/
@@ -76,8 +76,8 @@
}
}
};
-
- // Try to bracket root, test domain endoints if this fails
+
+ // Try to bracket root, test domain endoints if this fails
double lowerBound = getDomainLowerBound(p);
double upperBound = getDomainUpperBound(p);
double[] bracket = null;
@@ -86,20 +86,20 @@
rootFindingFunction, getInitialDomain(p),
lowerBound, upperBound);
} catch (ConvergenceException ex) {
- /*
+ /*
* Check domain endpoints to see if one gives value that is within
* the default solver's defaultAbsoluteAccuracy of 0 (will be the
* case if density has bounded support and p is 0 or 1).
- *
+ *
* TODO: expose the default solver, defaultAbsoluteAccuracy as
* a constant.
- */
+ */
if (Math.abs(rootFindingFunction.value(lowerBound)) < 1E-6) {
return lowerBound;
}
if (Math.abs(rootFindingFunction.value(upperBound)) < 1E-6) {
return upperBound;
- }
+ }
// Failed bracket convergence was not because of corner solution
throw new MathException(ex);
}
@@ -114,7 +114,7 @@
* Access the initial domain value, based on <code>p</code>, used to
* bracket a CDF root. This method is used by
* {@link #inverseCumulativeProbability(double)} to find critical values.
- *
+ *
* @param p the desired probability for the critical value
* @return initial domain value
*/
@@ -124,10 +124,10 @@
* Access the domain value lower bound, based on <code>p</code>, used to
* bracket a CDF root. This method is used by
* {@link #inverseCumulativeProbability(double)} to find critical values.
- *
+ *
* @param p the desired probability for the critical value
* @return domain value lower bound, i.e.
- * P(X < <i>lower bound</i>) < <code>p</code>
+ * P(X < <i>lower bound</i>) < <code>p</code>
*/
protected abstract double getDomainLowerBound(double p);
@@ -135,10 +135,10 @@
* Access the domain value upper bound, based on <code>p</code>, used to
* bracket a CDF root. This method is used by
* {@link #inverseCumulativeProbability(double)} to find critical values.
- *
+ *
* @param p the desired probability for the critical value
* @return domain value upper bound, i.e.
- * P(X < <i>upper bound</i>) > <code>p</code>
+ * P(X < <i>upper bound</i>) > <code>p</code>
*/
protected abstract double getDomainUpperBound(double p);
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractDistribution.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractDistribution.java Sat Sep 5 17:36:48 2009
@@ -22,8 +22,8 @@
import org.apache.commons.math.MathRuntimeException;
/**
- * Base class for probability distributions.
- *
+ * Base class for probability distributions.
+ *
* @version $Revision$ $Date$
*/
public abstract class AbstractDistribution
@@ -31,7 +31,7 @@
/** Serializable version identifier */
private static final long serialVersionUID = -38038050983108802L;
-
+
/**
* Default constructor.
*/
@@ -46,7 +46,7 @@
* The default implementation uses the identity</p>
* <p>
* P(x0 ≤ X ≤ x1) = P(X ≤ x1) - P(X ≤ x0) </p>
- *
+ *
* @param x0 the (inclusive) lower bound
* @param x1 the (inclusive) upper bound
* @return the probability that a random variable with this distribution
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java Sat Sep 5 17:36:48 2009
@@ -26,31 +26,31 @@
* Base class for integer-valued discrete distributions. Default
* implementations are provided for some of the methods that do not vary
* from distribution to distribution.
- *
+ *
* @version $Revision$ $Date$
*/
public abstract class AbstractIntegerDistribution extends AbstractDistribution
implements IntegerDistribution, Serializable {
-
+
/** Serializable version identifier */
private static final long serialVersionUID = -1146319659338487221L;
-
+
/**
* Default constructor.
*/
protected AbstractIntegerDistribution() {
super();
}
-
+
/**
* For a random variable X whose values are distributed according
* to this distribution, this method returns P(X ≤ x). In other words,
* this method represents the (cumulative) distribution function, or
* CDF, for this distribution.
* <p>
- * If <code>x</code> does not represent an integer value, the CDF is
+ * If <code>x</code> does not represent an integer value, the CDF is
* evaluated at the greatest integer less than x.
- *
+ *
* @param x the value at which the distribution function is evaluated.
* @return cumulative probability that a random variable with this
* distribution takes a value less than or equal to <code>x</code>
@@ -58,13 +58,13 @@
* computed due to convergence or other numerical errors.
*/
public double cumulativeProbability(double x) throws MathException {
- return cumulativeProbability((int) Math.floor(x));
+ return cumulativeProbability((int) Math.floor(x));
}
-
+
/**
* For a random variable X whose values are distributed according
* to this distribution, this method returns P(x0 ≤ X ≤ x1).
- *
+ *
* @param x0 the (inclusive) lower bound
* @param x1 the (inclusive) upper bound
* @return the probability that a random variable with this distribution
@@ -87,30 +87,30 @@
(int) Math.floor(x1)); // don't want to count mass below x0
} else { // x0 is mathematical integer, so use as is
return cumulativeProbability((int) Math.floor(x0),
- (int) Math.floor(x1));
+ (int) Math.floor(x1));
}
}
-
+
/**
* For a random variable X whose values are distributed according
* to this distribution, this method returns P(X ≤ x). In other words,
* this method represents the probability distribution function, or PDF,
* for this distribution.
- *
+ *
* @param x the value at which the PDF is evaluated.
- * @return PDF for this distribution.
+ * @return PDF for this distribution.
* @throws MathException if the cumulative probability can not be
* computed due to convergence or other numerical errors.
*/
abstract public double cumulativeProbability(int x) throws MathException;
-
+
/**
* For a random variable X whose values are distributed according
* to this distribution, this method returns P(X = x). In other words, this
* method represents the probability mass function, or PMF, for the distribution.
* <p>
* If <code>x</code> does not represent an integer value, 0 is returned.
- *
+ *
* @param x the value at which the probability density function is evaluated
* @return the value of the probability density function at x
*/
@@ -122,14 +122,14 @@
return 0;
}
}
-
+
/**
* For a random variable X whose values are distributed according
* to this distribution, this method returns P(x0 ≤ X ≤ x1).
- *
+ *
* @param x0 the inclusive, lower bound
* @param x1 the inclusive, upper bound
- * @return the cumulative probability.
+ * @return the cumulative probability.
* @throws MathException if the cumulative probability can not be
* computed due to convergence or other numerical errors.
* @throws IllegalArgumentException if x0 > x1
@@ -142,7 +142,7 @@
}
return cumulativeProbability(x1) - cumulativeProbability(x0 - 1);
}
-
+
/**
* For a random variable X whose values are distributed according
* to this distribution, this method returns the largest x, such
@@ -159,7 +159,7 @@
throw MathRuntimeException.createIllegalArgumentException(
"{0} out of [{1}, {2}] range", p, 0.0, 1.0);
}
-
+
// by default, do simple bisection.
// subclasses can override if there is a better method.
int x0 = getDomainLowerBound(p);
@@ -190,36 +190,36 @@
}
}
}
-
+
// insure x0 is the correct critical point
pm = cumulativeProbability(x0);
while (pm > p) {
--x0;
pm = cumulativeProbability(x0);
}
-
- return x0;
+
+ return x0;
}
-
+
/**
* Access the domain value lower bound, based on <code>p</code>, used to
* bracket a PDF root. This method is used by
* {@link #inverseCumulativeProbability(double)} to find critical values.
- *
+ *
* @param p the desired probability for the critical value
* @return domain value lower bound, i.e.
- * P(X < <i>lower bound</i>) < <code>p</code>
+ * P(X < <i>lower bound</i>) < <code>p</code>
*/
protected abstract int getDomainLowerBound(double p);
-
+
/**
* Access the domain value upper bound, based on <code>p</code>, used to
* bracket a PDF root. This method is used by
* {@link #inverseCumulativeProbability(double)} to find critical values.
- *
+ *
* @param p the desired probability for the critical value
* @return domain value upper bound, i.e.
- * P(X < <i>upper bound</i>) > <code>p</code>
+ * P(X < <i>upper bound</i>) > <code>p</code>
*/
protected abstract int getDomainUpperBound(double p);
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/BinomialDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/BinomialDistribution.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/BinomialDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/BinomialDistribution.java Sat Sep 5 17:36:48 2009
@@ -35,22 +35,22 @@
* @return the number of trials.
*/
int getNumberOfTrials();
-
+
/**
* Access the probability of success for this distribution.
* @return the probability of success.
*/
double getProbabilityOfSuccess();
-
+
/**
* Change the number of trials for this distribution.
* @param trials the new number of trials.
*/
void setNumberOfTrials(int trials);
-
+
/**
* Change the probability of success for this distribution.
* @param p the new probability of success.
*/
void setProbabilityOfSuccess(double p);
-}
\ No newline at end of file
+}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/BinomialDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/BinomialDistributionImpl.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/BinomialDistributionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/BinomialDistributionImpl.java Sat Sep 5 17:36:48 2009
@@ -100,10 +100,10 @@
/**
* Access the domain value lower bound, based on <code>p</code>, used to
* bracket a PDF root.
- *
+ *
* @param p the desired probability for the critical value
* @return domain value lower bound, i.e.
- * P(X < <i>lower bound</i>) < <code>p</code>
+ * P(X < <i>lower bound</i>) < <code>p</code>
*/
@Override
protected int getDomainLowerBound(double p) {
@@ -113,10 +113,10 @@
/**
* Access the domain value upper bound, based on <code>p</code>, used to
* bracket a PDF root.
- *
+ *
* @param p the desired probability for the critical value
* @return domain value upper bound, i.e.
- * P(X < <i>upper bound</i>) > <code>p</code>
+ * P(X < <i>upper bound</i>) > <code>p</code>
*/
@Override
protected int getDomainUpperBound(double p) {
@@ -126,7 +126,7 @@
/**
* For this distribution, X, this method returns P(X ≤ x).
* @param x the value at which the PDF is evaluated.
- * @return PDF for this distribution.
+ * @return PDF for this distribution.
* @throws MathException if the cumulative probability can not be
* computed due to convergence or other numerical errors.
*/
@@ -149,9 +149,9 @@
/**
* For this distribution, X, this method returns P(X = x).
- *
+ *
* @param x the value at which the PMF is evaluated.
- * @return PMF for this distribution.
+ * @return PMF for this distribution.
*/
public double probability(int x) {
double ret;
@@ -166,7 +166,7 @@
}
return ret;
}
-
+
/**
* For this distribution, X, this method returns the largest x, such
* that P(X ≤ x) ≤ <code>p</code>.
@@ -185,11 +185,11 @@
// handle extreme values explicitly
if (p == 0) {
return -1;
- }
+ }
if (p == 1) {
- return Integer.MAX_VALUE;
+ return Integer.MAX_VALUE;
}
-
+
// use default bisection impl
return super.inverseCumulativeProbability(p);
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/CauchyDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/CauchyDistribution.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/CauchyDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/CauchyDistribution.java Sat Sep 5 17:36:48 2009
@@ -32,25 +32,25 @@
* @version $Revision$ $Date$
*/
public interface CauchyDistribution extends ContinuousDistribution {
-
+
/**
* Access the median.
* @return median for this distribution
*/
double getMedian();
-
+
/**
* Access the scale parameter.
* @return scale parameter for this distribution
*/
double getScale();
-
+
/**
* Modify the median.
* @param median for this distribution
*/
void setMedian(double median);
-
+
/**
* Modify the scale parameter.
* @param s scale parameter for this distribution
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java Sat Sep 5 17:36:48 2009
@@ -28,26 +28,26 @@
* @since 1.1
* @version $Revision$ $Date$
*/
-public class CauchyDistributionImpl extends AbstractContinuousDistribution
+public class CauchyDistributionImpl extends AbstractContinuousDistribution
implements CauchyDistribution, Serializable {
-
+
/** Serializable version identifier */
private static final long serialVersionUID = 8589540077390120676L;
/** The median of this distribution. */
private double median = 0;
-
+
/** The scale of this distribution. */
private double scale = 1;
-
+
/**
* Creates cauchy distribution with the medain equal to zero and scale
- * equal to one.
+ * equal to one.
*/
public CauchyDistributionImpl(){
this(0.0, 1.0);
}
-
+
/**
* Create a cauchy distribution using the given median and scale.
* @param median median for this distribution
@@ -62,16 +62,16 @@
/**
* For this distribution, X, this method returns P(X < <code>x</code>).
* @param x the value at which the CDF is evaluated.
- * @return CDF evaluted at <code>x</code>.
+ * @return CDF evaluted at <code>x</code>.
*/
public double cumulativeProbability(double x) {
return 0.5 + (Math.atan((x - median) / scale) / Math.PI);
}
-
+
/**
* Access the median.
* @return median for this distribution
- */
+ */
public double getMedian() {
return median;
}
@@ -83,12 +83,12 @@
public double getScale() {
return scale;
}
-
+
/**
* For this distribution, X, this method returns the critical point x, such
* that P(X < x) = <code>p</code>.
* <p>
- * Returns <code>Double.NEGATIVE_INFINITY</code> for p=0 and
+ * Returns <code>Double.NEGATIVE_INFINITY</code> for p=0 and
* <code>Double.POSITIVE_INFINITY</code> for p=1.</p>
*
* @param p the desired probability
@@ -111,7 +111,7 @@
}
return ret;
}
-
+
/**
* Modify the median.
* @param median for this distribution
@@ -129,18 +129,18 @@
if (s <= 0.0) {
throw MathRuntimeException.createIllegalArgumentException(
"scale must be positive ({0})", s);
- }
+ }
scale = s;
}
-
+
/**
* Access the domain value lower bound, based on <code>p</code>, used to
* bracket a CDF root. This method is used by
* {@link #inverseCumulativeProbability(double)} to find critical values.
- *
+ *
* @param p the desired probability for the critical value
* @return domain value lower bound, i.e.
- * P(X < <i>lower bound</i>) < <code>p</code>
+ * P(X < <i>lower bound</i>) < <code>p</code>
*/
@Override
protected double getDomainLowerBound(double p) {
@@ -151,7 +151,7 @@
} else {
ret = getMedian();
}
-
+
return ret;
}
@@ -159,10 +159,10 @@
* Access the domain value upper bound, based on <code>p</code>, used to
* bracket a CDF root. This method is used by
* {@link #inverseCumulativeProbability(double)} to find critical values.
- *
+ *
* @param p the desired probability for the critical value
* @return domain value upper bound, i.e.
- * P(X < <i>upper bound</i>) > <code>p</code>
+ * P(X < <i>upper bound</i>) > <code>p</code>
*/
@Override
protected double getDomainUpperBound(double p) {
@@ -173,7 +173,7 @@
} else {
ret = Double.MAX_VALUE;
}
-
+
return ret;
}
@@ -181,7 +181,7 @@
* Access the initial domain value, based on <code>p</code>, used to
* bracket a CDF root. This method is used by
* {@link #inverseCumulativeProbability(double)} to find critical values.
- *
+ *
* @param p the desired probability for the critical value
* @return initial domain value
*/
@@ -196,7 +196,7 @@
} else {
ret = getMedian();
}
-
+
return ret;
}
}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ChiSquaredDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ChiSquaredDistribution.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ChiSquaredDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ChiSquaredDistribution.java Sat Sep 5 17:36:48 2009
@@ -35,7 +35,7 @@
* @param degreesOfFreedom the new degrees of freedom.
*/
void setDegreesOfFreedom(double degreesOfFreedom);
-
+
/**
* Access the degrees of freedom.
* @return the degrees of freedom.
@@ -48,4 +48,4 @@
* @return The pdf at point x.
*/
double density(Double x);
-}
\ No newline at end of file
+}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java Sat Sep 5 17:36:48 2009
@@ -28,13 +28,13 @@
public class ChiSquaredDistributionImpl
extends AbstractContinuousDistribution
implements ChiSquaredDistribution, Serializable {
-
+
/** Serializable version identifier */
private static final long serialVersionUID = -8352658048349159782L;
- /** Internal Gamma distribution. */
+ /** Internal Gamma distribution. */
private GammaDistribution gamma;
-
+
/**
* Create a Chi-Squared distribution with the given degrees of freedom.
* @param df degrees of freedom.
@@ -42,7 +42,7 @@
public ChiSquaredDistributionImpl(double df) {
this(df, new GammaDistributionImpl(df / 2.0, 2.0));
}
-
+
/**
* Create a Chi-Squared distribution with the given degrees of freedom.
* @param df degrees of freedom.
@@ -54,7 +54,7 @@
setGamma(g);
setDegreesOfFreedom(df);
}
-
+
/**
* Modify the degrees of freedom.
* @param degreesOfFreedom the new degrees of freedom.
@@ -62,7 +62,7 @@
public void setDegreesOfFreedom(double degreesOfFreedom) {
getGamma().setAlpha(degreesOfFreedom / 2.0);
}
-
+
/**
* Access the degrees of freedom.
* @return the degrees of freedom.
@@ -84,14 +84,14 @@
/**
* For this distribution, X, this method returns P(X < x).
* @param x the value at which the CDF is evaluated.
- * @return CDF for this distribution.
+ * @return CDF for this distribution.
* @throws MathException if the cumulative probability can not be
* computed due to convergence or other numerical errors.
*/
public double cumulativeProbability(double x) throws MathException {
return getGamma().cumulativeProbability(x);
}
-
+
/**
* For this distribution, X, this method returns the critical point x, such
* that P(X < x) = <code>p</code>.
@@ -116,15 +116,15 @@
}
return super.inverseCumulativeProbability(p);
}
-
+
/**
* Access the domain value lower bound, based on <code>p</code>, used to
* bracket a CDF root. This method is used by
* {@link #inverseCumulativeProbability(double)} to find critical values.
- *
+ *
* @param p the desired probability for the critical value
* @return domain value lower bound, i.e.
- * P(X < <i>lower bound</i>) < <code>p</code>
+ * P(X < <i>lower bound</i>) < <code>p</code>
*/
@Override
protected double getDomainLowerBound(double p) {
@@ -135,10 +135,10 @@
* Access the domain value upper bound, based on <code>p</code>, used to
* bracket a CDF root. This method is used by
* {@link #inverseCumulativeProbability(double)} to find critical values.
- *
+ *
* @param p the desired probability for the critical value
* @return domain value upper bound, i.e.
- * P(X < <i>upper bound</i>) > <code>p</code>
+ * P(X < <i>upper bound</i>) > <code>p</code>
*/
@Override
protected double getDomainUpperBound(double p) {
@@ -154,7 +154,7 @@
// use max
ret = Double.MAX_VALUE;
}
-
+
return ret;
}
@@ -162,7 +162,7 @@
* Access the initial domain value, based on <code>p</code>, used to
* bracket a CDF root. This method is used by
* {@link #inverseCumulativeProbability(double)} to find critical values.
- *
+ *
* @param p the desired probability for the critical value
* @return initial domain value
*/
@@ -170,7 +170,7 @@
protected double getInitialDomain(double p) {
// NOTE: chi squared is skewed to the left
// NOTE: therefore, P(X < μ) > .5
-
+
double ret;
if (p < .5) {
@@ -180,10 +180,10 @@
// use mean
ret = getDegreesOfFreedom();
}
-
+
return ret;
}
-
+
/**
* Modify the underlying gamma distribution. The caller is responsible for
* insuring the gamma distribution has the proper parameter settings.
@@ -192,7 +192,7 @@
*/
public void setGamma(GammaDistribution g) {
this.gamma = g;
-
+
}
/**
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ContinuousDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ContinuousDistribution.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ContinuousDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ContinuousDistribution.java Sat Sep 5 17:36:48 2009
@@ -24,11 +24,11 @@
* @version $Revision$ $Date$
*/
public interface ContinuousDistribution extends Distribution {
-
+
/**
* For this distribution, X, this method returns x such that P(X < x) = p.
* @param p the cumulative probability.
- * @return x.
+ * @return x.
* @throws MathException if the inverse cumulative probability can not be
* computed due to convergence or other numerical errors.
*/
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/DiscreteDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/DiscreteDistribution.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/DiscreteDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/DiscreteDistribution.java Sat Sep 5 17:36:48 2009
@@ -27,7 +27,7 @@
* For a random variable X whose values are distributed according
* to this distribution, this method returns P(X = x). In other words, this
* method represents the probability mass function, or PMF for the distribution.
- *
+ *
* @param x the value at which the probability mass function is evaluated.
* @return the value of the probability mass function at x
*/
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/Distribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/Distribution.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/Distribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/Distribution.java Sat Sep 5 17:36:48 2009
@@ -29,7 +29,7 @@
* to this distribution, this method returns P(X ≤ x). In other words,
* this method represents the (cumulative) distribution function, or
* CDF, for this distribution.
- *
+ *
* @param x the value at which the distribution function is evaluated.
* @return the probability that a random variable with this
* distribution takes a value less than or equal to <code>x</code>
@@ -37,15 +37,15 @@
* computed due to convergence or other numerical errors.
*/
double cumulativeProbability(double x) throws MathException;
-
+
/**
* For a random variable X whose values are distributed according
* to this distribution, this method returns P(x0 ≤ X ≤ x1).
- *
+ *
* @param x0 the (inclusive) lower bound
* @param x1 the (inclusive) upper bound
* @return the probability that a random variable with this distribution
- * will take a value between <code>x0</code> and <code>x1</code>,
+ * will take a value between <code>x0</code> and <code>x1</code>,
* including the endpoints
* @throws MathException if the cumulative probability can not be
* computed due to convergence or other numerical errors.
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ExponentialDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ExponentialDistribution.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ExponentialDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ExponentialDistribution.java Sat Sep 5 17:36:48 2009
@@ -35,7 +35,7 @@
* @param mean the new mean.
*/
void setMean(double mean);
-
+
/**
* Access the mean.
* @return the mean.
@@ -48,4 +48,4 @@
* @return The pdf at point x.
*/
double density(Double x);
-}
\ No newline at end of file
+}
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ExponentialDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ExponentialDistributionImpl.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ExponentialDistributionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/ExponentialDistributionImpl.java Sat Sep 5 17:36:48 2009
@@ -31,10 +31,10 @@
/** Serializable version identifier */
private static final long serialVersionUID = 2401296428283614780L;
-
+
/** The mean of this distribution. */
private double mean;
-
+
/**
* Create a exponential distribution with the given mean.
* @param mean mean of this distribution.
@@ -80,14 +80,14 @@
/**
* For this distribution, X, this method returns P(X < x).
- *
+ *
* The implementation of this method is based on:
* <ul>
* <li>
* <a href="http://mathworld.wolfram.com/ExponentialDistribution.html">
* Exponential Distribution</a>, equation (1).</li>
* </ul>
- *
+ *
* @param x the value at which the CDF is evaluated.
* @return CDF for this distribution.
* @throws MathException if the cumulative probability can not be
@@ -102,13 +102,13 @@
}
return ret;
}
-
+
/**
* For this distribution, X, this method returns the critical point x, such
* that P(X < x) = <code>p</code>.
* <p>
* Returns 0 for p=0 and <code>Double.POSITIVE_INFINITY</code> for p=1.</p>
- *
+ *
* @param p the desired probability
* @return x, such that P(X < x) = <code>p</code>
* @throws MathException if the inverse cumulative probability can not be
@@ -118,7 +118,7 @@
@Override
public double inverseCumulativeProbability(double p) throws MathException {
double ret;
-
+
if (p < 0.0 || p > 1.0) {
throw MathRuntimeException.createIllegalArgumentException(
"{0} out of [{1}, {2}] range", p, 0.0, 1.0);
@@ -127,14 +127,14 @@
} else {
ret = -getMean() * Math.log(1.0 - p);
}
-
+
return ret;
}
-
+
/**
* Access the domain value lower bound, based on <code>p</code>, used to
- * bracket a CDF root.
- *
+ * bracket a CDF root.
+ *
* @param p the desired probability for the critical value
* @return domain value lower bound, i.e.
* P(X < <i>lower bound</i>) < <code>p</code>
@@ -143,14 +143,14 @@
protected double getDomainLowerBound(double p) {
return 0;
}
-
+
/**
* Access the domain value upper bound, based on <code>p</code>, used to
- * bracket a CDF root.
- *
+ * bracket a CDF root.
+ *
* @param p the desired probability for the critical value
* @return domain value upper bound, i.e.
- * P(X < <i>upper bound</i>) > <code>p</code>
+ * P(X < <i>upper bound</i>) > <code>p</code>
*/
@Override
protected double getDomainUpperBound(double p) {
@@ -165,11 +165,11 @@
return Double.MAX_VALUE;
}
}
-
+
/**
* Access the initial domain value, based on <code>p</code>, used to
- * bracket a CDF root.
- *
+ * bracket a CDF root.
+ *
* @param p the desired probability for the critical value
* @return initial domain value
*/
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/FDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/FDistribution.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/FDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/FDistribution.java Sat Sep 5 17:36:48 2009
@@ -35,19 +35,19 @@
* @param degreesOfFreedom the new numerator degrees of freedom.
*/
void setNumeratorDegreesOfFreedom(double degreesOfFreedom);
-
+
/**
* Access the numerator degrees of freedom.
* @return the numerator degrees of freedom.
*/
double getNumeratorDegreesOfFreedom();
-
+
/**
* Modify the denominator degrees of freedom.
* @param degreesOfFreedom the new denominator degrees of freedom.
*/
void setDenominatorDegreesOfFreedom(double degreesOfFreedom);
-
+
/**
* Access the denominator degrees of freedom.
* @return the denominator degrees of freedom.
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/FDistributionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/FDistributionImpl.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/FDistributionImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/FDistributionImpl.java Sat Sep 5 17:36:48 2009
@@ -40,7 +40,7 @@
/** The numerator degrees of freedom*/
private double denominatorDegreesOfFreedom;
-
+
/**
* Create a F distribution using the given degrees of freedom.
* @param numeratorDegreesOfFreedom the numerator degrees of freedom.
@@ -52,19 +52,19 @@
setNumeratorDegreesOfFreedom(numeratorDegreesOfFreedom);
setDenominatorDegreesOfFreedom(denominatorDegreesOfFreedom);
}
-
+
/**
* For this distribution, X, this method returns P(X < x).
- *
+ *
* The implementation of this method is based on:
* <ul>
* <li>
* <a href="http://mathworld.wolfram.com/F-Distribution.html">
* F-Distribution</a>, equation (4).</li>
* </ul>
- *
+ *
* @param x the value at which the CDF is evaluated.
- * @return CDF for this distribution.
+ * @return CDF for this distribution.
* @throws MathException if the cumulative probability can not be
* computed due to convergence or other numerical errors.
*/
@@ -75,14 +75,14 @@
} else {
double n = getNumeratorDegreesOfFreedom();
double m = getDenominatorDegreesOfFreedom();
-
+
ret = Beta.regularizedBeta((n * x) / (m + n * x),
0.5 * n,
0.5 * m);
}
return ret;
}
-
+
/**
* For this distribution, X, this method returns the critical point x, such
* that P(X < x) = <code>p</code>.
@@ -97,7 +97,7 @@
* probability.
*/
@Override
- public double inverseCumulativeProbability(final double p)
+ public double inverseCumulativeProbability(final double p)
throws MathException {
if (p == 0) {
return 0d;
@@ -107,15 +107,15 @@
}
return super.inverseCumulativeProbability(p);
}
-
+
/**
* Access the domain value lower bound, based on <code>p</code>, used to
* bracket a CDF root. This method is used by
* {@link #inverseCumulativeProbability(double)} to find critical values.
- *
+ *
* @param p the desired probability for the critical value
* @return domain value lower bound, i.e.
- * P(X < <i>lower bound</i>) < <code>p</code>
+ * P(X < <i>lower bound</i>) < <code>p</code>
*/
@Override
protected double getDomainLowerBound(double p) {
@@ -126,10 +126,10 @@
* Access the domain value upper bound, based on <code>p</code>, used to
* bracket a CDF root. This method is used by
* {@link #inverseCumulativeProbability(double)} to find critical values.
- *
+ *
* @param p the desired probability for the critical value
* @return domain value upper bound, i.e.
- * P(X < <i>upper bound</i>) > <code>p</code>
+ * P(X < <i>upper bound</i>) > <code>p</code>
*/
@Override
protected double getDomainUpperBound(double p) {
@@ -140,7 +140,7 @@
* Access the initial domain value, based on <code>p</code>, used to
* bracket a CDF root. This method is used by
* {@link #inverseCumulativeProbability(double)} to find critical values.
- *
+ *
* @param p the desired probability for the critical value
* @return initial domain value
*/
@@ -154,7 +154,7 @@
}
return ret;
}
-
+
/**
* Modify the numerator degrees of freedom.
* @param degreesOfFreedom the new numerator degrees of freedom.
@@ -169,7 +169,7 @@
}
this.numeratorDegreesOfFreedom = degreesOfFreedom;
}
-
+
/**
* Access the numerator degrees of freedom.
* @return the numerator degrees of freedom.
@@ -177,7 +177,7 @@
public double getNumeratorDegreesOfFreedom() {
return numeratorDegreesOfFreedom;
}
-
+
/**
* Modify the denominator degrees of freedom.
* @param degreesOfFreedom the new denominator degrees of freedom.
@@ -192,7 +192,7 @@
}
this.denominatorDegreesOfFreedom = degreesOfFreedom;
}
-
+
/**
* Access the denominator degrees of freedom.
* @return the denominator degrees of freedom.
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/GammaDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/GammaDistribution.java?rev=811685&r1=811684&r2=811685&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/GammaDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/GammaDistribution.java Sat Sep 5 17:36:48 2009
@@ -35,19 +35,19 @@
* @param alpha the new shape parameter.
*/
void setAlpha(double alpha);
-
+
/**
* Access the shape parameter, alpha
* @return alpha.
*/
double getAlpha();
-
+
/**
* Modify the scale parameter, beta.
* @param beta the new scale parameter.
*/
void setBeta(double beta);
-
+
/**
* Access the scale parameter, beta
* @return beta.