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

Continuousness of B splines #15677

Open
moesphere opened this issue Dec 20, 2018 · 2 comments
Open

Continuousness of B splines #15677

moesphere opened this issue Dec 20, 2018 · 2 comments

Comments

@moesphere
Copy link

The piecewise objects that are returned when creating B splines, should be either right-continuous (preferred, see Carl de Boor's book or papers) or left-continuous.

Currently, the boundaries of an interval are also part of the adjacent intervals.
See e.g. here

@normalhuman
Copy link
Contributor

This is only relevant for d=0, right? Otherwise the splines are continuous. The support for degree-0 splines seems inconsistent at present.

>>> interpolating_spline(0, x, [1, 2, 3], [1, 2, 3])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/k3/sympy/sympy/functions/special/bsplines.py", line 250, in interpolating_spline
    "Spline degree must be a positive integer, not %s." % d)
ValueError: Spline degree must be a positive integer, not 0.

but

>>> bspline_basis_set(0, [1, 2, 3], x)
[Piecewise((1, (x >= 1) & (x <= 2)), (0, True)), Piecewise((1, (x >= 2) & (x <= 3)), (0, True))]

I agree using closed intervals here is problematic because these Piecewise functions are not a basis for degree 0 splines. To be consistent with Wikipedia or the sources you mentioned, we need

[Piecewise((1, (x >= 1) & (x < 2)), (0, True)), Piecewise((1, (x >= 2) & (x < 3)), (0, True))]

@moesphere
Copy link
Author

In general it is at least possible to have jumps with higher degree splines, if the multiplicity of a knot is large enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants