root not bracketed

Posted by Khanh Nguyen on
URL: http://quantlib.414.s1.nabble.com/root-not-bracketed-tp7525.html

Hi all,

I am replicating this the first example from this page
http://www.mathworks.com/access/helpdesk/help/toolbox/finfixed/zeroyield.html

Matlab:
Example 1. Compute the yield of a short-term zero-coupon instrument.
Settle   = '24-Jun-1993';
Maturity = '1-Nov-1993';
Basis    = 0;
Price    = 95;
Yield = zeroyield(Price, Settle, Maturity, [], Basis)

Yield =
    0.1490

Code code look like this

int main() {
    double settlementDays = 1;

    Date settleDate(24, (Month)6, 1993);
    Date maturityDate(1, (Month)11, 1993);

    DayCounter dc = ActualActual();
    BusinessDayConvention bdc = ModifiedFollowing;
    double faceAmount = 100;
    double redemption = 100;

    ZeroCouponBond bond1(settlementDays,
                         UnitedStates(UnitedStates::GovernmentBond),
                         faceAmount,
                         maturityDate,
                         bdc,
                         redemption, settleDate);

    cout << bond1.yield(95, ActualActual(), Simple ,Annual);
}

it compiles, but returns "what(): root not bracketed: f[0,1] -> [nan, nan]"

Any help, please? Thanks.

-k

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users