commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sébastien Brisard (Commented) (JIRA) <j...@apache.org>
Subject [jira] [Commented] (MATH-700) Alter the contract of UnivariateRealSolverUtils.bracket() to handle piecewise constant functions
Date Tue, 01 Nov 2011 10:40:32 GMT

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

Sébastien 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 within {{AbstractDistribution}}. 
                
> Alter the contract of UnivariateRealSolverUtils.bracket() to handle piecewise 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ébastien Brisard
>            Priority: Minor
>
> The current contract of {{o.a.c.m.analysis.solvers.UnivariateRealSolverUtils.bracket(UnivariateRealFunction
function, double initial, double lowerBound, double upperBound, int maximumIterations)}} states
that
> {quote}
> This method attempts to find two values a and b satisfying
> * {{lowerBound <= a < initial < b <= upperBound}}
> * {{f(a) * f(b) <= 0}}
> If f is continuous on [a,b], this means that a and b bracket a root of f. 
> {quote}
> I don't think there is any problem with the current implementation. However, if f is
constant, equal to zero on a whole interval, this implementation does not guarantee that the
whole interval is bracketed. I therefore propose that the contract is changed to
> * {{f(a) * f(b) < 0}}
> This entails only a minor correction to the {{bracket()}} method: line 267 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 >= 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 administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message