Skip to content

Second derivatives are very noisy near endpoints #370

Closed
@hersle

Description

@hersle

The second derivative is very noisy near the spline endpoints:

using DataInterpolations, Plots
t = 0.0:0.01:1.0
y = @. t^2 # -> y′ = 2*t, y″ = 2
yspl = CubicSpline(y, t)
plot(t, yspl(t); label = "y")
plot!(t, t -> DataInterpolations.derivative(yspl, t, 1); label = "y′")
plot!(t, t -> DataInterpolations.derivative(yspl, t, 2); label = "y″")

image

The first derivative looks much better, but also looks more kinky than it should near the ends (?) 🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions