Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 03777728A for ; Sun, 7 Aug 2011 20:30:53 +0000 (UTC) Received: (qmail 43889 invoked by uid 500); 7 Aug 2011 20:30:52 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 43564 invoked by uid 500); 7 Aug 2011 20:30:51 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 43548 invoked by uid 99); 7 Aug 2011 20:30:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Aug 2011 20:30:51 +0000 X-ASF-Spam-Status: No, hits=-2000.8 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 07 Aug 2011 20:30:48 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 4209DB0B23 for ; Sun, 7 Aug 2011 20:30:27 +0000 (UTC) Date: Sun, 7 Aug 2011 20:30:27 +0000 (UTC) From: "Gilles (JIRA)" To: issues@commons.apache.org Message-ID: <612856859.15016.1312749027267.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1824962433.1547.1311464949737.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (MATH-631) "RegulaFalsiSolver" failure MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/MATH-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13080641#comment-13080641 ] 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: 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