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

Is there a way to impose boundary condition (like derivatives at the edges) with this module? #8

Open
0xjunhao opened this issue Nov 18, 2015 · 11 comments

Comments

@0xjunhao
Copy link

No description provided.

@jacobwilliams
Copy link
Owner

I believe you can do that by specifying your own knot sequence? You can do this using the subroutine interface (see, for example, the comments in the db2ink routine in bspline_sub_module.f90 (you set iflag=1, and provide your own tx and ty arrays.

@0xjunhao
Copy link
Author

I still can't figure this out. Say a 1d spline interpolated by (x1, y1) (x2, y2) ... (xn, yn) that I want to set its left/right bound derivative (i.e. at x1, xn) to a/b, respectively. How shall I set the knots to achieve that?

@jacobwilliams
Copy link
Owner

I'm not sure. You may have to check the references given in the core routines. I've only ever used the default (not-a-knot) end conditions.

@jacobwilliams
Copy link
Owner

Note: as of 4.1.0 you can now set the knots from the object-oriented interface also.

@pbregener
Copy link
Contributor

pbregener commented Aug 30, 2018

I'm pretty sure you can't do this by modifying the knot vector alone.

Edit:
Need to look into this again. The dbint4() routine from CMLIB might give some inspiration.

@jacobwilliams
Copy link
Owner

Very interesting, I don't think I noticed this routine before. I think we could definitely use it...

@jacobwilliams jacobwilliams reopened this Aug 31, 2018
jacobwilliams added a commit that referenced this issue Aug 31, 2018
@pbregener
Copy link
Contributor

dbint4 is hardcoded to fourth-order, which we probably want to change.

In terms of actual end conditions, it would be great to be able to set first or second derivatives directly (as is possible in dbint4). Periodic boundary conditions would also be extremely useful for me.

For the OO interface, some shortcuts could be great, for example a simple flag that gives a natural spline (second derivatives zero at the ends), or specifying periodicity in individual dimensions.

Not sure how far the original CMLIB routines can help us here, but for more advanced applications, we might be able to leverage some of Dierckx's FITPACK routines.

@jacobwilliams
Copy link
Owner

As for the dbink4 routine, I've got some experiments going on the dbink4 branch. I'll get it hooked up and working just for 1D and 4th order so I can test it out. Then I can look into the details of:

  • how to generalize it for an order
  • how to call it for any dimension (2D-6D)

I think both are doable.

@zerothi
Copy link

zerothi commented Sep 6, 2018

Just a feature request along this:

👍 for periodic boundary conditions

@Michael-P-Crisp
Copy link

Hi Jacob, thanks for this library, it's almost exactly what I need for smooth 4D interpolation. Is there any chance of being able to specify natural boundary conditions (second derivative zero at ends) in the near future?

@jacobwilliams
Copy link
Owner

No promises, but I have started to get back to looking into this.

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

5 participants