commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <>
Subject [jira] [Commented] (MATH-631) "RegulaFalsiSolver" failure
Date Sun, 07 Aug 2011 20:30:27 GMT


Gilles commented on MATH-631:

"fails to converge" and "large number of iteration to converge" are completely different things.

The documentation says: "convergence is guaranteed". Is _that_ false?

Moreover, for the function reported in this issue, the problem is not that it takes a large
number iterations, it is that the loop is _literally_ infinite because at some point, nothing
changes anymore.

Stated otherwise: If implemented with larger/infinite precision, would it converge?
In the affirmative, then in my opinion it means that the plain "Regula Falsi" method cannot
be implemented with double precision (or that its convergence properties are not as stated
in the docs) or that there is a bug in the implementation.

In the former case, why keep something that will never be used (as we'll warn users that they
should use "Pegasus" or "Illinois" but certainly not "RegulaFalsi")? IMHO, we could just state
in the docs that "RegulaFalsi" was not implemented because it is demonstrably less efficient
and sometimes fails to work.

A less radical alternative would be to keep the test I've inserted in the code (at line 186)
and throw a {{MathIllegalStateException}} if it passes. The previous behaviour (infinite loop)
is a bug in CM.

> "RegulaFalsiSolver" failure
> ---------------------------
>                 Key: MATH-631
>                 URL:
>             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:


View raw message