Skip to content

Commit

Permalink
add example
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoGranstrom committed Jul 7, 2023
1 parent 595d867 commit 8e235e8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/numericalnim/interpolate.nim
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ export rbf
## - Hermite spline (recommended): cubic spline that works with many types of values. Accepts derivatives if available.
## - Cubic spline: cubic spline that only works with `float`s.
## - Linear spline: Linear spline that works with many types of values.
##
## ### Extrapolation
## Extrapolation is supported for all 1D interpolators by passing the type of extrapolation as an argument of `eval`.
## The default is to use the interpolator's native method to extrapolate. This means that Linear does linear extrapolation,
## while Hermite and Cubic performs cubic extrapolation. Other options are using a constant value, using the values of the edges,
## linear extrapolation and raising an error if the x-value is outside the domain.

runnableExamples:
import numericalnim, std/[math, sequtils]
Expand All @@ -28,6 +34,8 @@ runnableExamples:

let val = interp.eval(0.314)

let valExtrapolate = interp.eval(1.1, Edge)

## ## 2D interpolation
## - Bicubic: Works on gridded data.
## - Bilinear: Works on gridded data.
Expand Down

0 comments on commit 8e235e8

Please sign in to comment.