commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MATH-631) "RegulaFalsiSolver" failure
Date Fri, 12 Aug 2011 16:52:27 GMT

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

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

Thanks for the neat summary!

{quote}
* (1) Revert part of 1154614, so get the original algorithm back. The other changes of that
commit, that don't change the actual algorith, can stay.
{quote}

Done in revision 1157185.

{quote}
* (2) If we keep the algorithm, earlier detection would be nice. Not sure which exception
to throw in these cases.
** This would result in a single 'if' that detects that the new approximation is the same
as the previous one, and we thus no longer make progress, in which case we throw the exception
earlier, instead of later.
{quote}

+1 (my position in the "07/Aug/11 20:28" post)
As suggested there, the exception could be "MathIllegalStateException" but with a clear message
stating that the algorithm is stuck. Or maybe a new subclass of it which we could call "NumericalPrecisionException"
or even a general-purpose "ImplementationException".

{quote}
[...] all 3 documentation extensions would be a good idea.
{quote}

+1

About the "new issue", the message string:
{quote}
"illegal state: maximal count (100) exceeded: evaluations"
{quote}
contains everything:
# error type: illegal state
# failure description: maximal count (100) exceeded
# context: evaluations

I proposed to use this approach (combining message items with the "addMessage" method of "ExceptionContext")
in order to reduce the number of messages in the "LocalizedFormats" enum. Too many of them
are just slight variations on a same theme.


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

        

Mime
View raw message