Eliminated tabs.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@201915 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2005-06-26 22:20:57 +00:00
parent 3524bd6ca6
commit 540caa1add
17 changed files with 267 additions and 267 deletions

View File

@ -94,7 +94,7 @@ public class PolynomialSplineFunction implements UnivariateRealFunction, Seriali
public PolynomialSplineFunction(double knots[], PolynomialFunction polynomials[]) {
if (knots.length < 2) {
throw new IllegalArgumentException
("Not enough knot values -- spline partition must have at least 2 points.");
("Not enough knot values -- spline partition must have at least 2 points.");
}
if (knots.length - 1 != polynomials.length) {
throw new IllegalArgumentException

View File

@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- $Revision$ $Date$ -->
<!-- $Revision$ $Date$ -->
<body>
Implementations of common numerical analysis procedures, including root finding and function interpolation.
</body>

View File

@ -120,7 +120,7 @@ public class ComplexFormat extends Format implements Serializable {
* @return A formatted number in the form "Re(c) + Im(c)i"
*/
public static String formatComplex( Complex c ) {
return getInstance().format( c );
return getInstance().format( c );
}
/**

View File

@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- $Revision$ $Date$ -->
<!-- $Revision$ $Date$ -->
<body>
Complex number type and implementations of complex transcendental
functions.

View File

@ -105,7 +105,7 @@ public abstract class AbstractIntegerDistribution extends AbstractDistribution
public double cumulativeProbability(int x0, int x1) throws MathException {
if (x0 > x1) {
throw new IllegalArgumentException
("lower endpoint must be less than or equal to upper endpoint");
("lower endpoint must be less than or equal to upper endpoint");
}
return cumulativeProbability(x1) - cumulativeProbability(x0 - 1);
}

View File

@ -152,10 +152,10 @@ public class BinomialDistributionImpl
ret = 0.0;
} else {
ret = MathUtils.binomialCoefficientDouble(
getNumberOfTrials(), x) *
Math.pow(getProbabilityOfSuccess(), x) *
Math.pow(1.0 - getProbabilityOfSuccess(),
getNumberOfTrials() - x);
getNumberOfTrials(), x) *
Math.pow(getProbabilityOfSuccess(), x) *
Math.pow(1.0 - getProbabilityOfSuccess(),
getNumberOfTrials() - x);
}
return ret;
}

View File

@ -34,27 +34,27 @@ package org.apache.commons.math.distribution;
*/
public interface CauchyDistribution extends ContinuousDistribution {
/**
* Access the median.
* @return median for this distribution
*/
double getMedian();
/**
* Access the median.
* @return median for this distribution
*/
double getMedian();
/**
* Access the scale parameter.
* @return scale parameter for this distribution
*/
double getScale();
/**
* 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 median.
* @param median for this distribution
*/
void setMedian(double median);
/**
* Modify the scale parameter.
* @param s scale parameter for this distribution
*/
void setScale(double s);
/**
* Modify the scale parameter.
* @param s scale parameter for this distribution
*/
void setScale(double s);
}

View File

@ -26,60 +26,60 @@ import java.io.Serializable;
* @version $Revision$ $Date$
*/
public class CauchyDistributionImpl extends AbstractContinuousDistribution
implements CauchyDistribution, Serializable {
implements CauchyDistribution, Serializable {
/** Serializable version identifier */
static final long serialVersionUID = 8589540077390120676L;
/** The median of this distribution. */
private double median = 0;
private double median = 0;
/** The scale of this distribution. */
private double scale = 1;
private double scale = 1;
/**
* Creates cauchy distribution with the medain equal to zero and scale
* 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
* @param s scale parameter for this distribution
*/
public CauchyDistributionImpl(double median, double s){
super();
setMedian(median);
setScale(s);
}
/**
* Creates cauchy distribution with the medain equal to zero and scale
* 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
* @param s scale parameter for this distribution
*/
public CauchyDistributionImpl(double median, double s){
super();
setMedian(median);
setScale(s);
}
/**
* For this disbution, X, this method returns P(X &lt; <code>x</code>).
* @param x the value at which the CDF is evaluated.
* @return CDF evaluted at <code>x</code>.
*/
public double cumulativeProbability(double x) {
/**
* For this disbution, X, this method returns P(X &lt; <code>x</code>).
* @param x the value at which the CDF is evaluated.
* @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;
}
/**
* Access the median.
* @return median for this distribution
*/
public double getMedian() {
return median;
}
/**
/**
* Access the scale parameter.
* @return scale parameter for this distribution
*/
public double getScale() {
return scale;
}
*/
public double getScale() {
return scale;
}
/**
* For this distribution, X, this method returns the critical point x, such
@ -108,37 +108,37 @@ public class CauchyDistributionImpl extends AbstractContinuousDistribution
return ret;
}
/**
* Modify the median.
* @param median for this distribution
*/
public void setMedian(double median) {
this.median = median;
}
/**
* Modify the median.
* @param median for this distribution
*/
public void setMedian(double median) {
this.median = median;
}
/**
/**
* Modify the scale parameter.
* @param s scale parameter for this distribution
* @throws IllegalArgumentException if <code>sd</code> is not positive.
*/
public void setScale(double s) {
if (s <= 0.0) {
throw new IllegalArgumentException(
*/
public void setScale(double s) {
if (s <= 0.0) {
throw new IllegalArgumentException(
"Scale must be positive.");
}
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 &lt; <i>lower bound</i>) &lt; <code>p</code>
*/
protected double getDomainLowerBound(double p) {
}
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 &lt; <i>lower bound</i>) &lt; <code>p</code>
*/
protected double getDomainLowerBound(double p) {
double ret;
if (p < .5) {
@ -150,16 +150,16 @@ public class CauchyDistributionImpl extends AbstractContinuousDistribution
return ret;
}
/**
* 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 &lt; <i>upper bound</i>) &gt; <code>p</code>
*/
protected double getDomainUpperBound(double p) {
/**
* 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 &lt; <i>upper bound</i>) &gt; <code>p</code>
*/
protected double getDomainUpperBound(double p) {
double ret;
if (p < .5) {
@ -171,15 +171,15 @@ public class CauchyDistributionImpl extends AbstractContinuousDistribution
return ret;
}
/**
* 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
*/
protected double getInitialDomain(double p) {
/**
* 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
*/
protected double getInitialDomain(double p) {
double ret;
if (p < .5) {
@ -191,5 +191,5 @@ public class CauchyDistributionImpl extends AbstractContinuousDistribution
}
return ret;
}
}
}

View File

@ -154,24 +154,24 @@ public abstract class DistributionFactory {
createHypergeometricDistribution(int populationSize,
int numberOfSuccesses, int sampleSize);
/**
* Create a new normal distribution with the given mean and standard
* deviation.
/**
* Create a new normal distribution with the given mean and standard
* deviation.
*
* @param mean the mean of the distribution
* @param sd standard deviation
* @return a new normal distribution
*/
* @param mean the mean of the distribution
* @param sd standard deviation
* @return a new normal distribution
*/
public abstract NormalDistribution
createNormalDistribution(double mean, double sd);
/**
* Create a new normal distribution with mean zero and standard
* deviation one.
createNormalDistribution(double mean, double sd);
/**
* Create a new normal distribution with mean zero and standard
* deviation one.
*
* @return a new normal distribution.
*/
public abstract NormalDistribution createNormalDistribution();
* @return a new normal distribution.
*/
public abstract NormalDistribution createNormalDistribution();
/**
* Create a new Poisson distribution with poisson parameter lambda.

View File

@ -118,27 +118,27 @@ public class DistributionFactoryImpl extends DistributionFactory {
numberOfSuccesses, sampleSize);
}
/**
* Create a new normal distribution with the given mean and standard
* deviation.
/**
* Create a new normal distribution with the given mean and standard
* deviation.
*
* @param mean the mean of the distribution
* @param sd standard deviation
* @return a new normal distribution
*/
public NormalDistribution createNormalDistribution(double mean, double sd) {
return new NormalDistributionImpl(mean, sd);
}
* @param mean the mean of the distribution
* @param sd standard deviation
* @return a new normal distribution
*/
public NormalDistribution createNormalDistribution(double mean, double sd) {
return new NormalDistributionImpl(mean, sd);
}
/**
* Create a new normal distribution with the mean zero and standard
* deviation one.
/**
* Create a new normal distribution with the mean zero and standard
* deviation one.
*
* @return a new normal distribution
*/
public NormalDistribution createNormalDistribution() {
return new NormalDistributionImpl();
}
* @return a new normal distribution
*/
public NormalDistribution createNormalDistribution() {
return new NormalDistributionImpl();
}
/**
* Create a new Poisson distribution with poisson parameter lambda.

View File

@ -32,24 +32,24 @@ package org.apache.commons.math.distribution;
* @version $Revision$ $Date$
*/
public interface NormalDistribution extends ContinuousDistribution {
/**
* Access the mean.
* @return mean for this distribution
*/
double getMean();
/**
* Modify the mean.
* @param mean for this distribution
*/
void setMean(double mean);
/**
* Access the standard deviation.
* @return standard deviation for this distribution
*/
double getStandardDeviation();
/**
* Modify the standard deviation.
* @param sd standard deviation for this distribution
*/
void setStandardDeviation(double sd);
/**
* Access the mean.
* @return mean for this distribution
*/
double getMean();
/**
* Modify the mean.
* @param mean for this distribution
*/
void setMean(double mean);
/**
* Access the standard deviation.
* @return standard deviation for this distribution
*/
double getStandardDeviation();
/**
* Modify the standard deviation.
* @param sd standard deviation for this distribution
*/
void setStandardDeviation(double sd);
}

View File

@ -28,83 +28,83 @@ import org.apache.commons.math.special.Erf;
* @version $Revision$ $Date$
*/
public class NormalDistributionImpl extends AbstractContinuousDistribution
implements NormalDistribution, Serializable {
implements NormalDistribution, Serializable {
/** Serializable version identifier */
static final long serialVersionUID = 8589540077390120676L;
/** The mean of this distribution. */
private double mean = 0;
private double mean = 0;
/** The standard deviation of this distribution. */
private double standardDeviation = 1;
/**
* Create a normal distribution using the given mean and standard deviation.
* @param mean mean for this distribution
* @param sd standard deviation for this distribution
*/
public NormalDistributionImpl(double mean, double sd){
super();
setMean(mean);
setStandardDeviation(sd);
}
private double standardDeviation = 1;
/**
* Creates normal distribution with the mean equal to zero and standard
* deviation equal to one.
*/
public NormalDistributionImpl(){
this(0.0, 1.0);
}
/**
* Create a normal distribution using the given mean and standard deviation.
* @param mean mean for this distribution
* @param sd standard deviation for this distribution
*/
public NormalDistributionImpl(double mean, double sd){
super();
setMean(mean);
setStandardDeviation(sd);
}
/**
* Access the mean.
* @return mean for this distribution
*/
public double getMean() {
return mean;
}
/**
* Creates normal distribution with the mean equal to zero and standard
* deviation equal to one.
*/
public NormalDistributionImpl(){
this(0.0, 1.0);
}
/**
* Modify the mean.
* @param mean for this distribution
*/
public void setMean(double mean) {
this.mean = mean;
}
/**
* Access the mean.
* @return mean for this distribution
*/
public double getMean() {
return mean;
}
/**
* Modify the mean.
* @param mean for this distribution
*/
public void setMean(double mean) {
this.mean = mean;
}
/**
* Access the standard deviation.
* @return standard deviation for this distribution
*/
public double getStandardDeviation() {
return standardDeviation;
}
/**
* Access the standard deviation.
* @return standard deviation for this distribution
*/
public double getStandardDeviation() {
return standardDeviation;
}
/**
* Modify the standard deviation.
* @param sd standard deviation for this distribution
/**
* Modify the standard deviation.
* @param sd standard deviation for this distribution
* @throws IllegalArgumentException if <code>sd</code> is not positive.
*/
public void setStandardDeviation(double sd) {
if (sd <= 0.0) {
throw new IllegalArgumentException(
*/
public void setStandardDeviation(double sd) {
if (sd <= 0.0) {
throw new IllegalArgumentException(
"Standard deviation must be positive.");
}
standardDeviation = sd;
}
}
standardDeviation = sd;
}
/**
* For this disbution, X, this method returns P(X &lt; <code>x</code>).
* @param x the value at which the CDF is evaluated.
* @return CDF evaluted at <code>x</code>.
* @throws MathException if the algorithm fails to converge.
*/
public double cumulativeProbability(double x) throws MathException {
/**
* For this disbution, X, this method returns P(X &lt; <code>x</code>).
* @param x the value at which the CDF is evaluated.
* @return CDF evaluted at <code>x</code>.
* @throws MathException if the algorithm fails to converge.
*/
public double cumulativeProbability(double x) throws MathException {
return 0.5 * (1.0 + Erf.erf((x - mean) /
(standardDeviation * Math.sqrt(2.0))));
}
}
/**
* For this distribution, X, this method returns the critical point x, such
@ -130,17 +130,17 @@ public class NormalDistributionImpl extends AbstractContinuousDistribution
}
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 &lt; <i>lower bound</i>) &lt; <code>p</code>
*/
protected double getDomainLowerBound(double 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 &lt; <i>lower bound</i>) &lt; <code>p</code>
*/
protected double getDomainLowerBound(double p) {
double ret;
if (p < .5) {
@ -152,16 +152,16 @@ public class NormalDistributionImpl extends AbstractContinuousDistribution
return ret;
}
/**
* 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 &lt; <i>upper bound</i>) &gt; <code>p</code>
*/
protected double getDomainUpperBound(double p) {
/**
* 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 &lt; <i>upper bound</i>) &gt; <code>p</code>
*/
protected double getDomainUpperBound(double p) {
double ret;
if (p < .5) {
@ -173,15 +173,15 @@ public class NormalDistributionImpl extends AbstractContinuousDistribution
return ret;
}
/**
* 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
*/
protected double getInitialDomain(double p) {
/**
* 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
*/
protected double getInitialDomain(double p) {
double ret;
if (p < .5) {
@ -193,5 +193,5 @@ public class NormalDistributionImpl extends AbstractContinuousDistribution
}
return ret;
}
}
}

View File

@ -14,6 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- $Revision$ $Date$ -->
<body>Implementations of common discrete and continuous distributions.</body>
<!-- $Revision$ $Date$ -->
<body>Implementations of common discrete and continuous distributions.</body>
</html>

View File

@ -84,7 +84,7 @@ public class FractionFormat extends Format implements Serializable {
* @return A formatted fraction in proper form.
*/
public static String formatFraction(Fraction f) {
return getImproperInstance().format(f);
return getImproperInstance().format(f);
}
/**

View File

@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- $Revision$ $Date$ -->
<!-- $Revision$ $Date$ -->
<body>
Fraction number type and fraction number formatting.
</body>

View File

@ -14,6 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- $Revision$ $Date$ -->
<body>Common classes used throughout the commons-math library.</body>
<!-- $Revision$ $Date$ -->
<body>Common classes used throughout the commons-math library.</body>
</html>

View File

@ -14,6 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- $Revision$ $Date$ -->
<body>Implementations of special functions such as Beta and Gamma.</body>
<!-- $Revision$ $Date$ -->
<body>Implementations of special functions such as Beta and Gamma.</body>
</html>