Re: Can I extrapolate beyond interpolation range in LinearInterpolation?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Can I extrapolate beyond interpolation range in LinearInterpolation?

Luigi Ballabio
Hello,
    apologies for the delay.  If you have an instance i of an
interpolation (linear or otherwise), you can extrapolate in two ways:
- in a single call, by passing a second parameter to operator() that
allows extrapolation. Something like:

    y1 = i(0.2);  // this will raise an exception
    y2 = i(0.2, true);  // this will return an extrapolated value.

- if you want to do several calls, you can tell the interpolation to
always allow extrapolation. This will work:

    i.enableExtrapolation();
    y = i(0.2);  // now this will return a value

Hope this helps,
    Luigi


On Wed, May 7, 2014 at 10:20 AM, v17 <[hidden email]> wrote:

> Hello,
>
> I am doing LinearInterpolation with x-vector being YearFrac and y vector as
> YTMs -
>
> X-vector is {0.5,1,2,3,4,5,6,7,8,9,10,15)
>
> Interpolation works fine for yearFrac range 0.5 to 15
>
> However for yearfrac < 0.5 and > 15 it gives exception.
>
> Is there any way to interpolate beyond range?
>
>
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/Can-I-extrapolate-beyond-interpolation-range-in-LinearInterpolation-tp15240.html
> Sent from the quantlib-dev mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
> • 3 signs your SCM is hindering your productivity
> • Requirements for releasing software faster
> • Expert tips and advice for migrating your SCM now
> http://p.sf.net/sfu/perforce
> _______________________________________________
> QuantLib-dev mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev