[ 
https://issues.apache.org/jira/browse/MATH-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13080675#comment-13080675
 ] 

Gilles commented on MATH-631:
-----------------------------

I understand what you say. But however you put it, there is a bug; if not in 
the implementation, then in the API. It is not expected behaviour that 
something which must be changed (function accuracy threshold) to ensure correct 
behaviour (avoid an undetected infinite loop) is not a mandatory parameter.
To debug this, I started by raising the absolute accuracy threshold (the first 
default parameter, thus the first obvious thing to do) to 1e-2 and was stunned 
that I couldn't get anything after 1000000 iterations!

Therefore I maintain that, at a minimum, we put a line that will detect the 
infinite loop and raise an exception identifying _that_ problem and not let the 
user wait for "TooManyEvaluationsException" to be raised, as that will induce 
the unaware (me) to just allow more evaluations and try again.

This solution does not corrupt the algorithm; it just adds protection.


> "RegulaFalsiSolver" failure
> ---------------------------
>
>                 Key: MATH-631
>                 URL: https://issues.apache.org/jira/browse/MATH-631
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Gilles
>             Fix For: 3.0
>
>
> The following unit test:
> {code}
> @Test
> public void testBug() {
>     final UnivariateRealFunction f = new UnivariateRealFunction() {
>             @Override
>             public double value(double x) {
>                 return Math.exp(x) - Math.pow(Math.PI, 3.0);
>             }
>         };
>     UnivariateRealSolver solver = new RegulaFalsiSolver();
>     double root = solver.solve(100, f, 1, 10);
> }
> {code}
> fails with
> {noformat}
> illegal state: maximal count (100) exceeded: evaluations
> {noformat}
> Using "PegasusSolver", the answer is found after 17 evaluations.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to