JuliaMath / JuliaMath/Interpolations.jl

Periodic onCell OnGrid

Open
#299 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
575
Forks
117
PR merge metrics
No merged PRs in 30d

Description

I tried the following code:

`using Interpolations`
`using Dierckx`
`t = range(-π,stop=π, length=8)`
`y = sin.(t);`
`y[end] = y[1]`

`tt = range(-π,stop=π, length=100)`

`itpg = extrapolate(interpolate(y, BSpline(Cubic(Periodic(OnGrid())))),Periodic())`
`itpc = extrapolate(interpolate(y, BSpline(Cubic(Periodic(OnCell())))),Periodic())`
`sitpg = scale(itpg, t)`
`sitpc = scale(itpc, t);`

`p = ParametricSpline(t,reshape(y,1,:),periodic=true);`

`yy = sin.(tt)`
`yg = sitpg(tt);`
`yc = sitpc(tt);`
`yd = reshape(p(tt),:);`

I saw a small difference between `yg` and `yc` of the order10^-17, so basically numerical precision.

No effects basically between the OnCell and OnGrid.

The approximation calculated by the Diercks routines was closer to the true values:

`maximum(yg.-yy)` = 0.0969
`maximum(yd.-yy)` = 0.0020

Cheers,
:-)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.