commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex (JIRA)" <j...@apache.org>
Subject [jira] [Created] (MATH-832) Brent solver calculates incorrect root (namley Double.MAX_VALUE)
Date Tue, 24 Jul 2012 20:58:35 GMT
Alex created MATH-832:
-------------------------

             Summary: Brent solver calculates incorrect root (namley Double.MAX_VALUE)
                 Key: MATH-832
                 URL: https://issues.apache.org/jira/browse/MATH-832
             Project: Commons Math
          Issue Type: Bug
    Affects Versions: 3.0
         Environment: Netbeans 7.1.2
            Reporter: Alex


Wolfram-Alpha-Solution:
http://www.wolframalpha.com/input/?i=min+100*sqrt%28x%29%2B1000000%2Fx%2B10000%2Fsqrt%28x%29+with+x%3E0


Java-Input:{code:title=Test.java|borderStyle=solid}
int startValue1 = 100 + 1000000 + 10000;
int startValue2 = 100;

System.out.println(
    (new BrentSolver()).solve(Integer.MAX_VALUE, new UnivariateFunction() {
    @Override
    public double value(double x) {
        return 100/(2*Math.sqrt(x)) - 1000000/Math.pow(x,2) - 10000/(2*Math.pow(x,(double)
3/2));
    }
}, 1/Double.MAX_VALUE, Double.MAX_VALUE, startValue1)
);

System.out.println(
    (new BrentSolver()).solve(Integer.MAX_VALUE, new UnivariateFunction() {
    @Override
    public double value(double x) {
        return 100/(2*Math.sqrt(x)) - 1000000/Math.pow(x,2) - 10000/(2*Math.pow(x,(double)
3/2));
    }
}, 1/Double.MAX_VALUE, Double.MAX_VALUE, startValue2)
);{code}


Java-Output:{code:title=Test.java|borderStyle=solid}
804.9355821866686
1.7976931348623157E308 (= Double.MAX_VALUE){code} 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message