You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ps...@apache.org on 2005/12/22 22:17:07 UTC

svn commit: r358631 [1/3] - in /jakarta/commons/proper/math/trunk: ./ src/conf/ src/java/org/apache/commons/math/ src/java/org/apache/commons/math/analysis/ src/java/org/apache/commons/math/complex/ src/java/org/apache/commons/math/distribution/ src/ja...

Author: psteitz
Date: Thu Dec 22 13:16:32 2005
New Revision: 358631

URL: http://svn.apache.org/viewcvs?rev=358631&view=rev
Log:
Merged (final) src changes from MATH_1_1 release branch r321516-358399

Added:
    jakarta/commons/proper/math/trunk/src/conf/manifestMods.txt   (with props)
Removed:
    jakarta/commons/proper/math/trunk/src/conf/MANIFEST.MF
Modified:
    jakarta/commons/proper/math/trunk/build.xml
    jakarta/commons/proper/math/trunk/project.xml
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/ConvergenceException.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/FunctionEvaluationException.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/MathConfigurationException.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/MathException.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BisectionSolver.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BrentSolver.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/NewtonSolver.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/PolynomialFunction.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/PolynomialSplineFunction.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/SecantSolver.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/SplineInterpolator.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/UnivariateRealSolverImpl.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/Complex.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/ComplexFormat.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/ComplexUtils.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractDistribution.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/BinomialDistributionImpl.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ExponentialDistributionImpl.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/FDistributionImpl.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/GammaDistributionImpl.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/HypergeometricDistributionImpl.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/NormalDistributionImpl.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/PoissonDistributionImpl.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/TDistributionImpl.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/WeibullDistributionImpl.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/Fraction.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/FractionFormat.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/ProperFractionFormat.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BigMatrixImpl.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/InvalidMatrixException.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixIndexException.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixImpl.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomData.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomDataImpl.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/Frequency.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/AbstractStorelessUnivariateStatistic.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/AbstractUnivariateStatistic.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/DescriptiveStatistics.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/DescriptiveStatisticsImpl.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/StatisticalSummaryValues.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/SummaryStatisticsImpl.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/FirstMoment.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/FourthMoment.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/GeometricMean.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Kurtosis.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Mean.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/SecondMoment.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Skewness.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/StandardDeviation.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/ThirdMoment.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/moment/Variance.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Max.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Median.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Min.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/rank/Percentile.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/Product.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/Sum.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/SumOfLogs.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/descriptive/summary/SumOfSquares.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/regression/SimpleRegression.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/util/ContinuedFraction.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/util/DefaultTransformer.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/util/ResizableDoubleArray.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/util/TransformerMap.java
    jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/util/package.html
    jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/TestUtils.java
    jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/LaguerreSolverTest.java
    jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/NewtonSolverTest.java
    jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/QuinticFunction.java
    jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/complex/ComplexTest.java
    jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/complex/ComplexUtilsTest.java
    jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/distribution/HypergeometricDistributionTest.java
    jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/distribution/PoissonDistributionTest.java
    jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/random/EmpiricalDistributionTest.java
    jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/random/RandomDataTest.java
    jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/StatUtilsTest.java
    jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/ListUnivariateImpl.java
    jakarta/commons/proper/math/trunk/src/test/org/apache/commons/math/stat/descriptive/rank/PercentileTest.java
    jakarta/commons/proper/math/trunk/xdocs/changes.xml

Modified: jakarta/commons/proper/math/trunk/build.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/build.xml?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/build.xml (original)
+++ jakarta/commons/proper/math/trunk/build.xml Thu Dec 22 13:16:32 2005
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<!--build.xml generated by maven from project.xml version 1.1-RC2
-  on date August 8 2005, time 2359-->
+<!--build.xml generated by maven from project.xml version 1.2-SNAPSHOT
+  on date December 22 2005, time 1344-->
 
 <project default="jar" name="commons-math" basedir=".">
   <!--Load local and user build preferences-->
@@ -26,7 +26,7 @@
   </property>
   <property name="javadocdir" value="${basedir}/dist/docs/api">
   </property>
-  <property name="final.name" value="commons-math-1.1-RC2">
+  <property name="final.name" value="commons-math-1.2-SNAPSHOT">
   </property>
   <property name="proxy.host" value="">
   </property>
@@ -176,7 +176,7 @@
     </tstamp>
     <property name="copyright" value="Copyright &amp;copy;  The Apache Software Foundation. All Rights Reserved.">
     </property>
-    <property name="title" value="Math 1.1-RC2 API">
+    <property name="title" value="Math 1.2-SNAPSHOT API">
     </property>
     <javadoc use="true" private="true" destdir="${javadocdir}" author="true" version="true" sourcepath="${basedir}/src/java" packagenames="org.apache.commons.math.*">
       <classpath>

Modified: jakarta/commons/proper/math/trunk/project.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/project.xml?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/project.xml (original)
+++ jakarta/commons/proper/math/trunk/project.xml Thu Dec 22 13:16:32 2005
@@ -105,6 +105,11 @@
       <name>1.1</name>
       <tag>MATH_1_1</tag>
     </version>
+    <version>
+      <id>1.2-SNAPSHOT</id>
+      <name>1.1</name>
+      <tag>trunk</tag>
+    </version>
   </versions>
   <developers>
     <developer>

Added: jakarta/commons/proper/math/trunk/src/conf/manifestMods.txt
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/conf/manifestMods.txt?rev=358631&view=auto
==============================================================================
--- jakarta/commons/proper/math/trunk/src/conf/manifestMods.txt (added)
+++ jakarta/commons/proper/math/trunk/src/conf/manifestMods.txt Thu Dec 22 13:16:32 2005
@@ -0,0 +1,3 @@
+Build-Jdk: 1.3.1_16
+Specification-Version: 1.1
+Implementation-Vendor-Id: org.apache

