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

Spline derivatives issue #32

Open
cc7768 opened this issue Jul 9, 2017 · 1 comment
Open

Spline derivatives issue #32

cc7768 opened this issue Jul 9, 2017 · 1 comment

Comments

@cc7768
Copy link
Member

cc7768 commented Jul 9, 2017

using BasisMatrices

x = linspace(0.0, 5.0, 25)
p = SplineParams(x, 0, 3)

itp = BasisMatrices.Interpoland(Basis(p), [nodes(p).^2 nodes(p).^3])

pts = [1.0, 2.0, 3.0]

println(itp(1.0, reshape([0, 1], (2, 1))))
println(itp(1.0, reshape([0, 1], (1, 2))))
println(itp(1.0, reshape([1], (1, 1))))

The first print command should give the level and first derivative of the two functions

The second print command should compute df(x)/dy and should fail because there isn't a second dimension to take a derivative with respect to.

The third print command reacts as expected.

@sglyon
Copy link
Member

sglyon commented Jul 10, 2017

ouch... you seem to have hit three errors here.

  1. This method should only be calling vec when order::Int. When order::AbstractMatrix then we should be squeezing the first dimension instead of all dimensions. splitting that method in two should make the fix easy.
  2. We shouldn't accept things like itp(1.0, [0 1]). The specification for the order argument should be either an integer for evaluating all dimensions at the same order of derivative or a matrix that has N columns -- where N is the dimensionality of the basis. Having a 1d basis and passing a 2 column order should be an error
  3. Spline derivatives look accurate when we only ask for the derivative. There is something funky going on when we ask for more than one thing at a time. We need to debug this... I'd start by making sure the two basis matrices

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

No branches or pull requests

2 participants