|
From: Peter C. <pca...@gm...> - 2014-10-10 19:32:04
|
Hi, this was only for diagnostic purposes, not a final solution we should put in the code. I'd have to check your specific case, but in general I would think that a yield could be in the range from -inf to +inf: If you have -1 today (pay 1 unit) and receive a > 0 at t=1, the continuous yield would be -ln(1/a) which goes to -inf if a goes to zero and to +inf if a goes to +inf. No ? best regards Peter On 8 October 2014 17:41, ltorjul <lt...@ho...> wrote: > Hi, > > Thanks for your answer! > > I tested your suggestion and changed line 968 in the cashflows.cpp file to: > return solver.solve(objFunction, accuracy, guess, -10.0 , 10.0); > > This causes the error: > root not bracketed: f[-10,10] -> [-1.#IND00e+000,5.999990e+004] > > I guess the reason is that a root of -10 cannot exist. If you look at the > question from a financial perspective, you can off course loose you entire > investment (Which would give a yield of -100%), but you could never get in > the situation where you owe money (i.e. yield cannot be < -100%). Not sure > if this makes any sense to you. > > Anyway I tested with: > return solver.solve(objFunction, accuracy, guess, -1.0 , 10.0); > and this seems to work. I'm able to calculate yield in those extreme cases > where yield is less than -54.4%. > > I have also tested the unmodified yield function with a difference initial > guess, e.g. > yield(frb, cleanPrice, dayCounter, QuantLib::Compounded, coupCompfrequency, > settlementDate, 1e-8, 100, *-0.80*) > > and it seems that using an initial guess of -.8 (-80%) "moves" the limit > where the problem occures to about -91%. This however this causes the solver > to work about 15% slower :-( > > Anyway I like the solution where you sets the upper and lower limits better. > > I'm good with this solution. But if you have other ideas or remarks I would > be very grateful. > > Regards Laurtiz > > > > > -- > View this message in context: http://quantlib.10058.n7.nabble.com/yield-calculation-failing-when-resulting-yield-should-be-less-than-54-4-tp15932p15952.html > Sent from the quantlib-dev mailing list archive at Nabble.com. > > ------------------------------------------------------------------------------ > Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer > Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports > Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper > Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer > http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk > _______________________________________________ > QuantLib-dev mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantlib-dev |