Propchange: jakarta/commons/proper/math/trunk/src/conf/manifestMods.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/commons/proper/math/trunk/src/conf/manifestMods.txt
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/commons/proper/math/trunk/src/conf/manifestMods.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/ConvergenceException.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/ConvergenceException.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/ConvergenceException.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/ConvergenceException.java Thu Dec 22 13:16:32 2005
@@ -26,7 +26,7 @@
 public class ConvergenceException extends MathException implements Serializable{
     
     /** Serializable version identifier */
-    static final long serialVersionUID = -3657394299929217890L;
+    private static final long serialVersionUID = -3657394299929217890L;
     
     /**
      * Default constructor.

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/FunctionEvaluationException.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/FunctionEvaluationException.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/FunctionEvaluationException.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/FunctionEvaluationException.java Thu Dec 22 13:16:32 2005
@@ -26,7 +26,7 @@
 public class FunctionEvaluationException extends MathException  {
     
     /** Serializable version identifier */
-    static final long serialVersionUID = -317289374378977972L;
+    private static final long serialVersionUID = -317289374378977972L;
     
     /** Argument causing function evaluation failure */
     private double argument = Double.NaN;

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/MathConfigurationException.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/MathConfigurationException.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/MathConfigurationException.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/MathConfigurationException.java Thu Dec 22 13:16:32 2005
@@ -24,7 +24,7 @@
 public class MathConfigurationException extends MathException implements Serializable {
     
     /** Serializable version identifier */
-    static final long serialVersionUID = -7958299004965931723L;
+    private static final long serialVersionUID = -7958299004965931723L;
 
     /**
      * Default constructor.

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/MathException.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/MathException.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/MathException.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/MathException.java Thu Dec 22 13:16:32 2005
@@ -31,7 +31,7 @@
 public class MathException extends Exception {
     
     /** Serializable version identifier */
-    static final long serialVersionUID = -8594613561393443827L;
+    private static final long serialVersionUID = -8594613561393443827L;
     
     /**
      * Does JDK support nested exceptions?

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BisectionSolver.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BisectionSolver.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BisectionSolver.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BisectionSolver.java Thu Dec 22 13:16:32 2005
@@ -29,7 +29,7 @@
 public class BisectionSolver extends UnivariateRealSolverImpl {
     
     /** Serializable version identifier */
-    static final long serialVersionUID = 7137520585963699578L;
+    private static final long serialVersionUID = 7137520585963699578L;
     
     /**
      * Construct a solver for the given function.

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BrentSolver.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BrentSolver.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BrentSolver.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/BrentSolver.java Thu Dec 22 13:16:32 2005
@@ -30,7 +30,7 @@
 public class BrentSolver extends UnivariateRealSolverImpl {
     
     /** Serializable version identifier */
-    static final long serialVersionUID = 3350616277306882875L;
+    private static final long serialVersionUID = 3350616277306882875L;
 
     /**
      * Construct a solver for the given function.

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/NewtonSolver.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/NewtonSolver.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/NewtonSolver.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/NewtonSolver.java Thu Dec 22 13:16:32 2005
@@ -16,6 +16,7 @@
 
 package org.apache.commons.math.analysis;
 
+import java.io.IOException;
 import org.apache.commons.math.ConvergenceException;
 import org.apache.commons.math.FunctionEvaluationException; 
 
@@ -30,10 +31,10 @@
 public class NewtonSolver extends UnivariateRealSolverImpl {
     
     /** Serializable version identifier */
-    static final long serialVersionUID = 2606474895443431607L;
+    private static final long serialVersionUID = 2606474895443431607L;
     
     /** The first derivative of the target function. */
-    private UnivariateRealFunction derivative;
+    private transient UnivariateRealFunction derivative;
     
     /**
      * Construct a solver for the given function.
@@ -97,5 +98,17 @@
         throw new ConvergenceException
             ("Maximum number of iterations exceeded " + i);
     }
-
+    
+    /**
+     * Custom deserialization to initialize transient deriviate field.
+     * 
+     * @param in serialized object input stream
+     * @throws IOException if IO error occurs 
+     * @throws ClassNotFoundException if instantiation error occurs
+     */
+    private void readObject(java.io.ObjectInputStream in)
+    throws IOException, ClassNotFoundException {
+        in.defaultReadObject();
+        derivative = ((DifferentiableUnivariateRealFunction) f).derivative();
+    }    
 }

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/PolynomialFunction.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/PolynomialFunction.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/PolynomialFunction.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/PolynomialFunction.java Thu Dec 22 13:16:32 2005
@@ -28,7 +28,7 @@
 public class PolynomialFunction implements DifferentiableUnivariateRealFunction, Serializable {
 
     /** Serializable version identifier */
-    static final long serialVersionUID = 3322454535052136809L;
+    private static final long serialVersionUID = 3322454535052136809L;
     
     /**
      * The coefficients of the polynomial, ordered by degree -- i.e.,  

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/PolynomialSplineFunction.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/PolynomialSplineFunction.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/PolynomialSplineFunction.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/PolynomialSplineFunction.java Thu Dec 22 13:16:32 2005
@@ -52,10 +52,11 @@
  *
  * @version $Revision$ $Date$
  */
-public class PolynomialSplineFunction implements UnivariateRealFunction, Serializable {
+public class PolynomialSplineFunction 
+    implements DifferentiableUnivariateRealFunction, Serializable {
    
     /** Serializable version identifier */
-    static final long serialVersionUID = 7011031166416885789L;
+    private static final long serialVersionUID = 7011031166416885789L;
     
     /** Spline segment interval delimiters (knots).   Size is n+1 for n segments. */
     private double knots[];

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/SecantSolver.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/SecantSolver.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/SecantSolver.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/SecantSolver.java Thu Dec 22 13:16:32 2005
@@ -40,7 +40,7 @@
 public class SecantSolver extends UnivariateRealSolverImpl implements Serializable {
     
     /** Serializable version identifier */
-    static final long serialVersionUID = 1984971194738974867L;
+    private static final long serialVersionUID = 1984971194738974867L;
     
     /**
      * Construct a solver for the given function.

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/SplineInterpolator.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/SplineInterpolator.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/SplineInterpolator.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/SplineInterpolator.java Thu Dec 22 13:16:32 2005
@@ -16,7 +16,7 @@
 package org.apache.commons.math.analysis;
 
 /**
- * Computes a natural (a.k.a. "free", "unclamped") cubic spline interpolation for the data set.
+ * Computes a natural (also known as "free", "unclamped") cubic spline interpolation for the data set.
  * <p>
  * The {@link #interpolate(double[], double[])} method returns a {@link PolynomialSplineFunction}
  * consisting of n cubic polynomials, defined over the subintervals determined by the x values,  

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/UnivariateRealSolverImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/UnivariateRealSolverImpl.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/UnivariateRealSolverImpl.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/UnivariateRealSolverImpl.java Thu Dec 22 13:16:32 2005
@@ -30,7 +30,7 @@
     Serializable {
 
     /** Serializable version identifier */
-    static final long serialVersionUID = 1112491292565386596L;
+    private static final long serialVersionUID = 1112491292565386596L;
     
     /** Maximum absolute error. */
     protected double absoluteAccuracy;
@@ -265,9 +265,9 @@
      */
     protected boolean isBracketing(double lower, double upper, 
             UnivariateRealFunction f) throws FunctionEvaluationException {
-    	double f1 = f.value(lower);
-    	double f2 = f.value(upper);
-    	return ((f1 > 0 && f2 < 0) || (f1 < 0 && f2 > 0));
+        double f1 = f.value(lower);
+        double f2 = f.value(upper);
+        return ((f1 > 0 && f2 < 0) || (f1 < 0 && f2 > 0));
     }
     
     /**

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/Complex.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/Complex.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/Complex.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/Complex.java Thu Dec 22 13:16:32 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2004 The Apache Software Foundation.
+ * Copyright 2003-2005 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,6 +22,16 @@
 /**
  * Representation of a Complex number - a number which has both a 
  * real and imaginary part.
+ * <p>
+ * Implementations of arithmetic operations handle <code>NaN</code> and
+ * infinite values according to the rules for {@link java.lang.Double}
+ * arithmetic, applying definitional formulas and returning <code>NaN</code> or
+ * infinite values in real or imaginary parts as these arise in computation. 
+ * See individual method javadocs for details.
+ * <p>
+ * {@link #equals} identifies all values with <code>NaN</code> in either real 
+ * or imaginary part - e.g., <pre>
+ * <code>1 + NaNi  == NaN + i == NaN + NaNi.</code></pre>
  *
  * @author Apache Software Foundation
  * @version $Revision$ $Date$
@@ -29,28 +39,31 @@
 public class Complex implements Serializable  {
 
     /** Serializable version identifier */
-    static final long serialVersionUID = -6530173849413811929L;
+    private static final long serialVersionUID = -6530173849413811929L;
     
-    /** The square root of -1. A number representing "0.0 + 1.0i".*/    
+    /** The square root of -1. A number representing "0.0 + 1.0i" */    
     public static final Complex I = new Complex(0.0, 1.0);
     
-    /** A complex number analogous to {@link java.lang.Double#NaN} */
+    /** A complex number representing "NaN + NaNi" */
     public static final Complex NaN = new Complex(Double.NaN, Double.NaN);
 
     /** A complex number representing "1.0 + 0.0i" */    
     public static final Complex ONE = new Complex(1.0, 0.0);
     
-    /** The imaginary part. */
+    /** A complex number representing "0.0 + 0.0i" */    
+    public static final Complex ZERO = new Complex(0.0, 0.0);
+    
+    /** The imaginary part */
     protected double imaginary;
     
-    /** The real part. */
+    /** The real part */
     protected double real;
     
     /**
      * Create a complex number given the real and imaginary parts.
      *
-     * @param real the real part.
-     * @param imaginary the imaginary part.
+     * @param real the real part
+     * @param imaginary the imaginary part
      */
     public Complex(double real, double imaginary) {
         super();
@@ -60,13 +73,23 @@
 
     /**
      * Return the absolute value of this complex number.
+     * <p>
+     * Returns <code>NaN</code> if either real or imaginary part is
+     * <code>NaN</code> and <code>Double.POSITIVE_INFINITY</code> if
+     * neither part is <code>NaN</code>, but at least one part takes an infinite
+     * value.
      *
-     * @return the absolute value.
+     * @return the absolute value
      */
     public double abs() {
         if (isNaN()) {
             return Double.NaN;
         }
+        
+        if (isInfinite()) {
+            return Double.POSITIVE_INFINITY;
+        }
+        
         if (Math.abs(real) < Math.abs(imaginary)) {
             if (imaginary == 0.0) {
                 return Math.abs(real);
@@ -84,38 +107,81 @@
     
     /**
      * Return the sum of this complex number and the given complex number.
-     *
-     * @param rhs the other complex number.
-     * @return the complex number sum.
+     * <p>
+     * Uses the definitional formula 
+     * <pre>
+     * (a + bi) + (c + di) = (a+c) + (b+d)i
+     * </pre>
+     * <p>
+     * If either this or <code>rhs</code> has a NaN value in either part,
+     * {@link #NaN} is returned; otherwise Inifinite and NaN values are
+     * returned in the parts of the result according to the rules for
+     * {@link java.lang.Double} arithmetic. 
+     *
+     * @param rhs the other complex number
+     * @return the complex number sum
+     * @throws NullPointerException if <code>rhs</code> is null
      */
-    public Complex add(Complex rhs) {
-        if (isNaN() || rhs.isNaN()) {
-            return NaN;
-        }
-        
+    public Complex add(Complex rhs) {   
         return new Complex(real + rhs.getReal(),
             imaginary + rhs.getImaginary());
     }
     
     /**
-     * Return the conjugate of this complex number.  The conjugate of
-     * "A + Bi" is "A - Bi".  Complex.NaN is returned if either the real or imaginary part of 
-     * this Complex number equals Double.NaN.
+     * Return the conjugate of this complex number. The conjugate of
+     * "A + Bi" is "A - Bi". 
+     * <p>
+     * {@link #NaN} is returned if either the real or imaginary
+     * part of this Complex number equals <code>Double.NaN</code>.
+     * <p>
+     * If the imaginary part is infinite, and the real part is not NaN, 
+     * the returned value has infinite imaginary part of the opposite
+     * sign - e.g. the conjugate of <code>1 + POSITIVE_INFINITY i</code>
+     * is <code>1 - NEGATIVE_INFINITY i</code>
      *
      * @return the conjugate of this Complex object
      */
     public Complex conjugate() {
         if (isNaN()) {
             return NaN;
-        }
-        
+        }   
         return new Complex(real, -imaginary);
     }
     
     /**
      * Return the quotient of this complex number and the given complex number.
-     * @param rhs the other complex number.
-     * @return the complex number quotient.
+     * <p>
+     * Implements the definitional formula
+     * <pre><code>
+     *    a + bi          ac + bd + (bc - ad)i
+     *    ----------- = -------------------------
+     *    c + di               c<sup>2</sup> + d<sup>2</sup>
+     * </code></pre>
+     * but uses 
+     * <a href="http://doi.acm.org/10.1145/1039813.1039814">
+     * prescaling of operands</a> to limit the effects of overflows and
+     * underflows in the computation.
+     * <p>
+     * Infinite and NaN values are handled / returned according to the
+     * following rules, applied in the order presented:
+     * <ul>
+     * <li>If either this or <code>rhs</code> has a NaN value in either part,
+     *  {@link #NaN} is returned.</li>
+     * <li>If <code>rhs</code> equals {@link #ZERO}, {@link #NaN} is returned.
+     * </li>
+     * <li>If this and <code>rhs</code> are both infinite,
+     * {@link #NaN} is returned.</li>
+     * <li>If this is finite (i.e., has no infinite or NaN parts) and
+     *  <code>rhs</code> is infinite (one or both parts infinite), 
+     * {@link #ZERO} is returned.</li>
+     * <li>If this is infinite and <code>rhs</code> is finite, NaN values are
+     * returned in the parts of the result if the {@link java.lang.Double}
+     * rules applied to the definitional formula force NaN results.</li>
+     * </ul>
+     * 
+     * @param rhs the other complex number
+     * @return the complex number quotient
+     * @throws NullPointerException if <code>rhs</code> is null
      */
     public Complex divide(Complex rhs) {
         if (isNaN() || rhs.isNaN()) {
@@ -125,7 +191,11 @@
         double c = rhs.getReal();
         double d = rhs.getImaginary();
         if (c == 0.0 && d == 0.0) {
-            throw new ArithmeticException("Error: division by zero.");
+            return NaN;
+        }
+        
+        if (rhs.isInfinite() && !isInfinite()) {
+            return ZERO;
         }
 
         if (Math.abs(c) < Math.abs(d)) {
@@ -156,13 +226,13 @@
      * <p>
      * All <code>NaN</code> values are considered to be equal - i.e, if either
      * (or both) real and imaginary parts of the complex number are equal
-     * to Double.NaN, the complex number is equal to 
+     * to <code>Double.NaN</code>, the complex number is equal to 
      * <code>Complex.NaN</code>.
      *
      * @param other Object to test for equality to this
      * @return true if two Complex objects are equal, false if
      *         object is null, not an instance of Complex, or
-     *         not equal to this Complex instance.
+     *         not equal to this Complex instance
      * 
      */
     public boolean equals(Object other) {
@@ -210,7 +280,7 @@
     /**
      * Access the imaginary part.
      *
-     * @return the imaginary part.
+     * @return the imaginary part
      */
     public double getImaginary() {
         return imaginary;
@@ -219,44 +289,76 @@
     /**
      * Access the real part.
      *
-     * @return the real part.
+     * @return the real part
      */
     public double getReal() {
         return real;
     }
     
     /**
-     * Returns true if this complex number is the special Not-a-Number (NaN)
-     * value.
+     * Returns true if either or both parts of this complex number is NaN;
+     * false otherwise
      *
-     * @return true if the value represented by this object is NaN; false
-     *         otherwise.
+     * @return  true if either or both parts of this complex number is NaN;
+     * false otherwise
      */
     public boolean isNaN() {
         return Double.isNaN(real) || Double.isNaN(imaginary);        
     }
     
     /**
+     * Returns true if either the real or imaginary part of this complex number
+     * takes an infinite value (either <code>Double.POSITIVE_INFINITY</code> or 
+     * <code>Double.NEGATIVE_INFINITY</code>) and neither part
+     * is <code>NaN</code>.
+     * 
+     * @return true if one or both parts of this complex number are infinite
+     * and neither part is <code>NaN</code>
+     */
+    public boolean isInfinite() {
+        return !isNaN() && 
+        (Double.isInfinite(real) || Double.isInfinite(imaginary));        
+    }
+    
+    /**
      * Return the product of this complex number and the given complex number.
-     *
-     * @param rhs the other complex number.
-     * @return the complex number product.
+     * <p>
+     * Implements the definitional formula:
+     * <pre><code>
+     * (a + bi)(c + di) = (ac - bd) + (ad + bc)i
+     * </code></pre>
+     * <p>
+     * Returns {@link #NaN} if either this or <code>rhs</code> has one or more
+     * NaN parts.
+     * <p>
+     * Returns NaN or infinite values in components of the result per the
+     * definitional formula and and the rules for {@link java.lang.Double}
+     * arithmetic.  Examples:
+     * <pre><code>
+     *  (1 + i) (INF + i)  =  INF + INFi
+     *  (1 + INFi) (1 - INFi) = INF + NaNi
+     *  (-INF + -INFi)(1 + NaNi) = NaN + NaNi
+     *  </code></pre>
+     * 
+     * @param rhs the other complex number
+     * @return the complex number product
+     * @throws NullPointerException if <code>rhs</code> is null
      */
     public Complex multiply(Complex rhs) {
         if (isNaN() || rhs.isNaN()) {
             return NaN;
         }
-        
-        double p = (real + imaginary) * (rhs.getReal() + rhs.getImaginary());
-        double ac = real * rhs.getReal();
-        double bd = imaginary * rhs.getImaginary();
-        return new Complex(ac - bd, p - ac - bd);
+        return new Complex(real * rhs.real - imaginary * rhs.imaginary,
+                real * rhs.imaginary + imaginary * rhs.real);
     }
     
     /**
      * Return the additive inverse of this complex number.
+     * <p>
+     * Returns <code>Complex.NaN</code> if either real or imaginary
+     * part of this Complex number equals <code>Double.NaN</code>.
      *
-     * @return the negation of this complex number.
+     * @return the negation of this complex number
      */
     public Complex negate() {
         if (isNaN()) {
@@ -269,9 +371,20 @@
     /**
      * Return the difference between this complex number and the given complex
      * number.
-     *
-     * @param rhs the other complex number.
-     * @return the complex number difference.
+      * <p>
+     * Uses the definitional formula 
+     * <pre>
+     * (a + bi) - (c + di) = (a-c) + (b-d)i
+     * </pre>
+     * <p>
+     * If either this or <code>rhs</code> has a NaN value in either part,
+     * {@link #NaN} is returned; otherwise inifinite and NaN values are
+     * returned in the parts of the result according to the rules for
+     * {@link java.lang.Double} arithmetic. 
+     * 
+     * @param rhs the other complex number
+     * @return the complex number difference
+     * @throws NullPointerException if <code>rhs</code> is null
      */
     public Complex subtract(Complex rhs) {
         if (isNaN() || rhs.isNaN()) {

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/ComplexFormat.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/ComplexFormat.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/ComplexFormat.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/ComplexFormat.java Thu Dec 22 13:16:32 2005
@@ -35,7 +35,7 @@
 public class ComplexFormat extends Format implements Serializable {
     
     /** Serializable version identifier */
-    static final long serialVersionUID = -6337346779577272306L;
+    private static final long serialVersionUID = -6337346779577272306L;
     
     /** The default imaginary character. */
     private static final String DEFAULT_IMAGINARY_CHARACTER = "i";

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/ComplexUtils.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/ComplexUtils.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/ComplexUtils.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/complex/ComplexUtils.java Thu Dec 22 13:16:32 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 2003-2004 The Apache Software Foundation.
+ * Copyright 2003-2005 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,14 +19,20 @@
 import org.apache.commons.math.util.MathUtils;
 
 /**
- * Implementations of various transcendental functions for
- * {@link org.apache.commons.math.complex.Complex} arguments.
- *
+ * Static implementations of common 
+ * {@link org.apache.commons.math.complex.Complex}-valued functions.  Included
+ * are trigonometric, exponential, log, power and square root functions.
+ *<p>
  * Reference:
  * <ul>
  * <li><a href="http://myweb.lmu.edu/dmsmith/ZMLIB.pdf">
  * Multiple Precision Complex Arithmetic and Functions</a></li>
  * </ul>
+ * See individual method javadocs for the computational formulas used.
+ * In general, NaN values in either real or imaginary parts of input arguments
+ * result in {@link Complex#NaN} returned.  Otherwise, infinite or NaN values
+ * are returned as they arise in computing the real functions specified in the
+ * computational formulas.  Null arguments result in NullPointerExceptions.
  *
  * @version $Revision$ $Date$
  */
@@ -40,10 +46,19 @@
     }
     
     /**
-     * Compute the <a href="http://mathworld.wolfram.com/InverseCosine.html">
+     * Compute the 
+     * <a href="http://mathworld.wolfram.com/InverseCosine.html" TARGET="_top">
      * inverse cosine</a> for the given complex argument.
-     * @param z the value whose inverse cosine is to be returned.
-     * @return the inverse cosine of <code>z</code>.
+     * <p>
+     * Implements the formula: <pre>
+     * <code> acos(z) = -i (log(z + i (sqrt(1 - z<sup>2</sup>))))</code></pre>
+     * <p>
+     * Returns {@link Complex#NaN} if either real or imaginary part of the 
+     * input argument is <code>NaN</code> or infinite.
+     * 
+     * @param z the value whose inverse cosine is to be returned
+     * @return the inverse cosine of <code>z</code>
+     * @throws NullPointerException if <code>z</code> is null
      */
     public static Complex acos(Complex z) {
         if (z.isNaN()) {
@@ -55,10 +70,19 @@
     }
     
     /**
-     * Compute the <a href="http://mathworld.wolfram.com/InverseSine.html">
+     * Compute the 
+     * <a href="http://mathworld.wolfram.com/InverseSine.html" TARGET="_top">
      * inverse sine</a> for the given complex argument.
+     * <p>
+     * Implements the formula: <pre>
+     * <code> asin(z) = -i (log(sqrt(1 - z<sup>2</sup>) + iz)) </code></pre>
+     * <p>
+     * Returns {@link Complex#NaN} if either real or imaginary part of the 
+     * input argument is <code>NaN</code> or infinite.
+     * 
      * @param z the value whose inverse sine is to be returned.
      * @return the inverse sine of <code>z</code>.
+     * @throws NullPointerException if <code>z</code> is null
      */
     public static Complex asin(Complex z) {
         if (z.isNaN()) {
@@ -70,27 +94,56 @@
     }
     
     /**
-     * Compute the <a href="http://mathworld.wolfram.com/InverseTangent.html">
+     * Compute the 
+     * <a href="http://mathworld.wolfram.com/InverseTangent.html" TARGET="_top">
      * inverse tangent</a> for the given complex argument.
-     * @param z the value whose inverse tangent is to be returned.
-     * @return the inverse tangent of <code>z</code>.
+     * <p>
+     * Implements the formula: <pre>
+     * <code> atan(z) = (i/2) log((i + z)/(i - z)) </code></pre>
+     * <p>
+     * Returns {@link Complex#NaN} if either real or imaginary part of the 
+     * input argument is <code>NaN</code> or infinite. 
+     * 
+     * @param z the value whose inverse tangent is to be returned
+     * @return the inverse tangent of <code>z</code>
+     * @throws NullPointerException if <code>z</code> is null
      */
     public static Complex atan(Complex z) {
         if (z.isNaN()) {
             return Complex.NaN;
         }
         
-        
         return Complex.I.multiply(
             log(Complex.I.add(z).divide(Complex.I.subtract(z))))
             .divide(new Complex(2.0, 0.0));
     }
     
     /**
-     * Compute the <a href="http://mathworld.wolfram.com/Cosine.html">cosine</a>
+     * Compute the 
+     * <a href="http://mathworld.wolfram.com/Cosine.html" TARGET="_top">
+     * cosine</a>
      * for the given complex argument.
-     * @param z the value whose cosine is to be returned.
-     * @return the cosine of <code>z</code>.
+     * <p>
+     * Implements the formula: <pre>
+     * <code> cos(a + bi) = cos(a)cosh(b) - sin(a)sinh(b)i</code></pre>
+     * where the (real) functions on the right-hand side are
+     * {@link java.lang.Math#sin}, {@link java.lang.Math#cos}, 
+     * {@link MathUtils#cosh} and {@link MathUtils#sinh}.
+     * <p>
+     * Returns {@link Complex#NaN} if either real or imaginary part of the 
+     * input argument is <code>NaN</code>.
+     * <p>
+     * Infinite values in real or imaginary parts of the input may result in
+     * infinite or NaN values returned in parts of the result.<pre>
+     * Examples: 
+     * <code>
+     * cos(1 &plusmn; INFINITY i) = 1 &#x2213; INFINITY i
+     * cos(&plusmn;INFINITY + i) = NaN + NaN i
+     * cos(&plusmn;INFINITY &plusmn; INFINITY i) = NaN + NaN i</code></pre>
+     * 
+     * @param z the value whose cosine is to be returned
+     * @return the cosine of <code>z</code>
+     * @throws NullPointerException if <code>z</code> is null
      */
     public static Complex cos(Complex z) {
         if (z.isNaN()) {
@@ -105,8 +158,29 @@
     }
     
     /**
-     * Compute the <a href="http://mathworld.wolfram.com/HyperbolicCosine.html">
+     * Compute the 
+     * <a href="http://mathworld.wolfram.com/HyperbolicCosine.html" TARGET="_top">
      * hyperbolic cosine</a> for the given complex argument.
+     * <p>
+     * Implements the formula: <pre>
+     * <code> cosh(a + bi) = cosh(a)cos(b) + sinh(a)sin(b)i</code></pre>
+     * where the (real) functions on the right-hand side are
+     * {@link java.lang.Math#sin}, {@link java.lang.Math#cos}, 
+     * {@link MathUtils#cosh} and {@link MathUtils#sinh}.
+     * <p>
+     * Returns {@link Complex#NaN} if either real or imaginary part of the 
+     * input argument is <code>NaN</code>.
+     * <p>
+     * Infinite values in real or imaginary parts of the input may result in
+     * infinite or NaN values returned in parts of the result.<pre>
+     * Examples: 
+     * <code>
+     * cosh(1 &plusmn; INFINITY i) = NaN + NaN i
+     * cosh(&plusmn;INFINITY + i) = INFINITY &plusmn; INFINITY i
+     * cosh(&plusmn;INFINITY &plusmn; INFINITY i) = NaN + NaN i</code></pre>
+     * <p>
+     * Throws <code>NullPointerException</code> if z is null.
+     * 
      * @param z the value whose hyperbolic cosine is to be returned.
      * @return the hyperbolic cosine of <code>z</code>.
      */
@@ -124,10 +198,31 @@
     
     /**
      * Compute the
-     * <a href="http://mathworld.wolfram.com/ExponentialFunction.html">
+     * <a href="http://mathworld.wolfram.com/ExponentialFunction.html" TARGET="_top">
      * exponential function</a> for the given complex argument.
-     * @param z the value.
-     * @return <i>e</i><sup><code>z</code></sup>.
+     * <p>
+     * Implements the formula: <pre>
+     * <code> exp(a + bi) = exp(a)cos(b) + exp(a)sin(b)i</code></pre>
+     * where the (real) functions on the right-hand side are
+     * {@link java.lang.Math#exp}, {@link java.lang.Math#cos}, and
+     * {@link java.lang.Math#sin}.
+     * <p>
+     * Returns {@link Complex#NaN} if either real or imaginary part of the 
+     * input argument is <code>NaN</code>.
+     * <p>
+     * Infinite values in real or imaginary parts of the input may result in
+     * infinite or NaN values returned in parts of the result.<pre>
+     * Examples: 
+     * <code>
+     * exp(1 &plusmn; INFINITY i) = NaN + NaN i
+     * exp(INFINITY + i) = INFINITY + INFINITY i
+     * exp(-INFINITY + i) = 0 + 0i
+     * exp(&plusmn;INFINITY &plusmn; INFINITY i) = NaN + NaN i</code></pre>
+     * <p>
+     * Throws <code>NullPointerException</code> if z is null.
+     * 
+     * @param z the value
+     * @return <i>e</i><sup><code>z</code></sup>
      */
     public static Complex exp(Complex z) {
         if (z.isNaN()) {
@@ -136,14 +231,36 @@
         
         double b = z.getImaginary();
         double expA = Math.exp(z.getReal());
-        double sinB = Math.sin(b);
-        double cosB = Math.cos(b);
-        return new Complex(expA * cosB, expA * sinB);
+        return new Complex(expA *  Math.cos(b), expA * Math.sin(b));
     }
     
     /**
-     * Compute the <a href="http://mathworld.wolfram.com/NaturalLogarithm.html">
+     * Compute the 
+     * <a href="http://mathworld.wolfram.com/NaturalLogarithm.html" TARGET="_top">
      * natural logarithm</a> for the given complex argument.
+     * <p>
+     * Implements the formula: <pre>
+     * <code> log(a + bi) = ln(|a + bi|) + arg(a + bi)i</code></pre>
+     * where ln on the right hand side is {@link java.lang.Math#log},
+     * <code>|a + bi|</code> is the modulus, {@link Complex#abs},  and
+     * <code>arg(a + bi) = {@link java.lang.Math#atan2}(b, a)</code>
+     * <p>
+     * Returns {@link Complex#NaN} if either real or imaginary part of the 
+     * input argument is <code>NaN</code>.
+     * <p>
+     * Infinite (or critical) values in real or imaginary parts of the input may
+     * result in infinite or NaN values returned in parts of the result.<pre>
+     * Examples: 
+     * <code>
+     * log(1 &plusmn; INFINITY i) = INFINITY &plusmn; (&pi;/2)i
+     * log(INFINITY + i) = INFINITY + 0i
+     * log(-INFINITY + i) = INFINITY + &pi;i
+     * log(INFINITY &plusmn; INFINITY i) = INFINITY &plusmn; (&pi;/4)i
+     * log(-INFINITY &plusmn; INFINITY i) = INFINITY &plusmn; (3&pi;/4)i
+     * log(0 + 0i) = -INFINITY + 0i
+     * </code></pre>
+     * Throws <code>NullPointerException</code> if z is null.
+     * 
      * @param z the value.
      * @return ln <code>z</code>.
      */
@@ -156,20 +273,85 @@
             Math.atan2(z.getImaginary(), z.getReal()));        
     }
     
+    /**
+     * Creates a complex number from the given polar representation.
+     * <p>
+     * The value returned is <code>r&middot;e<sup>i&middot;theta</sup></code>,
+     * computed as <code>r&middot;cos(theta) + r&middot;sin(theta)i</code>
+     * <p>
+     * If either <code>r</code> or <code>theta</code> is NaN, or 
+     * <code>theta</code> is infinite, {@link Complex#NaN} is returned.
+     * <p>
+     * If <code>r</code> is infinite and <code>theta</code> is finite, 
+     * infinite or NaN values may be returned in parts of the result, following
+     * the rules for double arithmetic.<pre>
+     * Examples: 
+     * <code>
+     * polar2Complex(INFINITY, &pi;/4) = INFINITY + INFINITY i
+     * polar2Complex(INFINITY, 0) = INFINITY + NaN i
+     * polar2Complex(INFINITY, -&pi;/4) = INFINITY - INFINITY i
+     * polar2Complex(INFINITY, 5&pi;/4) = -INFINITY - INFINITY i </code></pre>
+     * 
+     * @param r the modulus of the complex number to create
+     * @param theta  the argument of the complex number to create
+     * @return <code>r&middot;e<sup>i&middot;theta</sup></code>
+     * @throws IllegalArgumentException  if r is negative
+     * @since 1.1
+     */
+    public static Complex polar2Complex(double r, double theta) {
+        if (r < 0) {
+            throw new IllegalArgumentException
+                ("Complex modulus must not be negative");
+        }
+        return new Complex(r * Math.cos(theta), r * Math.sin(theta));
+    }
     
     /**
      * Returns of value of <code>y</code> raised to the power of <code>x</code>.
+     * <p>
+     * Implements the formula: <pre>
+     * <code> y<sup>x</sup> = exp(x&middot;log(y))</code></pre> 
+     * where <code>exp</code> and <code>log</code> are {@link #exp} and
+     * {@link #log}, respectively.
+     * <p>
+     * Returns {@link Complex#NaN} if either real or imaginary part of the 
+     * input argument is <code>NaN</code> or infinite, or if <code>y</code>
+     * equals {@link Complex#ZERO}.
+     * 
      * @param y the base.
      * @param x the exponent.
-     * @return <code>y</code><sup><code>z</code></sup>.
+     * @return <code>y</code><sup><code>x</code></sup>
+     * @throws NullPointerException if either x or y is null
      */
     public static Complex pow(Complex y, Complex x) {
         return exp(x.multiply(log(y)));
     }
     
     /**
-     * Compute the <a href="http://mathworld.wolfram.com/Sine.html">sine</a>
+     * Compute the 
+     * <a href="http://mathworld.wolfram.com/Sine.html" TARGET="_top">
+     * sine</a>
      * for the given complex argument.
+     * <p>
+      * Implements the formula: <pre>
+     * <code> sin(a + bi) = sin(a)cosh(b) - cos(a)sinh(b)i</code></pre>
+     * where the (real) functions on the right-hand side are
+     * {@link java.lang.Math#sin}, {@link java.lang.Math#cos}, 
+     * {@link MathUtils#cosh} and {@link MathUtils#sinh}.
+     * <p>
+     * Returns {@link Complex#NaN} if either real or imaginary part of the 
+     * input argument is <code>NaN</code>.
+     * <p>
+     * Infinite values in real or imaginary parts of the input may result in
+     * infinite or NaN values returned in parts of the result.<pre>
+     * Examples: 
+     * <code>
+     * sin(1 &plusmn; INFINITY i) = 1 &plusmn; INFINITY i
+     * sin(&plusmn;INFINITY + i) = NaN + NaN i
+     * sin(&plusmn;INFINITY &plusmn; INFINITY i) = NaN + NaN i</code></pre>
+     * 
+     * Throws <code>NullPointerException</code> if z is null. 
+     * 
      * @param z the value whose sine is to be returned.
      * @return the sine of <code>z</code>.
      */
@@ -186,10 +368,30 @@
     }
     
     /**
-     * Compute the <a href="http://mathworld.wolfram.com/HyperbolicSine.html">
+     * Compute the 
+     * <a href="http://mathworld.wolfram.com/HyperbolicSine.html" TARGET="_top">
      * hyperbolic sine</a> for the given complex argument.
-     * @param z the value whose hyperbolic sine is to be returned.
-     * @return the hyperbolic sine of <code>z</code>.
+     * <p>
+     * Implements the formula: <pre>
+     * <code> sinh(a + bi) = sinh(a)cos(b)) + cosh(a)sin(b)i</code></pre>
+     * where the (real) functions on the right-hand side are
+     * {@link java.lang.Math#sin}, {@link java.lang.Math#cos}, 
+     * {@link MathUtils#cosh} and {@link MathUtils#sinh}.
+     * <p>
+     * Returns {@link Complex#NaN} if either real or imaginary part of the 
+     * input argument is <code>NaN</code>.
+     * <p>
+     * Infinite values in real or imaginary parts of the input may result in
+     * infinite or NaN values returned in parts of the result.<pre>
+     * Examples: 
+     * <code>
+     * sinh(1 &plusmn; INFINITY i) = NaN + NaN i
+     * sinh(&plusmn;INFINITY + i) = &plusmn; INFINITY + INFINITY i
+     * sinh(&plusmn;INFINITY &plusmn; INFINITY i) = NaN + NaN i</code></pre
+     * 
+     * @param z the value whose hyperbolic sine is to be returned
+     * @return the hyperbolic sine of <code>z</code>
+     * @throws NullPointerException if <code>z</code> is null
      */
     public static Complex sinh(Complex z) {
         if (z.isNaN()) {
@@ -204,10 +406,38 @@
     }
     
     /**
-     * Compute the <a href="http://mathworld.wolfram.com/SquareRoot.html">squre
-     * root</a> for the given complex argument.
-     * @param z the value whose square root is to be returned.
-     * @return the square root of <code>z</code>.
+     * Compute the 
+     * <a href="http://mathworld.wolfram.com/SquareRoot.html" TARGET="_top">
+     * square root</a> for the given complex argument.
+     * <p>
+     * Implements the following algorithm to compute <code>sqrt(a + bi)</code>: 
+     * <ol><li>Let <code>t = sqrt((|a| + |a + bi|) / 2)</code></li>
+     * <li><pre>if <code> a &#8805; 0</code> return <code>t + (b/2t)i</code>
+     *  else return <code>|b|/2t + sign(b)t i </code></pre></li>
+     * </ol>
+     * where <ul>
+     * <li><code>|a| = {@link Math#abs}(a)</code></li>
+     * <li><code>|a + bi| = {@link Complex#abs}(a + bi) </code></li>
+     * <li><code>sign(b) =  {@link MathUtils#indicator}(b) </code>
+     * </ul>
+     * <p>
+     * Returns {@link Complex#NaN} if either real or imaginary part of the 
+     * input argument is <code>NaN</code>.
+     * <p>
+     * Infinite values in real or imaginary parts of the input may result in
+     * infinite or NaN values returned in parts of the result.<pre>
+     * Examples: 
+     * <code>
+     * sqrt(1 &plusmn; INFINITY i) = INFINITY + NaN i
+     * sqrt(INFINITY + i) = INFINITY + 0i
+     * sqrt(-INFINITY + i) = 0 + INFINITY i
+     * sqrt(INFINITY &plusmn; INFINITY i) = INFINITY + NaN i
+     * sqrt(-INFINITY &plusmn; INFINITY i) = NaN &plusmn; INFINITY i
+     * </code></pre>
+     * 
+     * @param z the value whose square root is to be returned
+     * @return the square root of <code>z</code>
+     * @throws NullPointerException if <code>z</code> is null
      */
     public static Complex sqrt(Complex z) {
         if (z.isNaN()) {
@@ -230,20 +460,54 @@
     }
     
     /**
-     * Compute the <a href="http://mathworld.wolfram.com/SquareRoot.html">squre
-     * root of 1 - <code>z</code><sup>2</sup> for the given complex argument.
-     * @param z the value.
-     * @return the square root of 1 - <code>z</code><sup>2</sup>.
+     * Compute the 
+     * <a href="http://mathworld.wolfram.com/SquareRoot.html" TARGET="_top">
+     * square root</a> of 1 - <code>z</code><sup>2</sup> for the given complex
+     * argument.
+     * <p>
+     * Computes the result directly as 
+     * <code>sqrt(Complex.ONE.subtract(z.multiply(z)))</code>.
+     * <p>
+     * Returns {@link Complex#NaN} if either real or imaginary part of the 
+     * input argument is <code>NaN</code>.
+     * <p>
+     * Infinite values in real or imaginary parts of the input may result in
+     * infinite or NaN values returned in parts of the result. 
+     * 
+     * @param z the value
+     * @return the square root of 1 - <code>z</code><sup>2</sup>
+     * @throws NullPointerException if <code>z</code> is null
      */
     public static Complex sqrt1z(Complex z) {
         return sqrt(Complex.ONE.subtract(z.multiply(z)));
     }
     
     /**
-     * Compute the <a href="http://mathworld.wolfram.com/Tangent.html">
+     * Compute the 
+     * <a href="http://mathworld.wolfram.com/Tangent.html" TARGET="_top">
      * tangent</a> for the given complex argument.
-     * @param z the value whose tangent is to be returned.
-     * @return the tangent of <code>z</code>.
+     * <p>
+     * Implements the formula: <pre>
+     * <code>tan(a + bi) = sin(2a)/(cos(2a)+cosh(2b)) + [sinh(2b)/(cos(2a)+cosh(2b))]i</code></pre>
+     * where the (real) functions on the right-hand side are
+     * {@link java.lang.Math#sin}, {@link java.lang.Math#cos}, 
+     * {@link MathUtils#cosh} and {@link MathUtils#sinh}.
+     * <p>
+     * Returns {@link Complex#NaN} if either real or imaginary part of the 
+     * input argument is <code>NaN</code>.
+     * <p>
+     * Infinite (or critical) values in real or imaginary parts of the input may
+     * result in infinite or NaN values returned in parts of the result.<pre>
+     * Examples: 
+     * <code>
+     * tan(1 &plusmn; INFINITY i) = 0 + NaN i
+     * tan(&plusmn;INFINITY + i) = NaN + NaN i
+     * tan(&plusmn;INFINITY &plusmn; INFINITY i) = NaN + NaN i
+     * tan(&plusmn;&pi/2 + 0 i) = &plusmn;INFINITY + NaN i</code></pre>
+     * 
+     * @param z the value whose tangent is to be returned
+     * @return the tangent of <code>z</code>
+     * @throws NullPointerException if <code>z</code> is null
      */
     public static Complex tan(Complex z) {
         if (z.isNaN()) {
@@ -259,10 +523,30 @@
     
     /**
      * Compute the
-     * <a href="http://mathworld.wolfram.com/HyperbolicTangent.html">
+     * <a href="http://mathworld.wolfram.com/HyperbolicTangent.html" TARGET="_top">
      * hyperbolic tangent</a> for the given complex argument.
-     * @param z the value whose hyperbolic tangent is to be returned.
-     * @return the hyperbolic tangent of <code>z</code>.
+    * <p>
+     * Implements the formula: <pre>
+     * <code>tan(a + bi) = sinh(2a)/(cosh(2a)+cos(2b)) + [sin(2b)/(cosh(2a)+cos(2b))]i</code></pre>
+     * where the (real) functions on the right-hand side are
+     * {@link java.lang.Math#sin}, {@link java.lang.Math#cos}, 
+     * {@link MathUtils#cosh} and {@link MathUtils#sinh}.
+     * <p>
+     * Returns {@link Complex#NaN} if either real or imaginary part of the 
+     * input argument is <code>NaN</code>.
+     * <p>
+     * Infinite values in real or imaginary parts of the input may result in
+     * infinite or NaN values returned in parts of the result.<pre>
+     * Examples: 
+     * <code>
+     * tanh(1 &plusmn; INFINITY i) = NaN + NaN i
+     * tanh(&plusmn;INFINITY + i) = NaN + 0 i
+     * tanh(&plusmn;INFINITY &plusmn; INFINITY i) = NaN + NaN i
+     * tanh(0 + (&pi/2)i) = NaN + INFINITY i</code></pre>
+     *
+     * @param z the value whose hyperbolic tangent is to be returned
+     * @return the hyperbolic tangent of <code>z</code>
+     * @throws NullPointerException if <code>z</code> is null
      */
     public static Complex tanh(Complex z) {
         if (z.isNaN()) {

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java Thu Dec 22 13:16:32 2005
@@ -35,7 +35,7 @@
     implements ContinuousDistribution, Serializable {
 
     /** Serializable version identifier */
-    static final long serialVersionUID = -38038050983108802L;
+    private static final long serialVersionUID = -38038050983108802L;
     
     /**
      * Default constructor.

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractDistribution.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractDistribution.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractDistribution.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractDistribution.java Thu Dec 22 13:16:32 2005
@@ -28,7 +28,7 @@
     implements Distribution, Serializable {
 
     /** Serializable version identifier */
-    static final long serialVersionUID = -38038050983108802L;
+    private static final long serialVersionUID = -38038050983108802L;
     
     /**
      * Default constructor.

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java Thu Dec 22 13:16:32 2005
@@ -31,7 +31,7 @@
     implements IntegerDistribution, Serializable {
         
     /** Serializable version identifier */
-    static final long serialVersionUID = -1146319659338487221L;
+    private static final long serialVersionUID = -1146319659338487221L;
     
     /**
      * Default constructor.

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/BinomialDistributionImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/BinomialDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/BinomialDistributionImpl.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/BinomialDistributionImpl.java Thu Dec 22 13:16:32 2005
@@ -31,7 +31,7 @@
     implements BinomialDistribution, Serializable {
 
     /** Serializable version identifier */
-    static final long serialVersionUID = 6751309484392813623L;
+    private static final long serialVersionUID = 6751309484392813623L;
 
     /** The number of trials. */
     private int numberOfTrials;

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/CauchyDistributionImpl.java Thu Dec 22 13:16:32 2005
@@ -29,7 +29,7 @@
         implements CauchyDistribution, Serializable {
     
     /** Serializable version identifier */
-    static final long serialVersionUID = 8589540077390120676L;
+    private static final long serialVersionUID = 8589540077390120676L;
 
     /** The median of this distribution. */
     private double median = 0;

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ChiSquaredDistributionImpl.java Thu Dec 22 13:16:32 2005
@@ -29,7 +29,7 @@
     implements ChiSquaredDistribution, Serializable  {
     
     /** Serializable version identifier */
-    static final long serialVersionUID = -8352658048349159782L;
+    private static final long serialVersionUID = -8352658048349159782L;
 
     /** Internal Gamma distribution. */    
     private GammaDistribution gamma;

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ExponentialDistributionImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ExponentialDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ExponentialDistributionImpl.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/ExponentialDistributionImpl.java Thu Dec 22 13:16:32 2005
@@ -20,7 +20,7 @@
 import org.apache.commons.math.MathException;
 
 /**
- * The default implementation of {@link ExponentialDistribution}
+ * The default implementation of {@link ExponentialDistribution}.
  *
  * @version $Revision$ $Date$
  */
@@ -28,7 +28,7 @@
     implements ExponentialDistribution, Serializable {
 
     /** Serializable version identifier */
-    static final long serialVersionUID = 2401296428283614780L;
+    private static final long serialVersionUID = 2401296428283614780L;
     
     /** The mean of this distribution. */
     private double mean;

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/FDistributionImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/FDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/FDistributionImpl.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/FDistributionImpl.java Thu Dec 22 13:16:32 2005
@@ -31,7 +31,7 @@
     implements FDistribution, Serializable  {
 
     /** Serializable version identifier */
-    static final long serialVersionUID = -8516354193418641566L;
+    private static final long serialVersionUID = -8516354193418641566L;
 
     /** The numerator degrees of freedom*/
     private double numeratorDegreesOfFreedom;

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/GammaDistributionImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/GammaDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/GammaDistributionImpl.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/GammaDistributionImpl.java Thu Dec 22 13:16:32 2005
@@ -21,7 +21,7 @@
 import org.apache.commons.math.special.Gamma;
 
 /**
- * The default implementation of {@link GammaDistribution}
+ * The default implementation of {@link GammaDistribution}.
  *
  * @version $Revision$ $Date$
  */
@@ -29,7 +29,7 @@
     implements GammaDistribution, Serializable  {
 
     /** Serializable version identifier */
-    static final long serialVersionUID = -3239549463135430361L;
+    private static final long serialVersionUID = -3239549463135430361L;
 
     /** The shape parameter. */
     private double alpha;

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/HypergeometricDistributionImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/HypergeometricDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/HypergeometricDistributionImpl.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/HypergeometricDistributionImpl.java Thu Dec 22 13:16:32 2005
@@ -30,7 +30,7 @@
 {
 
     /** Serializable version identifier */
-    static final long serialVersionUID = -436928820673516179L;
+    private static final long serialVersionUID = -436928820673516179L;
 
     /** The number of successes in the population. */
     private int numberOfSuccesses;
@@ -53,8 +53,8 @@
         super();
         if (numberOfSuccesses > populationSize) {
             throw new IllegalArgumentException(
-            	"number of successes must be less than or equal to " +
-            	"population size");
+                "number of successes must be less than or equal to " +
+                "population size");
         }
         if (sampleSize > populationSize) {
             throw new IllegalArgumentException(
@@ -241,7 +241,7 @@
         populationSize = size;
     }
     
-	/**
+    /**
      * Modify the sample size.
      * @param size the new sample size.
      * @throws IllegalArgumentException if <code>size</code> is negative.
@@ -260,9 +260,9 @@
      * @return upper tail CDF for this distribution.
      * @since 1.1
      */
-	public double upperCumulativeProbability(int x) {
-    	double ret;
-    	
+    public double upperCumulativeProbability(int x) {
+        double ret;
+        
         int n = getPopulationSize();
         int m = getNumberOfSuccesses();
         int k = getSampleSize();
@@ -273,12 +273,12 @@
         } else if(x > domain[1]) {
             ret = 0.0;
         } else {
-        	ret = innerCumulativeProbability(domain[1], x, -1, n, m, k);
+            ret = innerCumulativeProbability(domain[1], x, -1, n, m, k);
         }
         
         return ret;
     }
-	
+    
     /**
      * For this disbution, X, this method returns P(x0 &le; X &le; x1).  This
      * probability is computed by summing the point probabilities for the values
@@ -293,13 +293,13 @@
      * @return P(x0 &le; X &le; x1). 
      */
     private double innerCumulativeProbability(
-    	int x0, int x1, int dx, int n, int m, int k)
+        int x0, int x1, int dx, int n, int m, int k)
     {
-    	double ret = probability(n, m, k, x0);
-    	while (x0 != x1) {
-    		x0 += dx;
-    		ret += probability(n, m, k, x0);
-    	}
-		return ret;
-	}
+        double ret = probability(n, m, k, x0);
+        while (x0 != x1) {
+            x0 += dx;
+            ret += probability(n, m, k, x0);
+        }
+        return ret;
+    }
 }

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/NormalDistributionImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/NormalDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/NormalDistributionImpl.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/NormalDistributionImpl.java Thu Dec 22 13:16:32 2005
@@ -31,7 +31,7 @@
         implements NormalDistribution, Serializable {
     
     /** Serializable version identifier */
-    static final long serialVersionUID = 8589540077390120676L;
+    private static final long serialVersionUID = 8589540077390120676L;
 
     /** The mean of this distribution. */
     private double mean = 0;

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/PoissonDistributionImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/PoissonDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/PoissonDistributionImpl.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/PoissonDistributionImpl.java Thu Dec 22 13:16:32 2005
@@ -22,7 +22,7 @@
 import org.apache.commons.math.util.MathUtils;
 
 /**
- * Implementation for the {@link PoissonDistribution}
+ * Implementation for the {@link PoissonDistribution}.
  * 
  * @version $Revision$ $Date$
  */
@@ -30,7 +30,7 @@
         implements PoissonDistribution, Serializable {
 
     /** Serializable version identifier */
-    static final long serialVersionUID = -3349935121172596109L;
+    private static final long serialVersionUID = -3349935121172596109L;
     
     /**
      * Holds the Poisson mean for the distribution.

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/TDistributionImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/TDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/TDistributionImpl.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/TDistributionImpl.java Thu Dec 22 13:16:32 2005
@@ -31,7 +31,7 @@
     implements TDistribution, Serializable  {
 
     /** Serializable version identifier */
-    static final long serialVersionUID = -5852615386664158222L;
+    private static final long serialVersionUID = -5852615386664158222L;
     
     /** The degrees of freedom*/
     private double degreesOfFreedom;

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/WeibullDistributionImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/WeibullDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/WeibullDistributionImpl.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/WeibullDistributionImpl.java Thu Dec 22 13:16:32 2005
@@ -29,7 +29,7 @@
         implements WeibullDistribution, Serializable {
     
     /** Serializable version identifier */
-    static final long serialVersionUID = 8589540077390120676L;
+    private static final long serialVersionUID = 8589540077390120676L;
     
     /** The shape parameter. */
     private double alpha;

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/Fraction.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/Fraction.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/Fraction.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/Fraction.java Thu Dec 22 13:16:32 2005
@@ -34,7 +34,7 @@
     public static final Fraction ZERO = new Fraction(0, 1);
     
     /** Serializable version identifier */
-    static final long serialVersionUID = 65382027393090L;
+    private static final long serialVersionUID = 65382027393090L;
     
     /** The denominator. */
     private int denominator;

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/FractionFormat.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/FractionFormat.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/FractionFormat.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/FractionFormat.java Thu Dec 22 13:16:32 2005
@@ -37,7 +37,7 @@
 public class FractionFormat extends Format implements Serializable {
     
     /** Serializable version identifier */
-    static final long serialVersionUID = -6337346779577272306L;
+    private static final long serialVersionUID = -6337346779577272306L;
 
     /** The format used for the denominator. */
     private NumberFormat denominatorFormat;

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/ProperFractionFormat.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/ProperFractionFormat.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/ProperFractionFormat.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/fraction/ProperFractionFormat.java Thu Dec 22 13:16:32 2005
@@ -31,7 +31,7 @@
 public class ProperFractionFormat extends FractionFormat {
     
     /** Serializable version identifier */
-    static final long serialVersionUID = -6337346779577272307L;
+    private static final long serialVersionUID = -6337346779577272307L;
     
     /** The format used for the whole number. */
     private NumberFormat wholeFormat;

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BigMatrixImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BigMatrixImpl.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BigMatrixImpl.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BigMatrixImpl.java Thu Dec 22 13:16:32 2005
@@ -19,7 +19,7 @@
 import java.math.BigDecimal;
 
 /**
- * Implementation for {@link BigMatrix} using a BigDecimal[][] array to store entries
+ * Implementation of {@link BigMatrix} using a BigDecimal[][] array to store entries
  * and <a href="http://www.math.gatech.edu/~bourbaki/math2601/Web-notes/2num.pdf">
  * LU decompostion</a> to support linear system 
  * solution and inverse.
@@ -48,7 +48,7 @@
 public class BigMatrixImpl implements BigMatrix, Serializable {
     
     /** Serialization id */
-    static final long serialVersionUID = -1011428905656140431L;
+    private static final long serialVersionUID = -1011428905656140431L;
     
     /** Entries of the matrix */
     private BigDecimal data[][] = null;

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/InvalidMatrixException.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/InvalidMatrixException.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/InvalidMatrixException.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/InvalidMatrixException.java Thu Dec 22 13:16:32 2005
@@ -25,7 +25,7 @@
 public class InvalidMatrixException extends RuntimeException {
 
     /** Serializable version identifier */
-    static final long serialVersionUID = 5318837237354354107L;
+    private static final long serialVersionUID = 5318837237354354107L;
 
     /**
      * Default constructor.

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixIndexException.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixIndexException.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixIndexException.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/MatrixIndexException.java Thu Dec 22 13:16:32 2005
@@ -24,7 +24,7 @@
 public class MatrixIndexException extends RuntimeException {
 
     /** Serializable version identifier */
-    static final long serialVersionUID = -1341109412864309526L;
+    private static final long serialVersionUID = -1341109412864309526L;
 
     /**
      * Default constructor.

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixImpl.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixImpl.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixImpl.java Thu Dec 22 13:16:32 2005
@@ -21,7 +21,7 @@
 
 
 /**
- * Implementation for RealMatrix using a double[][] array to store entries and
+ * Implementation of RealMatrix using a double[][] array to store entries and
  * <a href="http://www.math.gatech.edu/~bourbaki/math2601/Web-notes/2num.pdf">
  * LU decompostion</a> to support linear system
  * solution and inverse.
@@ -50,7 +50,7 @@
 public class RealMatrixImpl implements RealMatrix, Serializable {
     
     /** Serializable version identifier */
-    static final long serialVersionUID = 4237564493130426188L;
+    private static final long serialVersionUID = 4237564493130426188L;
 
     /** Entries of the matrix */
     private double data[][] = null;

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/EmpiricalDistributionImpl.java Thu Dec 22 13:16:32 2005
@@ -59,13 +59,13 @@
 public class EmpiricalDistributionImpl implements Serializable, EmpiricalDistribution {
 
     /** Serializable version identifier */
-    static final long serialVersionUID = -6773236347582113490L;
+    private static final long serialVersionUID = -6773236347582113490L;
 
     /** List of SummaryStatistics objects characterizing the bins */
     private ArrayList binStats = null;
 
     /** Sample statistics */
-    SummaryStatistics sampleStats = null;
+    private SummaryStatistics sampleStats = null;
 
     /** number of bins */
     private int binCount = 1000;
@@ -225,7 +225,7 @@
     private class StreamDataAdapter extends DataAdapter{
         
         /** Input stream providng access to the data */
-        BufferedReader inputStream;
+        private BufferedReader inputStream;
         
         /**
          * Create a StreamDataAdapter from a BufferedReader
@@ -380,7 +380,7 @@
      * @param min  the minimum value
      * @param value  the value whose bin we are trying to find
      * @param delta  the grid size
-     * @return
+     * @return the index of the bin containing the value
      */
     private int findBin(double min, double value, double delta) {
         return Math.min(
@@ -453,14 +453,18 @@
     }
 
     /**
-     * Returns the array of upper bounds for the bins.  Bins are: <br/>
+     * Returns (a fresh copy of) the array of upper bounds for the bins.
+       Bins are: <br/>
      * [min,upperBounds[0]],(upperBounds[0],upperBounds[1]],...,
      *  (upperBounds[binCount-1],max]
      * 
      * @return array of bin upper bounds
      */
     public double[] getUpperBounds() {
-        return upperBounds;
+        int len = upperBounds.length;
+        double[] out = new double[len];
+        System.arraycopy(upperBounds, 0, out, 0, len);
+        return out;
     }
 
     /**

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomData.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomData.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomData.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomData.java Thu Dec 22 13:16:32 2005
@@ -18,7 +18,7 @@
 import java.util.Collection;
 
 /**
- * Random data generation utilities
+ * Random data generation utilities.
  * @version $Revision$ $Date$
  */
 public interface RandomData {

Modified: jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomDataImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomDataImpl.java?rev=358631&r1=358630&r2=358631&view=diff
==============================================================================
--- jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomDataImpl.java (original)
+++ jakarta/commons/proper/math/trunk/src/java/org/apache/commons/math/random/RandomDataImpl.java Thu Dec 22 13:16:32 2005
@@ -81,7 +81,7 @@
 public class RandomDataImpl implements RandomData, Serializable {
 
     /** Serializable version identifier */
-    static final long serialVersionUID = -626730818244969716L;
+    private static final long serialVersionUID = -626730818244969716L;
 
     /** underlying random number generator */
     private RandomGenerator rand = null;



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org