Submitted by:	Brent Warden	
Reviewed by:	Mark Diggory


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@141004 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark R. Diggory 2003-10-16 15:24:33 +00:00
parent eb4d267f51
commit a4947309cd
153 changed files with 431 additions and 356 deletions

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -51,17 +51,15 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.commons.math.analysis;
import org.apache.commons.lang.exception.NestableRuntimeException;
package org.apache.commons.math;
/**
* Error thrown when a numerical computation can not be performed because the
* numerical result failed to converge to a finite value.
*
* @version $Revision: 1.4 $ $Date: 2003/10/13 08:09:31 $
* @version $Revision: 1.4 $ $Date: 2003/10/16 15:24:33 $
*/
public class ConvergenceException extends NestableRuntimeException {
public class ConvergenceException extends MathException {
/**
* Default constructor.
*/

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -55,7 +55,7 @@ package org.apache.commons.math;
/**
* Signals a configuration problem with any of the factory methods.
* @version $Revision: 1.8 $ $Date: 2003/10/13 08:11:33 $
* @version $Revision: 1.9 $ $Date: 2003/10/16 15:24:33 $
*/
public class MathConfigurationException extends MathException {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -57,7 +57,7 @@ import org.apache.commons.lang.exception.NestableException;
/**
* A generic exception indicating problems in the math package.
* @version $Revision: 1.7 $ $Date: 2003/10/13 08:11:33 $
* @version $Revision: 1.8 $ $Date: 2003/10/16 15:24:33 $
*/
public class MathException extends NestableException {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -59,7 +59,7 @@ import org.apache.commons.math.MathException;
* Provide the bisection algorithm for solving for zeros of real univariate
* functions. It will only search for one zero in the given interval. The
* function is supposed to be continuous but not necessarily smooth.
* @version $Revision: 1.4 $ $Date: 2003/10/13 08:09:31 $
* @version $Revision: 1.5 $ $Date: 2003/10/16 15:24:31 $
*/
public class BisectionSolver extends UnivariateRealSolverImpl {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -61,7 +61,7 @@ import org.apache.commons.math.MathException;
* It will only search for one zero in the given interval.
* The function is supposed to be continuous but not necessarily smooth.
*
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:09:31 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:31 $
*/
public class BrentSolver extends UnivariateRealSolverImpl {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -64,7 +64,7 @@ import org.apache.commons.math.MathException;
* polynominal coefficents are used.
* Arguments outside of the domain cause an IllegalArgumentException.
*
* @version $Revision: 1.4 $ $Date: 2003/10/13 08:09:31 $
* @version $Revision: 1.5 $ $Date: 2003/10/16 15:24:31 $
*/
public class CubicSplineFunction implements UnivariateRealFunction {
/** Spline segment interval delimiters. Size is N+1 for N segments. */

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -63,7 +63,7 @@ import org.apache.commons.math.MathException;
* It will only search for one zero in the given interval.
* The function is supposed to be continuous but not necessarily smooth.
*
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:09:31 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:31 $
*/
public class SecantSolver extends UnivariateRealSolverImpl {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -56,7 +56,7 @@ package org.apache.commons.math.analysis;
/**
* Computes a natural spline interpolation for the data set.
*
* @version $Revision: 1.6 $ $Date: 2003/10/13 08:09:31 $
* @version $Revision: 1.7 $ $Date: 2003/10/16 15:24:31 $
*
*/
public class SplineInterpolator implements UnivariateRealInterpolator {
@ -144,8 +144,8 @@ public class SplineInterpolator implements UnivariateRealInterpolator {
c[i][3] = (d[i] - d[i - 1]) / delta / 6.0;
c[i][2] = d[i - 1] / 2.0;
c[i][1] =
(yval[i + 1] - yval[i]) / delta
- (d[i] / 2.0 - d[i - 1]) * delta / 3.0;
(yval[i + 1] - yval[i]) / delta -
(d[i] / 2.0 - d[i - 1]) * delta / 3.0;
}
delta = (xval[n] - xval[n - 1]);
c[n - 1][3] = -d[n - 2] / delta / 6.0;

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -62,7 +62,7 @@ import org.apache.commons.math.MathException;
* that derivatives are evaluated after the value, the evaluation algorithm
* should throw an InvalidStateException if it can't cope with this.
*
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:09:31 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:31 $
*/
public interface UnivariateRealFunction {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -58,7 +58,7 @@ import org.apache.commons.math.MathException;
/**
* Interface for interpolating a data set.
*
* @version $Revision: 1.4 $ $Date: 2003/10/13 08:09:31 $
* @version $Revision: 1.5 $ $Date: 2003/10/16 15:24:31 $
*/
public interface UnivariateRealInterpolator {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -60,7 +60,7 @@ import org.apache.commons.math.MathException;
* functions.
* An implementation will only search for one zero in the given interval.
*
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:09:31 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:31 $
*/
public interface UnivariateRealSolver {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -63,7 +63,7 @@ import org.apache.commons.discovery.tools.DiscoverClass;
* (this may be controversial, because the configuration data
* may also be used for the default solver used by the static
* solve() method).
* @version $Revision: 1.7 $ $Date: 2003/10/13 08:09:31 $
* @version $Revision: 1.8 $ $Date: 2003/10/16 15:24:31 $
*/
public abstract class UnivariateRealSolverFactory {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -62,7 +62,7 @@ package org.apache.commons.math.analysis;
* (this may be controversial, because the configuration data
* may also be used for the default solver used by the static
* solve() method).
* @version $Revision: 1.3 $ $Date: 2003/10/13 08:09:31 $
* @version $Revision: 1.4 $ $Date: 2003/10/16 15:24:31 $
*/
public class UnivariateRealSolverFactoryImpl
extends UnivariateRealSolverFactory {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -60,7 +60,7 @@ import org.apache.commons.math.MathException;
* Provide a default implementation for several functions useful to generic
* solvers.
*
* @version $Revision: 1.4 $ $Date: 2003/10/13 08:09:31 $
* @version $Revision: 1.5 $ $Date: 2003/10/16 15:24:31 $
*/
public abstract class UnivariateRealSolverImpl
implements UnivariateRealSolver {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -57,7 +57,7 @@ import org.apache.commons.math.MathException;
/**
* Utility routines for {@link UnivariateRealSolver} objects.
* @version $Revision: 1.2 $ $Date: 2003/10/13 08:09:31 $
* @version $Revision: 1.3 $ $Date: 2003/10/16 15:24:31 $
*/
public class UnivariateRealSolverUtils {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -62,7 +62,7 @@ import org.apache.commons.math.analysis.UnivariateRealSolverUtils;
* implementations for some of the methods that do not vary from distribution
* to distribution.
*
* @version $Revision: 1.10 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.11 $ $Date: 2003/10/16 15:24:29 $
*/
public abstract class AbstractContinuousDistribution
implements ContinuousDistribution {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -59,7 +59,7 @@ package org.apache.commons.math.stat.distribution;
* implementations for some of the methods that do not vary from distribution
* to distribution.
*
* @version $Revision: 1.3 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.4 $ $Date: 2003/10/16 15:24:29 $
*/
public abstract class AbstractDiscreteDistribution
implements DiscreteDistribution {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -65,7 +65,7 @@ package org.apache.commons.math.stat.distribution;
* Binomial Distribution</a></li>
* </ul>
*
* @version $Revision: 1.3 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.4 $ $Date: 2003/10/16 15:24:29 $
*/
public interface BinomialDistribution extends DiscreteDistribution {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -53,13 +53,15 @@
*/
package org.apache.commons.math.stat.distribution;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.math.MathException;
import org.apache.commons.math.special.Beta;
import org.apache.commons.math.util.MathUtils;
/**
* The default implementation of {@link BinomialDistribution}.
*
* @version $Revision: 1.2 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.3 $ $Date: 2003/10/16 15:24:29 $
*/
public class BinomialDistributionImpl extends AbstractDiscreteDistribution
implements BinomialDistribution {
@ -158,8 +160,15 @@ public class BinomialDistributionImpl extends AbstractDiscreteDistribution
} else if (x >= getNumberOfTrials()) {
ret = 1.0;
} else {
ret = 1.0 - Beta.regularizedBeta(getProbabilityOfSuccess(),
x + 1.0, getNumberOfTrials() - x);
try {
ret = 1.0 - Beta.regularizedBeta(getProbabilityOfSuccess(),
x + 1.0, getNumberOfTrials() - x);
} catch (MathException ex) {
LogFactory.getLog(getClass()).error(
"Failed to compute cummulative probability, returning NaN.",
ex);
ret = Double.NaN;
}
}
return ret;
}

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -65,7 +65,7 @@ package org.apache.commons.math.stat.distribution;
* Chi-Squared Distribution</a></li>
* </ul>
*
* @version $Revision: 1.6 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.7 $ $Date: 2003/10/16 15:24:29 $
*/
public interface ChiSquaredDistribution extends ContinuousDistribution {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -56,7 +56,7 @@ package org.apache.commons.math.stat.distribution;
/**
* The default implementation of {@link ChiSquaredDistribution}
*
* @version $Revision: 1.6 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.7 $ $Date: 2003/10/16 15:24:29 $
*/
public class ChiSquaredDistributionImpl
extends AbstractContinuousDistribution

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -56,7 +56,7 @@ package org.apache.commons.math.stat.distribution;
/**
* Base interface for various continuous distributions.
*
* @version $Revision: 1.4 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.5 $ $Date: 2003/10/16 15:24:29 $
*/
public interface ContinuousDistribution {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -56,7 +56,7 @@ package org.apache.commons.math.stat.distribution;
/**
* Base interface for various discrete distributions.
*
* @version $Revision: 1.2 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.3 $ $Date: 2003/10/16 15:24:29 $
*/
public interface DiscreteDistribution {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -75,7 +75,7 @@ import org.apache.commons.discovery.tools.DiscoverClass;
* ChiSquaredDistribution chi = factory.createChiSquareDistribution(5.0);
* </pre>
*
* @version $Revision: 1.13 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.14 $ $Date: 2003/10/16 15:24:29 $
*/
public abstract class DistributionFactory {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -58,7 +58,7 @@ package org.apache.commons.math.stat.distribution;
* A concrete distribution factory. This is the default factory used by
* Commons-Math.
*
* @version $Revision: 1.11 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.12 $ $Date: 2003/10/16 15:24:29 $
*/
public class DistributionFactoryImpl extends DistributionFactory {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -64,7 +64,7 @@ package org.apache.commons.math.stat.distribution;
* <li><a href="http://mathworld.wolfram.com/ExponentialDistribution.html">
* Exponential Distribution</a></li>
*
* @version $Revision: 1.4 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.5 $ $Date: 2003/10/16 15:24:29 $
*/
public interface ExponentialDistribution extends ContinuousDistribution {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -56,7 +56,7 @@ package org.apache.commons.math.stat.distribution;
/**
* The default implementation of {@link ExponentialDistribution}
*
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:29 $
*/
public class ExponentialDistributionImpl
implements ExponentialDistribution {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -65,7 +65,7 @@ package org.apache.commons.math.stat.distribution;
* F-Distribution</a></li>
* </ul>
*
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:29 $
*/
public interface FDistribution extends ContinuousDistribution {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -53,13 +53,15 @@
*/
package org.apache.commons.math.stat.distribution;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.math.MathException;
import org.apache.commons.math.special.Beta;
/**
* Default implementation of
* {@link org.apache.commons.math.stat.distribution.FDistribution}.
*
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:29 $
*/
public class FDistributionImpl
extends AbstractContinuousDistribution
@ -104,9 +106,16 @@ public class FDistributionImpl
double n = getNumeratorDegreesOfFreedom();
double m = getDenominatorDegreesOfFreedom();
ret = Beta.regularizedBeta((n * x) / (m + n * x),
0.5 * n,
0.5 * m);
try {
ret = Beta.regularizedBeta((n * x) / (m + n * x),
0.5 * n,
0.5 * m);
} catch (MathException ex) {
LogFactory.getLog(getClass()).error(
"Failed to compute cummulative probability, returning NaN.",
ex);
ret = Double.NaN;
}
}
return ret;
}

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -65,7 +65,7 @@ package org.apache.commons.math.stat.distribution;
* Gamma Distribution</a></li>
* </ul>
*
* @version $Revision: 1.7 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.8 $ $Date: 2003/10/16 15:24:29 $
*/
public interface GammaDistribution extends ContinuousDistribution {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -53,12 +53,14 @@
*/
package org.apache.commons.math.stat.distribution;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.math.MathException;
import org.apache.commons.math.special.Gamma;
/**
* The default implementation of {@link GammaDistribution}
*
* @version $Revision: 1.8 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.9 $ $Date: 2003/10/16 15:24:29 $
*/
public class GammaDistributionImpl extends AbstractContinuousDistribution
implements GammaDistribution {
@ -101,7 +103,14 @@ public class GammaDistributionImpl extends AbstractContinuousDistribution
if (x <= 0.0) {
ret = 0.0;
} else {
ret = Gamma.regularizedGammaP(getAlpha(), x / getBeta());
try {
ret = Gamma.regularizedGammaP(getAlpha(), x / getBeta());
} catch(MathException ex){
LogFactory.getLog(getClass()).error(
"Failed to compute cummulative probability, returning NaN.",
ex);
ret = Double.NaN;
}
}
return ret;

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -66,7 +66,7 @@ package org.apache.commons.math.stat.distribution;
* Hypergeometric Distribution</a></li>
* </ul>
*
* @version $Revision: 1.2 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.3 $ $Date: 2003/10/16 15:24:29 $
*/
public interface HypergeometricDistribution extends DiscreteDistribution {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -59,7 +59,7 @@ import org.apache.commons.math.util.MathUtils;
/**
* The default implementation of {@link HypergeometricDistribution}.
*
* @version $Revision: 1.2 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.3 $ $Date: 2003/10/16 15:24:29 $
*/
public class HypergeometricDistributionImpl extends AbstractDiscreteDistribution
implements HypergeometricDistribution

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -65,7 +65,7 @@ package org.apache.commons.math.stat.distribution;
* Student's t-Distribution</a></li>
* </ul>
*
* @version $Revision: 1.4 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.5 $ $Date: 2003/10/16 15:24:29 $
*/
public interface TDistribution extends ContinuousDistribution {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -53,13 +53,15 @@
*/
package org.apache.commons.math.stat.distribution;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.math.MathException;
import org.apache.commons.math.special.Beta;
/**
* Default implementation of
* {@link org.apache.commons.math.stat.distribution.TDistribution}.
*
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:29 $
*/
public class TDistributionImpl
extends AbstractContinuousDistribution
@ -107,14 +109,22 @@ public class TDistributionImpl
if (x == 0.0) {
ret = 0.5;
} else {
double t = Beta.regularizedBeta(
getDegreesOfFreedom() / (getDegreesOfFreedom() + (x * x)),
0.5 * getDegreesOfFreedom(), 0.5);
if (x < 0.0) {
ret = 0.5 * t;
} else {
ret = 1.0 - 0.5 * t;
double t;
try {
t = Beta.regularizedBeta(
getDegreesOfFreedom() / (getDegreesOfFreedom() + (x * x)),
0.5 * getDegreesOfFreedom(),
0.5);
if (x < 0.0) {
ret = 0.5 * t;
} else {
ret = 1.0 - 0.5 * t;
}
} catch (MathException ex) {
LogFactory.getLog(getClass()).error(
"Failed to compute cummulative probability, returning NaN.",
ex);
ret = Double.NaN;
}
}

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -56,7 +56,7 @@ package org.apache.commons.math.linear;
/**
* Interface defining a real-valued matrix with basic algebraic operations
* @version $Revision: 1.4 $ $Date: 2003/10/13 08:09:45 $
* @version $Revision: 1.5 $ $Date: 2003/10/16 15:24:33 $
*/
public interface RealMatrix {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -78,7 +78,7 @@ import java.io.Serializable;
* explicitly invoke <code>LUDecompose()</code> to recompute the decomposition
* before using any of the methods above.
*
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:09:45 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:33 $
*/
public class RealMatrixImpl implements RealMatrix, Serializable {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -80,7 +80,7 @@ import org.apache.commons.math.stat.Univariate;
* build grouped frequnecy histograms representing the input data or to
* generate random values "like" those in the input file -- i.e., the values
* generated will follow the distribution of the values in the file.
* @version $Revision: 1.6 $ $Date: 2003/10/13 08:10:01 $
* @version $Revision: 1.7 $ $Date: 2003/10/16 15:24:31 $
*/
public interface EmpiricalDistribution {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -89,7 +89,7 @@ import org.apache.commons.math.stat.UnivariateImpl;
* entry per line.</li>
* </ol></p>
*
* @version $Revision: 1.6 $ $Date: 2003/10/13 08:10:01 $
* @version $Revision: 1.7 $ $Date: 2003/10/16 15:24:31 $
*/
public class EmpiricalDistributionImpl implements Serializable,EmpiricalDistribution {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -57,7 +57,7 @@ import java.util.Collection;
/**
* Random data generation utilities
* @version $Revision: 1.3 $ $Date: 2003/10/13 08:10:01 $
* @version $Revision: 1.4 $ $Date: 2003/10/16 15:24:31 $
*/
public interface RandomData {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -104,7 +104,7 @@ import java.util.Collection;
* (so secure sequences started with calls to reseedSecure(long) won't be
* identical).</li></ul>
*
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:10:01 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:31 $
*/
public class RandomDataImpl implements RandomData {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -78,7 +78,7 @@ import java.net.MalformedURLException;
* standard deviation = <code>sigma</code></li>
* <li> CONSTANT_MODE -- returns <code>mu</code> every time.</li></ul>
*
* @version $Revision: 1.4 $ $Date: 2003/10/13 08:10:01 $
* @version $Revision: 1.5 $ $Date: 2003/10/16 15:24:31 $
*
*/
public class ValueServer {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -53,13 +53,14 @@
*/
package org.apache.commons.math.special;
import org.apache.commons.math.MathException;
import org.apache.commons.math.util.ContinuedFraction;
/**
* This is a utility class that provides computation methods related to the
* Beta family of functions.
*
* @version $Revision: 1.9 $ $Date: 2003/10/13 08:10:13 $
* @version $Revision: 1.10 $ $Date: 2003/10/16 15:24:28 $
*/
public class Beta {
/** Maximum allowed numerical error. */
@ -79,8 +80,11 @@ public class Beta {
* @param a ???
* @param b ???
* @return the regularized beta function I(x, a, b)
* @throws MathException if the algorithm fails to converge.
*/
public static double regularizedBeta(double x, double a, double b) {
public static double regularizedBeta(double x, double a, double b)
throws MathException
{
return regularizedBeta(x, a, b, DEFAULT_EPSILON, Integer.MAX_VALUE);
}
@ -94,10 +98,11 @@ public class Beta {
* series is less than epsilon the approximation ceases
* to calculate further elements in the series.
* @return the regularized beta function I(x, a, b)
* @throws MathException if the algorithm fails to converge.
*/
public static double regularizedBeta(double x, double a, double b,
double epsilon) {
double epsilon) throws MathException
{
return regularizedBeta(x, a, b, epsilon, Integer.MAX_VALUE);
}
@ -109,10 +114,11 @@ public class Beta {
* @param b ???
* @param maxIterations Maximum number of "iterations" to complete.
* @return the regularized beta function I(x, a, b)
* @throws MathException if the algorithm fails to converge.
*/
public static double regularizedBeta(double x, double a, double b,
int maxIterations) {
int maxIterations) throws MathException
{
return regularizedBeta(x, a, b, DEFAULT_EPSILON, maxIterations);
}
@ -137,10 +143,11 @@ public class Beta {
* to calculate further elements in the series.
* @param maxIterations Maximum number of "iterations" to complete.
* @return the regularized beta function I(x, a, b)
* @throws MathException if the algorithm fails to converge.
*/
public static double regularizedBeta(double x, final double a,
final double b, double epsilon, int maxIterations) {
final double b, double epsilon, int maxIterations) throws MathException
{
double ret;
if (Double.isNaN(x) || Double.isNaN(a) || Double.isNaN(b) || (x < 0) ||

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -53,13 +53,14 @@
*/
package org.apache.commons.math.special;
import org.apache.commons.math.analysis.ConvergenceException;
import org.apache.commons.math.ConvergenceException;
import org.apache.commons.math.MathException;
/**
* This is a utility class that provides computation methods related to the
* Gamma family of functions.
*
* @version $Revision: 1.11 $ $Date: 2003/10/13 08:10:13 $
* @version $Revision: 1.12 $ $Date: 2003/10/16 15:24:28 $
*/
public class Gamma {
/** Maximum allowed numerical error. */
@ -99,8 +100,11 @@ public class Gamma {
* @param a ???
* @param x ???
* @return the regularized gamma function P(a, x)
* @throws MathException if the algorithm fails to converge.
*/
public static double regularizedGammaP(double a, double x) {
public static double regularizedGammaP(double a, double x)
throws MathException
{
return regularizedGammaP(a, x, DEFAULT_EPSILON, Integer.MAX_VALUE);
}
@ -128,11 +132,14 @@ public class Gamma {
* to calculate further elements in the series.
* @param maxIterations Maximum number of "iterations" to complete.
* @return the regularized gamma function P(a, x)
* @throws MathException if the algorithm fails to converge.
*/
public static double regularizedGammaP(double a,
double x,
double epsilon,
int maxIterations) {
int maxIterations)
throws MathException
{
double ret;
if (Double.isNaN(a) || Double.isNaN(x) || (a <= 0.0) || (x < 0.0)) {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -59,7 +59,7 @@ import org.apache.commons.math.stat.univariate.rank.Percentile;
/**
* Provides univariate measures for an array of doubles.
* @version $Revision: 1.12 $ $Date: 2003/10/13 08:10:56 $
* @version $Revision: 1.13 $ $Date: 2003/10/16 15:24:30 $
*/
public abstract class AbstractStoreUnivariate
extends AbstractUnivariate

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -68,7 +68,7 @@ import org.apache.commons.math.stat.univariate.summary.SumOfSquares;
/**
* Provides univariate measures for an array of doubles.
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:10:56 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:30 $
*/
public abstract class AbstractUnivariate implements Univariate {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -60,6 +60,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
*
* TODO: add javadocs
*
* @version $Revision: 1.4 $ $Date: 2003/10/16 15:24:30 $
*/
public interface Applyable {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -62,7 +62,7 @@ import org.apache.commons.math.util.BeanTransformer;
* univariate statistics for a List of Java Beans by property. This
* implementation uses beanutils' PropertyUtils to get a simple, nested,
* indexed, mapped, or combined property from an element of a List.
* @version $Revision: 1.8 $ $Date: 2003/10/13 08:10:56 $
* @version $Revision: 1.9 $ $Date: 2003/10/16 15:24:30 $
*/
public class BeanListUnivariateImpl extends ListUnivariateImpl {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -84,7 +84,7 @@ import org.apache.commons.math.stat.distribution.TDistribution;
* the necessary computations to return the requested statistic.</li>
* </ul>
*
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:10:56 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:30 $
*/
public class BivariateRegression {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -63,7 +63,7 @@ import org.apache.commons.collections.HashBag;
* Accepts int, long or string values, converting
* all to Strings and maintaining frequency counts.
*
* @version $Revision: 1.6 $ $Date: 2003/10/13 08:10:56 $
* @version $Revision: 1.7 $ $Date: 2003/10/16 15:24:30 $
*/
public class Frequency {
/** name for this frequency distribution. */

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -60,7 +60,7 @@ import org.apache.commons.math.util.DefaultTransformer;
import org.apache.commons.math.util.NumberTransformer;
/**
* @version $Revision: 1.8 $ $Date: 2003/10/13 08:10:56 $
* @version $Revision: 1.9 $ $Date: 2003/10/16 15:24:30 $
*/
public class ListUnivariateImpl
extends AbstractStoreUnivariate

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -57,7 +57,7 @@ package org.apache.commons.math.stat;
* StatUtils provides easy static implementations of common double[] based
* statistical methods. These return a single result value or in some cases, as
* identified in the javadoc for each method, Double.NaN.
* @version $Revision: 1.17 $ $Date: 2003/10/13 08:10:56 $
* @version $Revision: 1.18 $ $Date: 2003/10/16 15:24:30 $
*/
public final class StatUtils {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -60,7 +60,7 @@ package org.apache.commons.math.stat;
* Univariate provides additional percentile functionality
* such as. This additional functionality comes with
* a price of increased storage costs.
* @version $Revision: 1.8 $ $Date: 2003/10/13 08:10:56 $
* @version $Revision: 1.9 $ $Date: 2003/10/16 15:24:30 $
*/
public interface StoreUnivariate extends Univariate {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -57,7 +57,7 @@ import org.apache.commons.math.stat.univariate.UnivariateStatistic;
import org.apache.commons.math.util.ContractableDoubleArray;
/**
* @version $Revision: 1.9 $ $Date: 2003/10/13 08:10:56 $
* @version $Revision: 1.10 $ $Date: 2003/10/16 15:24:30 $
*/
public class StoreUnivariateImpl extends AbstractStoreUnivariate {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -55,7 +55,7 @@ package org.apache.commons.math.stat;
/**
* A collection of commonly used test statistics and statistical tests.
*
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:10:56 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:30 $
*/
public interface TestStatistic {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -61,7 +61,7 @@ import org.apache.commons.math.stat.distribution.ChiSquaredDistribution;
/**
* Implements test statistics defined in the TestStatistic interface.
*
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:10:56 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:30 $
*/
public class TestStatisticImpl implements TestStatistic {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -69,7 +69,7 @@ package org.apache.commons.math.stat;
* reported statistics will be based on these values<p>
* The default windowSize is "infinite" -- i.e., all values added are included
* in all computations.
* @version $Revision: 1.10 $ $Date: 2003/10/13 08:10:56 $
* @version $Revision: 1.11 $ $Date: 2003/10/16 15:24:30 $
*/
public interface Univariate extends Applyable{
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -67,7 +67,7 @@ import org.apache.commons.math.util.FixedDoubleArray;
* Integers, floats and longs can be added, but they will be converted
* to doubles by addValue().
*
* @version $Revision: 1.22 $ $Date: 2003/10/13 08:10:56 $
* @version $Revision: 1.23 $ $Date: 2003/10/16 15:24:30 $
*/
public class UnivariateImpl
extends AbstractUnivariate

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -59,7 +59,7 @@ package org.apache.commons.math.stat.univariate;
* Provides the ability to extend polymophically so that
* indiviual statistics do not need to implement these methods unless
* there are better algorithms for handling the calculation.
* @version $Revision: 1.8 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.9 $ $Date: 2003/10/16 15:24:33 $
*/
public abstract class AbstractStorelessUnivariateStatistic
extends AbstractUnivariateStatistic

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -57,7 +57,7 @@ package org.apache.commons.math.stat.univariate;
* Abstract Implementation for UnivariateStatistics.
* Provides the ability to extend polymophically so that
* indiviual statistics do not need to implement these methods.
* @version $Revision: 1.7 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.8 $ $Date: 2003/10/16 15:24:33 $
*/
public abstract class AbstractUnivariateStatistic
implements UnivariateStatistic {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -62,7 +62,7 @@ package org.apache.commons.math.stat.univariate;
* implemented using it. If a Statistic cannot be implemented in a Storeless
* approach it should implement the UnivariateStatistic interface directly
* instead.
* @version $Revision: 1.8 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.9 $ $Date: 2003/10/16 15:24:33 $
*/
public interface StorelessUnivariateStatistic extends UnivariateStatistic {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -58,7 +58,7 @@ package org.apache.commons.math.stat.univariate;
* double[] based content using an implemented statistical approach.
* The interface provides two "stateless" simple methods to calculate
* a statistic from a double[] based parameter.
* @version $Revision: 1.7 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.8 $ $Date: 2003/10/16 15:24:33 $
*/
public interface UnivariateStatistic {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -62,7 +62,7 @@ import org.apache.commons.math.stat.univariate.AbstractStorelessUnivariateStatis
* <a href="http://www.spss.com/tech/stat/Algorithms/11.5/descriptives.pdf">
* recursive strategy
* </a>. Both incremental and evaluation strategies currently use this approach.
* @version $Revision: 1.7 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.8 $ $Date: 2003/10/16 15:24:32 $
*/
public class FirstMoment extends AbstractStorelessUnivariateStatistic {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -58,7 +58,7 @@ package org.apache.commons.math.stat.univariate.moment;
* <a href="http://www.spss.com/tech/stat/Algorithms/11.5/descriptives.pdf">
* recursive strategy
* </a>. Both incremental and evaluation strategies currently use this approach.
* @version $Revision: 1.9 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.10 $ $Date: 2003/10/16 15:24:32 $
*/
public class FourthMoment extends ThirdMoment {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -58,7 +58,7 @@ import org.apache.commons.math.stat.univariate.summary.SumOfLogs;
/**
* Returns the <a href="http://www.xycoon.com/geometric_mean.htm">
* geometric mean </a> of the available values
* @version $Revision: 1.10 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.11 $ $Date: 2003/10/16 15:24:32 $
*/
public class GeometricMean extends SumOfLogs {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -62,7 +62,7 @@ import org
.AbstractStorelessUnivariateStatistic;
/**
* @version $Revision: 1.10 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.11 $ $Date: 2003/10/16 15:24:32 $
*/
public class Kurtosis extends AbstractStorelessUnivariateStatistic {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -65,7 +65,7 @@ import org.apache.commons.math.stat.univariate.summary.Sum;
/**
* Returns the <a href="http://www.xycoon.com/arithmetic_mean.htm">
* arithmetic mean </a> of the available values.
* @version $Revision: 1.9 $ $Date: 2003/10/13 08:10:57 $
* @version $Revision: 1.10 $ $Date: 2003/10/16 15:24:32 $
*/
public class Mean extends AbstractStorelessUnivariateStatistic {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -58,7 +58,7 @@ package org.apache.commons.math.stat.univariate.moment;
* <a href="http://www.spss.com/tech/stat/Algorithms/11.5/descriptives.pdf">
* recursive strategy
* </a>. Both incremental and evaluation strategies currently use this approach.
* @version $Revision: 1.8 $ $Date: 2003/10/13 08:10:58 $
* @version $Revision: 1.9 $ $Date: 2003/10/16 15:24:32 $
*/
public class SecondMoment extends FirstMoment {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -56,7 +56,7 @@ package org.apache.commons.math.stat.univariate.moment;
import org.apache.commons.math.stat.univariate.AbstractStorelessUnivariateStatistic;
/**
* @version $Revision: 1.10 $ $Date: 2003/10/13 08:10:58 $
* @version $Revision: 1.11 $ $Date: 2003/10/16 15:24:32 $
*/
public class Skewness extends AbstractStorelessUnivariateStatistic {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -55,7 +55,7 @@ package org.apache.commons.math.stat.univariate.moment;
/**
*
* @version $Revision: 1.8 $ $Date: 2003/10/13 08:10:58 $
* @version $Revision: 1.9 $ $Date: 2003/10/16 15:24:32 $
*/
public class StandardDeviation extends Variance {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -58,7 +58,7 @@ package org.apache.commons.math.stat.univariate.moment;
* <a href="http://www.spss.com/tech/stat/Algorithms/11.5/descriptives.pdf">
* recursive strategy
* </a>. Both incremental and evaluation strategies currently use this approach.
* @version $Revision: 1.8 $ $Date: 2003/10/13 08:10:58 $
* @version $Revision: 1.9 $ $Date: 2003/10/16 15:24:32 $
*/
public class ThirdMoment extends SecondMoment {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -57,7 +57,7 @@ import org.apache.commons.math.stat.univariate.AbstractStorelessUnivariateStatis
/**
*
* @version $Revision: 1.10 $ $Date: 2003/10/13 08:10:58 $
* @version $Revision: 1.11 $ $Date: 2003/10/16 15:24:32 $
*/
public class Variance extends AbstractStorelessUnivariateStatistic {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -62,7 +62,7 @@ import org
.AbstractStorelessUnivariateStatistic;
/**
* @version $Revision: 1.8 $ $Date: 2003/10/13 08:10:58 $
* @version $Revision: 1.9 $ $Date: 2003/10/16 15:24:30 $
*/
public class Max extends AbstractStorelessUnivariateStatistic {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -55,7 +55,7 @@ package org.apache.commons.math.stat.univariate.rank;
/**
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:10:58 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:30 $
*/
public class Median extends Percentile {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -62,7 +62,7 @@ import org
.AbstractStorelessUnivariateStatistic;
/**
* @version $Revision: 1.8 $ $Date: 2003/10/13 08:10:58 $
* @version $Revision: 1.9 $ $Date: 2003/10/16 15:24:30 $
*/
public class Min extends AbstractStorelessUnivariateStatistic {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -57,7 +57,7 @@ import java.util.Arrays;
import org.apache.commons.math.stat.univariate.AbstractUnivariateStatistic;
/**
* @version $Revision: 1.7 $ $Date: 2003/10/16 15:15:04 $
* @version $Revision: 1.8 $ $Date: 2003/10/16 15:24:30 $
*/
public class Percentile extends AbstractUnivariateStatistic {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -62,7 +62,7 @@ import org
.AbstractStorelessUnivariateStatistic;
/**
* @version $Revision: 1.8 $ $Date: 2003/10/13 08:10:58 $
* @version $Revision: 1.9 $ $Date: 2003/10/16 15:24:29 $
*/
public class Product extends AbstractStorelessUnivariateStatistic {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -56,7 +56,7 @@ package org.apache.commons.math.stat.univariate.summary;
import org.apache.commons.math.stat.univariate.AbstractStorelessUnivariateStatistic;
/**
* @version $Revision: 1.10 $ $Date: 2003/10/13 08:10:58 $
* @version $Revision: 1.11 $ $Date: 2003/10/16 15:24:29 $
*/
public class Sum extends AbstractStorelessUnivariateStatistic {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -62,7 +62,7 @@ import org
.AbstractStorelessUnivariateStatistic;
/**
* @version $Revision: 1.8 $ $Date: 2003/10/13 08:10:58 $
* @version $Revision: 1.9 $ $Date: 2003/10/16 15:24:29 $
*/
public class SumOfLogs extends AbstractStorelessUnivariateStatistic {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -62,7 +62,7 @@ import org
.AbstractStorelessUnivariateStatistic;
/**
* @version $Revision: 1.8 $ $Date: 2003/10/13 08:10:58 $
* @version $Revision: 1.9 $ $Date: 2003/10/16 15:24:29 $
*/
public class SumOfSquares extends AbstractStorelessUnivariateStatistic {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -59,7 +59,7 @@ import org.apache.commons.logging.LogFactory;
/**
* Uses PropertyUtils to map a Bean getter to a double value.
* @version $Revision: 1.7 $ $Date: 2003/10/13 08:11:23 $
* @version $Revision: 1.8 $ $Date: 2003/10/16 15:24:30 $
*/
public class BeanTransformer implements NumberTransformer {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -53,7 +53,8 @@
*/
package org.apache.commons.math.util;
import org.apache.commons.math.analysis.ConvergenceException;
import org.apache.commons.math.ConvergenceException;
import org.apache.commons.math.MathException;
/**
* Provides a generic means to evaluate continued fractions. Subclasses simply
@ -64,7 +65,7 @@ import org.apache.commons.math.analysis.ConvergenceException;
* <li><a href="http://mathworld.wolfram.com/ContinuedFraction.html">
* Continued Fraction</a></li>
* </ul>
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:11:23 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:30 $
*/
public abstract class ContinuedFraction {
/** Maximum allowed numerical error. */
@ -99,8 +100,9 @@ public abstract class ContinuedFraction {
* Evaluates the continued fraction at the value x.
* @param x the evaluation point.
* @return the value of the continued fraction evaluated at x.
* @throws MathException if the algorithm fails to converge.
*/
public double evaluate(double x) {
public double evaluate(double x) throws MathException {
return evaluate(x, DEFAULT_EPSILON, Integer.MAX_VALUE);
}
@ -109,8 +111,9 @@ public abstract class ContinuedFraction {
* @param x the evaluation point.
* @param epsilon maximum error allowed.
* @return the value of the continued fraction evaluated at x.
* @throws MathException if the algorithm fails to converge.
*/
public double evaluate(double x, double epsilon) {
public double evaluate(double x, double epsilon) throws MathException {
return evaluate(x, epsilon, Integer.MAX_VALUE);
}
@ -119,8 +122,9 @@ public abstract class ContinuedFraction {
* @param x the evaluation point.
* @param maxIterations maximum number of convergents
* @return the value of the continued fraction evaluated at x.
* @throws MathException if the algorithm fails to converge.
*/
public double evaluate(double x, int maxIterations) {
public double evaluate(double x, int maxIterations) throws MathException {
return evaluate(x, DEFAULT_EPSILON, maxIterations);
}
@ -139,8 +143,11 @@ public abstract class ContinuedFraction {
* @param epsilon maximum error allowed.
* @param maxIterations maximum number of convergents
* @return the value of the continued fraction evaluated at x.
* @throws MathException if the algorithm fails to converge.
*/
public double evaluate(double x, double epsilon, int maxIterations) {
public double evaluate(double x, double epsilon, int maxIterations)
throws MathException
{
double[][] f = new double[2][2];
double[][] a = new double[2][2];
double[][] an = new double[2][2];
@ -165,6 +172,7 @@ public abstract class ContinuedFraction {
* @param maxIterations maximum number of convergents
* @return the value of the the n-th convergent for this continued fraction
* evaluated at x.
* @throws MathException if the algorithm fails to converge.
*/
private double evaluate(
int n,
@ -173,7 +181,8 @@ public abstract class ContinuedFraction {
double[][] an,
double[][] f,
double epsilon,
int maxIterations) {
int maxIterations) throws MathException
{
double ret;
// create next matrix

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -88,7 +88,7 @@ import java.io.Serializable;
* internal storage array is swapped.
* </p>
*
* @version $Revision: 1.6 $ $Date: 2003/10/13 08:11:23 $
* @version $Revision: 1.7 $ $Date: 2003/10/16 15:24:30 $
*/
public class ContractableDoubleArray
extends ExpandableDoubleArray

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -59,7 +59,7 @@ import org.apache.commons.beanutils.converters.DoubleConverter;
/**
* A Default NumberTransformer for java.lang.Numbers and Numeric Strings.
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:11:23 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:30 $
*/
public class DefaultTransformer implements NumberTransformer {
/** Converter used to transform objects. */

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -60,7 +60,7 @@ package org.apache.commons.math.util;
* Collections API by allowing a user to select from a number of
* array implementations with support for various storage mechanisms
* such as automatic expansion, contraction, and array "rolling".
* @version $Revision: 1.4 $ $Date: 2003/10/13 08:11:23 $
* @version $Revision: 1.5 $ $Date: 2003/10/16 15:24:30 $
*/
public interface DoubleArray {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -88,7 +88,7 @@ import java.io.Serializable;
* expand the array 10 times - first from 2 -> 4. then 4 -> 8, 8 -> 16,
* and so on until we reach 4096 which is sufficient to hold 3546 elements.
* </p>
* @version $Revision: 1.7 $ $Date: 2003/10/13 08:11:23 $
* @version $Revision: 1.8 $ $Date: 2003/10/16 15:24:30 $
*/
public class ExpandableDoubleArray implements Serializable, DoubleArray {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -82,7 +82,7 @@ package org.apache.commons.math.util;
* "fixed" in memory, this implementation will never allocate, or copy
* the internal storage array to a new array instance.
* </p>
* @version $Revision: 1.8 $ $Date: 2003/10/13 08:11:23 $
* @version $Revision: 1.9 $ $Date: 2003/10/16 15:24:30 $
*/
public class FixedDoubleArray implements DoubleArray {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -57,7 +57,7 @@ package org.apache.commons.math.util;
/**
* Some useful additions to the built-in functions in {@link Math}.
*
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:11:23 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:30 $
*/
public final class MathUtils {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -57,7 +57,7 @@ import org.apache.commons.math.MathException;
/**
* Subclasses implementing this interface can transform Objects to doubles.
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:11:23 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:30 $
*/
public interface NumberTransformer {
@ -67,6 +67,7 @@ public interface NumberTransformer {
*
* @param o the Object to be transformed.
* @return the double value of the Object.
* @throws MathException if the Object can not be transformed into a Double.
*/
double transform(Object o) throws MathException;
}

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -63,7 +63,7 @@ import java.util.Set;
* It provides a means to set NumberTransformers that will be selected
* based on the Class of the object handed to the Maps
* <code>double transform(Object o)</code> method.
* @version $Revision: 1.4 $ $Date: 2003/10/13 08:11:23 $
* @version $Revision: 1.5 $ $Date: 2003/10/16 15:24:30 $
*/
public class TransformerMap implements NumberTransformer {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -57,7 +57,7 @@ package org.apache.commons.math;
import junit.framework.TestCase;
/**
* @version $Revision: 1.2 $ $Date: 2003/10/13 08:09:07 $
* @version $Revision: 1.3 $ $Date: 2003/10/16 15:24:33 $
*/
public class MathConfigurationExceptionTest extends TestCase {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -57,7 +57,7 @@ package org.apache.commons.math;
import junit.framework.TestCase;
/**
* @version $Revision: 1.2 $ $Date: 2003/10/13 08:09:07 $
* @version $Revision: 1.3 $ $Date: 2003/10/16 15:24:33 $
*/
public class MathExceptionTest extends TestCase {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -57,7 +57,7 @@ package org.apache.commons.math;
import junit.framework.Assert;
/**
* @version $Revision: 1.3 $ $Date: 2003/10/13 08:09:07 $
* @version $Revision: 1.4 $ $Date: 2003/10/16 15:24:33 $
*/
public class TestUtils {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -58,7 +58,7 @@ import org.apache.commons.math.MathException;
import junit.framework.TestCase;
/**
* @version $Revision: 1.4 $ $Date: 2003/10/13 08:09:07 $
* @version $Revision: 1.5 $ $Date: 2003/10/16 15:24:28 $
*/
public final class BisectionSolverTest extends TestCase {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -54,10 +54,12 @@
package org.apache.commons.math.analysis;
import org.apache.commons.math.ConvergenceException;
import junit.framework.TestCase;
/**
* @version $Revision: 1.2 $ $Date: 2003/10/13 08:09:07 $
* @version $Revision: 1.3 $ $Date: 2003/10/16 15:24:28 $
*/
public class ConvergenceExceptionTest extends TestCase {
/**

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -62,7 +62,7 @@ import junit.framework.TestSuite;
/**
* Test the interpolation framework.
*
* @version $Revision: 1.4 $ $Date: 2003/10/13 08:09:07 $
* @version $Revision: 1.5 $ $Date: 2003/10/16 15:24:28 $
*/
public class InterpolatorTest extends TestCase {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -58,7 +58,7 @@ import org.apache.commons.math.MathException;
/**
* Auxillary class for testing solvers.
*
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:09:08 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:28 $
*/
public class QuinticFunction implements UnivariateRealFunction {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -69,7 +69,7 @@ import junit.framework.TestSuite;
* default absolute accuracy of 10E-8 for sinus and the quintic function around
* zero, and 5..10 iterations for the other zeros.
*
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:09:08 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:28 $
*/
public final class RealSolverTest extends TestCase {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -63,7 +63,7 @@ import org.apache.commons.math.MathException;
* which means linear approximation (Regula Falsi) will converge
* quadratically.
*
* @version $Revision: 1.5 $ $Date: 2003/10/13 08:09:08 $
* @version $Revision: 1.6 $ $Date: 2003/10/16 15:24:28 $
*/
public class SinFunction implements UnivariateRealFunction {

View File

@ -29,7 +29,7 @@
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* nor may "Apache" appear in their name without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@ -59,7 +59,7 @@ import org.apache.commons.math.MathException;
import junit.framework.TestCase;
/**
* @version $Revision: 1.2 $ $Date: 2003/10/13 08:09:08 $
* @version $Revision: 1.3 $ $Date: 2003/10/16 15:24:28 $
*/
public class UnivariateRealSolverUtilsTest extends TestCase {
/**

Some files were not shown because too many files have changed in this diff Show More