commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r791833 - in /commons/proper/math/trunk/src: java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java site/xdoc/changes.xml test/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java
Date Tue, 07 Jul 2009 13:39:21 GMT
Author: luc
Date: Tue Jul  7 13:39:20 2009
New Revision: 791833

URL: http://svn.apache.org/viewvc?rev=791833&view=rev
Log:
added a test case and documentation for the new contract about roots bracketing in univariate
real solvers (roots exactly at endpoints are now accepted)
JIRA: MATH-280

Modified:
    commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java
    commons/proper/math/trunk/src/site/xdoc/changes.xml
    commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java?rev=791833&r1=791832&r2=791833&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java
Tue Jul  7 13:39:20 2009
@@ -60,7 +60,9 @@
 
     /**
      * Solve for a zero root in the given interval.
-     * A solver may require that the interval brackets a single zero root.
+     * <p>A solver may require that the interval brackets a single zero root.
+     * Solvers that do require bracketing should be able to handle the case
+     * where one of the endpoints is itself a root.</p>
      * 
      * @param min the lower bound for the interval.
      * @param max the upper bound for the interval.
@@ -80,7 +82,9 @@
 
     /**
      * Solve for a zero root in the given interval.
-     * A solver may require that the interval brackets a single zero root.
+     * <p>A solver may require that the interval brackets a single zero root.
+     * Solvers that do require bracketing should be able to handle the case
+     * where one of the endpoints is itself a root.</p>
      * 
      * @param f the function to solve.
      * @param min the lower bound for the interval.
@@ -100,7 +104,9 @@
 
     /**
      * Solve for a zero in the given interval, start at startValue.
-     * A solver may require that the interval brackets a single zero root.
+     * <p>A solver may require that the interval brackets a single zero root.
+     * Solvers that do require bracketing should be able to handle the case
+     * where one of the endpoints is itself a root.</p>
      * 
      * @param min the lower bound for the interval.
      * @param max the upper bound for the interval.
@@ -121,7 +127,9 @@
 
     /**
      * Solve for a zero in the given interval, start at startValue.
-     * A solver may require that the interval brackets a single zero root.
+     * <p>A solver may require that the interval brackets a single zero root.
+     * Solvers that do require bracketing should be able to handle the case
+     * where one of the endpoints is itself a root.</p>
      * 
      * @param f the function to solve.
      * @param min the lower bound for the interval.

Modified: commons/proper/math/trunk/src/site/xdoc/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/changes.xml?rev=791833&r1=791832&r2=791833&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/changes.xml Tue Jul  7 13:39:20 2009
@@ -40,7 +40,9 @@
   <body>
     <release version="2.0" date="TBD" description="TBD">
       <action dev="luc" type="fix" issue="MATH-280">
-        Fixed a bracketing issue in inverse cumulative probability computation
+        The behavior of the bracket method in UnivariateRealSolverUtils has been changed
to return successfully
+        when a tentative bracketing interval has a root exactly at one of its end points.
Previously, such intervals
+        triggered an exception.
       </action>
       <action dev="luc" type="add" issue="MATH-279" due-to="Michael Bjorkegren">
         Added a check for too few rows with respect to the number of predictors in linear
regression

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java?rev=791833&r1=791832&r2=791833&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java
(original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java
Tue Jul  7 13:39:20 2009
@@ -90,6 +90,12 @@
         assertTrue(sin.value(result[1]) > 0);
     }
     
+    public void testBracketEndpointRoot() throws MathException {
+        double[] result = UnivariateRealSolverUtils.bracket(sin, 1.5, 0, 2.0);
+        assertEquals(0.0, sin.value(result[0]), 1.0e-15);
+        assertTrue(sin.value(result[1]) > 0);
+    }
+    
     public void testBadParameters() throws MathException {
         try { // null function
             UnivariateRealSolverUtils.bracket(null, 1.5, 0, 2.0);



Mime
View raw message