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 A06F97A1D for ; Tue, 1 Nov 2011 10:40:56 +0000 (UTC) Received: (qmail 3896 invoked by uid 500); 1 Nov 2011 10:40:55 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 3820 invoked by uid 500); 1 Nov 2011 10:40:55 -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 3812 invoked by uid 99); 1 Nov 2011 10:40:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Nov 2011 10:40:55 +0000 X-ASF-Spam-Status: No, hits=-2001.2 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; Tue, 01 Nov 2011 10:40:53 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 3321F32CACD for ; Tue, 1 Nov 2011 10:40:32 +0000 (UTC) Date: Tue, 1 Nov 2011 10:40:32 +0000 (UTC) From: =?utf-8?Q?S=C3=A9bastien_Brisard_=28Commented=29_=28JIRA=29?= To: issues@commons.apache.org Message-ID: <33300141.45217.1320144032210.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <2025740397.45031.1320137432321.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (MATH-700) Alter the contract of UnivariateRealSolverUtils.bracket() to handle piecewise constant functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/MATH-700?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D131410= 69#comment-13141069 ]=20 S=C3=A9bastien Brisard commented on MATH-700: ---------------------------------------- Thanks for this counter-example. This proposal actually comes from MATH-699= . To solve this bug, I think I need to alter the default bracketing method.= I was just wondering if this alteration would be useful to other parts of = CM. It it's not, then I can define a custom protected bracketing method wit= hin {{AbstractDistribution}}.=20 =20 > Alter the contract of UnivariateRealSolverUtils.bracket() to handle piece= wise constant functions > -------------------------------------------------------------------------= ----------------------- > > Key: MATH-700 > URL: https://issues.apache.org/jira/browse/MATH-700 > Project: Commons Math > Issue Type: Improvement > Affects Versions: 3.0 > Reporter: S=C3=A9bastien Brisard > Priority: Minor > > The current contract of {{o.a.c.m.analysis.solvers.UnivariateRealSolverUt= ils.bracket(UnivariateRealFunction function, double initial, double lowerBo= und, double upperBound, int maximumIterations)}} states that > {quote} > This method attempts to find two values a and b satisfying > * {{lowerBound <=3D a < initial < b <=3D upperBound}} > * {{f(a) * f(b) <=3D 0}} > If f is continuous on [a,b], this means that a and b bracket a root of f.= =20 > {quote} > I don't think there is any problem with the current implementation. Howev= er, if f is constant, equal to zero on a whole interval, this implementatio= n does not guarantee that the whole interval is bracketed. I therefore prop= ose that the contract is changed to > * {{f(a) * f(b) < 0}} > This entails only a minor correction to the {{bracket()}} method: line 26= 7 of UnivariateRealSolverUtils currently reads > ...{{while ((fa * fb > 0.0) && (numIterations < maximumIterations)}}... > I think it would be safe to replace this line with > ...{{while ((fa * fb >=3D 0.0) && (numIterations < maximumIterations)}}..= . > Do you agree in principle? I'll run the current tests to check that this = change is indeed safe. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs: https://issues.apache.org/jira/secure/ContactAdministrators!default.jsp= a For more information on JIRA, see: http://www.atlassian.com/software/jira