BackwardFlat and ForwardFlat interpolations

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

BackwardFlat and ForwardFlat interpolations

Fabio Ramponi
Hi all,

I was trying to use BackwardFlatInterpolation and ForwardFlatInterpolation to create some kind of piecewise constant forward rate term structure using the InterpolatedForwardCurve class.

I noticed that the calculate() and primitive() methods for the two interpolations are exactly the same. In my opinion, in the ForwardFlatInterpolation, the y(x) value in the interval x[i]-x[i+1] should be y(x[i]), and not y(x[i+1]).

In this case, lines 49 and 59 in forwardflatinterpolation.hpp should respectively sound like these:

(line 49)     primitive_[i] = primitive_[i-1] + dx*this->yBegin_[i-1];

(line 59)     return
primitive_[i] + dx*this->yBegin_[i];

Is that right?

Thanks in advance.

Best regards,

Fabio


----
Email.it, the professional e-mail, gratis per te: clicca qui

Sponsor:
Refill srl il paradiso della tua stampante - cartucce e toner compatibili, inchiostri e accessori per la ricarica, carta speciale. Tutto a prezzi scontatissimi!
Clicca qui

Reply | Threaded
Open this post in threaded view
|

Re: BackwardFlat and ForwardFlat interpolations

Luigi Ballabio

On 06/15/2006 05:54:25 PM, Fabio Ramponi wrote:
> I was trying to use BackwardFlatInterpolation and
> ForwardFlatInterpolation to create some kind of piecewise constant  
> forward rate term structure using the InterpolatedForwardCurve class.
>
> I noticed that the calculate() and primitive() methods for the two
> interpolations are exactly the same.

Right---they were broken. They are fixed now.

Thanks,
        Luigi


----------------------------------------

There's no sense in being precise when you don't even know what you're
talking about.
-- John von Neumann