[SciPy-User] optimize.brentq and step function

Charles R Harris charlesr.harris at gmail.com
Thu Feb 28 23:43:28 EST 2013


On Thu, Feb 28, 2013 at 8:44 PM, <josef.pktd at gmail.com> wrote:

> brentq documentation says "f must be a continuous function"
>
> I forgot that I have a step function and tried brentq and it worked.
> Is this an accident or a feature?
>
>
Feature, the documentation is off. Brentq falls back on bisection when it
converges too slowly. And there is some subtlety in 'slowly', but it does
work find a point of sign where the function changes sign, all that is
required is the the function be defined everywhere on the interval and
there be a finite number of 'zeros'. If you know you have a discontinuity,
plain old bisection is probably faster, but one of the best things about
brentq is its generality.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20130228/cb900437/attachment.html>


More information about the SciPy-User mailing list