Using flat() in LinearInterpolation

I want to create an interpolation object which uses the Flat() option when extrapolating, but I run into “Flat() not defined” when specifying it so. The Line() option works well.

Eg., the following works
interp1 = LinearInterpolation(1:5, 2:6, extrapolation_bc=Line())
interp1(6.0) returns 7.0

interp2 = LinearInterpolation(1:5, 2:6, extrapolation_bc=Flat())
returns ERROR: UndefVarError: Flat not defined

Is this a bug or am I using the option wrong?

works fine for me on Julia v1.6.0 with Interpolations v0.13.1


Ah, updating just Interpolations (still running Julia v1.5.2.) and restarting solved it, thanks!¨

Lesson learned: Update packages before asking.

1 Like