http://quantlib.414.s1.nabble.com/bug-related-to-error-message-root-not-bracketed-tp153p155.html
My further investigation shows that the problem is somewhere else.
I was using <Forward, Linear> in the boostraping and when the input data is noisy (or too many data points), the forward rate can be negative. So the change should be in
158 Real min = Traits::minValueAfter(i, ts_->data_);// -2.0; //JSHI, allow negative if using forward linear
> Subject: Re: [Quantlib-users] bug related to error message "root not bracketed"
> From:
[hidden email]> To:
[hidden email]> CC:
[hidden email]> Date: Tue, 8 Jun 2010 11:30:29 +0200
>
> On Thu, 2010-06-03 at 18:37 +0000, Jinping Shi wrote:
> > in file ./ql/math/solver1d.hpp, the following bug causes error like
> >
> > "root not bracketed: f[2.22045e-16,3] ->
> > [-1.534964e-04,-5.486424e-02]"
> >
> >
> > 185 fxMin_ = f(xMin_);
> > 186 //if (fxMin_ == 0.0) // Bugfix JSHI
> > 187 if (fxMin_ <= accuracy)
> > 188 return xMin_;
> > 189
> > 190 fxMax_ = f(xMax_);
> > 191 //if (fxMax_ == 0.0) // Bugfix JSHI
> > 192 if (fxMax_ <= accuracy)
> > 193 return xMax_;
>
> Yes, I remember this. The problem is, in this method we don't know if
> the accuracy was requested on x of f(x); that differs from solver to
> solver. If f(xMin_) < accuracy, we can return xMin_ if the accuracy was
> requested on f(x), since f(xMin_) is close enough to 0; but if it was on
> x, we can't return as we're not sure that xMin_ is close enough to the
> actual root X (i.e., that xMin_ - X < accuracy.) The only case in which
> we can return is when f(xMin_) is precisely 0, because we found the
> root. So, as of now, it's correct for the solver not to return
> immediately. To fix the problem, we could add some logic later (when
> the error message is thrown) to ensure that the missing bracketing is
> not due to numerical error; or we could add some property to the solvers
> so that we know whether the accuracy is on x or f(x), and return when
> possible. Would you mind trying to code that?
>
> Thanks,
> Luigi
>
>
> --
>
> Quote me as saying I was misquoted.
> -- Groucho Marx
>
>
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail.
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win: