Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 58632 invoked from network); 7 Jul 2009 09:20:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Jul 2009 09:20:03 -0000 Received: (qmail 22396 invoked by uid 500); 7 Jul 2009 09:20:12 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 22297 invoked by uid 500); 7 Jul 2009 09:20:12 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 22288 invoked by uid 99); 7 Jul 2009 09:20:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jul 2009 09:20:12 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jul 2009 09:20:08 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9B4C123888D9; Tue, 7 Jul 2009 09:19:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r791766 - in /commons/proper/math/trunk/src: java/org/apache/commons/math/analysis/solvers/ java/org/apache/commons/math/distribution/ site/xdoc/ test/org/apache/commons/math/analysis/solvers/ test/org/apache/commons/math/distribution/ Date: Tue, 07 Jul 2009 09:19:47 -0000 To: commits@commons.apache.org From: luc@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090707091947.9B4C123888D9@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: luc Date: Tue Jul 7 09:19:46 2009 New Revision: 791766 URL: http://svn.apache.org/viewvc?rev=791766&view=rev Log: fixed a bracketing issue due to inconsistent checks JIRA: MATH-280 Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java commons/proper/math/trunk/src/site/xdoc/changes.xml commons/proper/math/trunk/src/test/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtilsTest.java commons/proper/math/trunk/src/test/org/apache/commons/math/distribution/NormalDistributionTest.java Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java?rev=791766&r1=791765&r2=791766&view=diff ============================================================================== --- commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java (original) +++ commons/proper/math/trunk/src/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java Tue Jul 7 09:19:46 2009 @@ -131,7 +131,7 @@ /** * This method attempts to find two values a and b satisfying
    *
  • lowerBound <= a < initial < b <= upperBound
  • - *
  • f(a) * f(b) < 0
  • + *
  • f(a) * f(b) <= 0
  • *
* If f is continuous on [a,b], this means that a * and b bracket a root of f. @@ -141,7 +141,7 @@ * function at a and b and keeps moving * the endpoints out by one unit each time through a loop that terminates * when one of the following happens:
    - *
  • f(a) * f(b) < 0 -- success!
  • + *
  • f(a) * f(b) <= 0 -- success!
  • *
  • a = lower and b = upper * -- ConvergenceException
  • *
  • maximumIterations iterations elapse @@ -195,7 +195,7 @@ } while ((fa * fb > 0.0) && (numIterations < maximumIterations) && ((a > lowerBound) || (b < upperBound))); - if (fa * fb >= 0.0 ) { + if (fa * fb > 0.0 ) { throw new ConvergenceException( "number of iterations={0}, maximum iterations={1}, " + "initial={2}, lower bound={3}, upper bound={4}, final a value={5}, " + Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java?rev=791766&r1=791765&r2=791766&view=diff ============================================================================== --- commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java (original) +++ commons/proper/math/trunk/src/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java Tue Jul 7 09:19:46 2009 @@ -65,7 +65,7 @@ } // by default, do simple root finding using bracketing and default solver. - // subclasses can overide if there is a better method. + // subclasses can override if there is a better method. UnivariateRealFunction rootFindingFunction = new UnivariateRealFunction() { public double value(double x) throws FunctionEvaluationException { 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=791766&r1=791765&r2=791766&view=diff ============================================================================== --- commons/proper/math/trunk/src/site/xdoc/changes.xml (original) +++ commons/proper/math/trunk/src/site/xdoc/changes.xml Tue Jul 7 09:19:46 2009 @@ -39,6 +39,9 @@ + + Fixed a bracketing issue in inverse cumulative probability computation + 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=791766&r1=791765&r2=791766&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 09:19:46 2009 @@ -17,13 +17,12 @@ package org.apache.commons.math.analysis.solvers; -import org.apache.commons.math.ConvergenceException; +import junit.framework.TestCase; + import org.apache.commons.math.MathException; import org.apache.commons.math.analysis.SinFunction; import org.apache.commons.math.analysis.UnivariateRealFunction; -import junit.framework.TestCase; - /** * @version $Revision$ $Date$ */ @@ -91,15 +90,6 @@ assertTrue(sin.value(result[1]) > 0); } - public void testBracketCornerSolution() throws MathException { - try { - UnivariateRealSolverUtils.bracket(sin, 1.5, 0, 2.0); - fail("Expecting ConvergenceException"); - } catch (ConvergenceException ex) { - // expected - } - } - public void testBadParameters() throws MathException { try { // null function UnivariateRealSolverUtils.bracket(null, 1.5, 0, 2.0); Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/distribution/NormalDistributionTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/distribution/NormalDistributionTest.java?rev=791766&r1=791765&r2=791766&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/org/apache/commons/math/distribution/NormalDistributionTest.java (original) +++ commons/proper/math/trunk/src/test/org/apache/commons/math/distribution/NormalDistributionTest.java Tue Jul 7 09:19:46 2009 @@ -17,6 +17,8 @@ package org.apache.commons.math.distribution; +import org.apache.commons.math.MathException; + /** * Test cases for NormalDistribution. * Extends ContinuousDistributionAbstractTest. See class javadoc for @@ -161,4 +163,11 @@ } } } + + public void testMath280() throws MathException { + NormalDistribution normal = new NormalDistributionImpl(0,1); + double result = normal.inverseCumulativeProbability(0.9772498680518209); + assertEquals(2.0, result, 1.0e-12); + } + }