Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: CubicSpline's natural boundary conditions #235

Merged
merged 2 commits into from
Mar 26, 2024

Conversation

sathvikbhagavan
Copy link
Member

@sathvikbhagavan sathvikbhagavan commented Mar 26, 2024

Fixes: #234

Now we get the same outputs as scipy

julia> CubicS.(v)
20-element Vector{Float64}:
 318.6243760456969
 334.40200181048806
 347.13345942996295
 356.2838248343795
 362.79265929502935
 367.66363214151
 371.88318244762684
 376.04145340397156
 380.33229231792177
 384.9323162410631
 390.002925359128
 395.35553194322165
 400.451560349822
 404.7372180695537
 407.7255576184023
 410.46706709565404
 415.5496701838955
 425.6281355910744
 443.20840335017215
 467.3733539699478

image

https://en.wikiversity.org/wiki/Cubic_Spline_Interpolation

The first entry of the third column and last entry of first column in the tridiagonal matrix should have been zero.

For the tests, the polynomial mentioned in https://github.com/SciML/DataInterpolations.jl/blob/master/test/interpolation_tests.jl#L501 is not correct for natural boundary condition. Found the right ones in https://tools.timodenk.com/cubic-spline-interpolation

image

@ChrisRackauckas ChrisRackauckas merged commit 5f89b9d into SciML:master Mar 26, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Boundary condition of Cubic Spline interpolation
2 participants