commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luc Maisonobe (JIRA)" <>
Subject [jira] [Commented] (MATH-631) "RegulaFalsiSolver" failure
Date Mon, 08 Aug 2011 20:15:31 GMT


Luc Maisonobe commented on MATH-631:

May I please know *why it is OK that a bit of code does loop counting and repeatedly computes
the same thing!*

We didn't say that. We said that regula falsi is a standard *bad* algorithm. We said that
very smart people have enhanced it 40 years ago and the enhanced versions are known and already
implemented in Commons Math. These algorithms are *not* blind loop counters and they insert
smart target shifts that *prevent* the behavior we observe here. These algorithms not only
detect the problem, they fix it! They allow convergence along x. They allow selection of the
side of the root.

The function is potentially evaluated millions of times at the same point.

The maxEvaluations is already here to prevent this, and in fact now this max number is even
mandatory in the solve method (you placed it if I remember correctly). So the function is
called millions of time only if the users wishes so by setting the maxEvaluations to a number
in the range of millions.

And may I please know *why it is OK that an algorithm that finds the right result does not
return it.*

If the user asked for a convergence in x or for a convergence on y on the side that is stuck,
then no, the algorithm did not find the right result. One of its bounds converged but the
users asked for something else.

You just have to run the code and print "x" and "x1" to see what is going on!

We know exactly what is going on! We know the algorithm is stuck. We know why it is stuck.
We know why it did not detect it is stuck. We know it will finally hit the safety maxEvaluation
threshold that is just waiting for that. And we know that removing all these problems is done
by using other algorithms which are already there.

Regula falsi is doomed. It is an algorithm used for educational purposes, or for comparison
purposes, not something suited for production use. It is just like Euler for ODE (and by the
way we did implement Euler for ODE and we don't recommend users to use it as we also did implement
better algorithms that were also designed by smart mathematicians decades ago).

> "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