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

Luc Maisonobe commented on MATH-631:
------------------------------------

{quote}
All the above imply that one expects that the algorithm can find the solution.
However, in this implementation, it can't.
Therefore there is a bug, somewhere.
{quote}

Here, the bug is in the algorithm itself, not in the implementation.

{quote}
it leads to the impression that the "Regula Falsi" mathematical algorithm can 
fail to converge, which is not correct (IIUC).
{quote}

It is correct. Regula Falsi fails to converge, or rather it can take a too 
large number of iteration to converge. This is exactly this behavior that has 
lead to the construction of other algorithms like Illinois or Pegasus. These 
two algorithms try to detect the case when the same end of the interval is 
always updated, and the other end remains unchanged. Once they have detected 
this, they slightly change the value at one end to trick the linear evaluation 
into choosing a value that is very likely to have the required sign to update 
this other end. In fact, in many cases depending of the sign of the curvature 
near the root, as soon as one end is very close to the root the linear 
interpolation will always remain on the same side of the root and hence will 
update this end.

I agree with Dennis here, the change needed to ensure convergence is not tool 
long is to choose a better algorithm, such as Illinois, Pegasus ... or the nth 
order bracketing solver I recently added. Regula Falsi should remain the 
reference Regula Falsi, just as secant and Brent should remain the reference 
ones.


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