-
Notifications
You must be signed in to change notification settings - Fork 9
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
BCs with few knots incorrect #55
Comments
Hi, I'm glad you find this package useful! This definitely looks like a bug, thanks for reporting it. I'll try to get it fixed when I find some time within the next few days. |
Awesome! Thanks for the very quick reply! |
After thinking about this issue, I believe this is a limitation of the recombination procedure, which defines basis functions as linear combinations of B-splines near the boundaries. This can be represented using a "recombination" matrix. In your first example, the recombination matrix looks as follows: julia> recombination_matrix(RecombinedBSplineBasis(Derivative(2), BSplineBasis(4, [0,0.25,0.5,0.75,1])))
7×5 RecombineMatrix{Float64, Tuple{Derivative{2}}, 2, 3, StaticArraysCore.SMatrix{3, 2, Float64, 6}}:
1.2 ⋅ ⋅ ⋅ ⋅
0.8 0.5 ⋅ ⋅ ⋅
⋅ 1.5 ⋅ ⋅ ⋅
⋅ ⋅ 1.0 ⋅ ⋅
⋅ ⋅ ⋅ 1.5 ⋅
⋅ ⋅ ⋅ 0.5 0.8
⋅ ⋅ ⋅ ⋅ 1.2 which basically means that the first (last) two functions of the recombined basis are obtained as recombinations of the first (last) three functions of the original B-spline basis. In this case, the original basis has 7 functions and the recombined one has 5. Note that we need to recombine a total of 6 different B-spline functions ( When you reduce the size of the original basis to 5, as in your second example, it is of course no longer possible to recombine 6 different B-spline functions. Right now the recombination matrix gives this: julia> recombination_matrix(RecombinedBSplineBasis(Derivative(2), BSplineBasis(4, [0,0.5,1])))
5×3 RecombineMatrix{Float64, Tuple{Derivative{2}}, 2, 3, StaticArraysCore.SMatrix{3, 2, Float64, 6}}:
1.2 ⋅ ⋅
0.8 0.5 ⋅
⋅ 1.5 ⋅
⋅ ⋅ 0.8
⋅ ⋅ 1.2 which is wrong. I think the only solution here is to just throw an error when the original basis is not large enough for the wanted recombination. |
I agree that you can't treat the left/right boundary conditions independently any more; their recombinations will overlap. However, I'm still convinced that you have enough degrees of freedom to find a recombination that satisfies the |
I'll have to give it some more thought as well. I'll be happy to know if you come up with something. |
Hi!
Thanks for making this very useful tool. It's very easy to use. However, I think I stumbled upon some unexpected behaviour.
I wanted to make a spline with boundary conditions on the second derivative. So I expect the spline to evaluate to zero at both boundaries, like so:
So far, this is expected behaviour. However, when I reduce the number of knots from 5 to 3, which should still be valid, I get non-zero values for the second derivative at the right boundary:
Could this be a bug?
The text was updated successfully, but these errors were encountered: