commons-issues mailing list archives

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

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

Sébastien Brisard edited comment on MATH-700 at 11/3/11 4:24 AM:
-----------------------------------------------------------------

Attached file {{MATH-700-bracketStrict.diff}} proposes a new method, {{bracketStrict}}, to
handle the case considered here.
Do you think there is any use for this method (otherwise, I'll declare it as a protected method
in {{ContinuousDistribution}}).
                
      was (Author: celestin):
    Attached file {{MATH-700-bracketStrict.diff}} proposes a new method --{{bracketStrict}}--
to handle the case considered here.
Do you think there is any use for this method (otherwise, I'll declare it as a protected method
in {{ContinuousDistribution}}).
                  
> 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
>         Attachments: MATH-700-bracketStrict.diff
>
>
> 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