[ https://issues.apache.org/jira/browse/MATH832?page=com.atlassian.jira.plugin.system.issuetabpanels:commenttabpanel&focusedCommentId=13422980#comment13422980
]
Alex edited comment on MATH832 at 7/26/12 9:27 AM:

I tried testMath832() and there was no error (although i'm not sure if i did it right  i
never worked with JUnit before). But now i think i know where the problem is: It isn't the
difference between optimizing and solving (minimizing a function (that derivative has only
one root) => finding the root of the derivative) but a numerical issue:
[http://www.wolframalpha.com/input/?i=Plot(100*sqrt%28x%29%2B1000000%2Fx%2B10000%2Fsqrt%28x%29%2C+{x%2C+0%2C+1000})]
[http://www.wolframalpha.com/input/?i=Plot(d%2Fdx+100*sqrt%28x%29%2B1000000%2Fx%2B10000%2Fsqrt%28x%29%2C+{x%2C+0%2C+1000})]
[http://www.wolframalpha.com/input/?i=Plot(d%2Fdx+100*sqrt%28x%29%2B1000000%2Fx%2B10000%2Fsqrt%28x%29%2C+{x%2C+10^10%2C+10^100})]
An upper bound for the interval sufficiently smaller than infinity causes no problems:{code:borderStyle=solid}
System.out.println(
(new BrentSolver()).solve(Integer.MAX_VALUE, uf, 1/Double.MAX_VALUE, *1.0e10*,
startValue2)
);{code}
was (Author: alex87):
I tried testMath832() and there was no error (although i'm not sure if i did it right
 i never worked with JUnit before). But now i think i know where the problem is: It isn't
the difference between optimizing and solving (minimizing a function (that derivative has
only one root) => finding the root of the derivative) but a numerical issue:
[http://www.wolframalpha.com/input/?i=Plot(100*sqrt%28x%29%2B1000000%2Fx%2B10000%2Fsqrt%28x%29%2C+{x%2C+0%2C+1000})]
[http://www.wolframalpha.com/input/?i=Plot(d%2Fdx+100*sqrt%28x%29%2B1000000%2Fx%2B10000%2Fsqrt%28x%29%2C+{x%2C+0%2C+1000})]
[http://www.wolframalpha.com/input/?i=Plot(d%2Fdx+100*sqrt%28x%29%2B1000000%2Fx%2B10000%2Fsqrt%28x%29%2C+{x%2C+10^10%2C+10^100})]
An upper bound for the interval sufficiently smaller than infinity causes no problems:{code:borderStyle=solid}
System.out.println(
(new BrentSolver()).solve(Integer.MAX_VALUE, uf, 1/Double.MAX_VALUE, *1.0e10*,
startValue2)
);{code}
> Brent solver calculates incorrect root (namley Double.MAX_VALUE)
> 
>
> Key: MATH832
> URL: https://issues.apache.org/jira/browse/MATH832
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 3.0
> Environment: Netbeans 7.1.2
> Reporter: Alex
>
> *WolframAlphaSolution:*
> [http://www.wolframalpha.com/input/?i=min+100*sqrt%28x%29%2B1000000%2Fx%2B10000%2Fsqrt%28x%29+with+x%3E0]
> {code:borderStyle=solid}min{100 sqrt(x)+1000000/x+10000/sqrt(x)x>0}~~4431.94 at x~~804.936{code}
> *JavaInput:*{code:borderStyle=solid}
> int startValue1 = 100 + 1000000 + 10000;
> int startValue2 = 100;
> UnivariateFunction uf = 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));
> }
> };
> System.out.println(
> (new BrentSolver()).solve(Integer.MAX_VALUE, uf, 1/Double.MAX_VALUE, Double.MAX_VALUE,
startValue1)
> );
> System.out.println(
> (new BrentSolver()).solve(Integer.MAX_VALUE, uf, 1/Double.MAX_VALUE, Double.MAX_VALUE,
startValue2)
> );{code}
> *JavaOutput:*{code: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
