[ https://issues.apache.org/jira/browse/MATH700?page=com.atlassian.jira.plugin.system.issuetabpanels:commenttabpanel&focusedCommentId=13141066#comment13141066
]
Luc Maisonobe commented on MATH700:

I don't agree with this change.
It implies that user cannot provide an interval that ends exactly at a root, they must enlarge
their interval and then wait for the algorithm to reduce it back. When a root is at the boundary
of a function definition interval (think about finding the root for sqrt(x)), enlarging the
interval is not only cumbersome, it triggers an error.
> Alter the contract of UnivariateRealSolverUtils.bracket() to handle piecewise constant
functions
> 
>
> Key: MATH700
> URL: https://issues.apache.org/jira/browse/MATH700
> 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
