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

Bug in gradient evaluation near edges? #64

Closed
tomasaschan opened this issue Sep 14, 2015 · 1 comment
Closed

Bug in gradient evaluation near edges? #64

tomasaschan opened this issue Sep 14, 2015 · 1 comment
Labels

Comments

@tomasaschan
Copy link
Contributor

Given the following,

using Interpolations
xs = -pi:2pi/20:pi
itp = interpolate(sin(xs), BSpline(Quadratic(Periodic)), OnGrid)

using Gadfly
plot(x=xs, y=[gradient(itp,x)[1] for x in xs], Geom.path)

I think we ought to be able to do better than this at the edges:

gradient-bug

Just to make sure that this is related to edge-proximity, and not to the fact that the function tends to 0 in this specific case, I tested with the boundaries at [-3pi/4, 5pi/4] too, with similar results:

gradient-bug-2

I'll see if I can do some troubleshooting, but I'm putting this up here to indicate that we at least know about the problem.

@tomasaschan
Copy link
Contributor Author

Turns out this was a classic PEBKAC; in xs, the end point shouldn't be included (i.e. it works fine for xs = -pi:2pi/20:pi-2pi/20).

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

No branches or pull requests

1 participant