Interpolations

Build Status PkgEval Status Interpolations

NEWS v0.9 was a breaking release. See the news for details on how to update.

This package implements a variety of interpolation schemes for the Julia language. It has the goals of ease-of-use, broad algorithmic support, and exceptional performance.

Currently this package's support is best for B-splines and also supports irregular grids. However, the API has been designed with intent to support more options. Pull-requests are more than welcome! It should be noted that the API may continue to evolve over time.

Other interpolation packages for Julia include:

Some of these packages support methods that Interpolations does not, so if you can't find what you need here, check one of them or submit a pull request here.

Installation

Just

using Pkg
Pkg.add("Interpolations")

from the Julia REPL.

Example Usage

Create a grid xs and an array A of values to be interpolated

xs = 1:0.2:5
f(x) = log(x)
A = [f(x) for x in xs]

Create linear interpolation object without extrapolation

interp_linear = LinearInterpolation(xs, A)
interp_linear(3) # exactly log(3)
interp_linear(3.1) # approximately log(3.1)
interp_linear(0.9) # outside grid: error

Create linear interpolation object with extrapolation

interp_linear_extrap = LinearInterpolation(xs, A,extrapolation_bc=Line()) 
interp_linear_extrap(0.9) # outside grid: linear extrapolation