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

Use adaptive_grid on endpoints #68

Merged
merged 11 commits into from
Oct 8, 2019

Conversation

BeastyBlacksmith
Copy link
Member

@BeastyBlacksmith BeastyBlacksmith commented Sep 27, 2019

I have ported the test-functions mentioned in JuliaPlots/Plots.jl#621 (comment) and as far as I can see there is no visual difference between including the endpoints or not. But my pitchfork example shows that plotting different functions which start or end at the same point are definitely better off by including the endpoints.

This addresses #63, though the concerns of respecting log-scale and y-limits are still valid.

Failures on nightly seem unrelated to me.

@mkborregaard
Copy link
Member

I think the main issue is that you'll often want to pass 0 as an endpoint to see asymptotic behaviour of a function not defined at 0 - such as log or sqrt. Any suggestion for how to deal with that?

@BeastyBlacksmith
Copy link
Member Author

BeastyBlacksmith commented Sep 27, 2019

that is already handled by the algorithm somehow, at least it doesn't error for me. It seems when plotting the NaNs are just skipped and the first interior point is used then. However, adjusting the ylimits might not give what you want. E.g.: plot(log,0,10, ylimits = (-100,2)) still has the first interior point at y ~= -6 for me. But that is a different issue.
And sqrt is well defined at 0.

@BeastyBlacksmith
Copy link
Member Author

I could fix #48 in this PR as well, if wanted.

@mkborregaard
Copy link
Member

That'd be great, just remember that it will be breaking on Plots and other packages that use adapted_grid (which I think is only Plots), so we'd need to up dependencies and push new minor versions.
Let me know when it's otherwise ready for review.

@BeastyBlacksmith
Copy link
Member Author

BeastyBlacksmith commented Sep 28, 2019

should we also add a Project.toml?

So I will prepare a PR for Plots as well.

@mkborregaard
Copy link
Member

Yes please :-)

@mkborregaard
Copy link
Member

@goretkin does this fully address your concerns in #63 ?

@goretkin
Copy link

I don't think it does quite yet. I think you want to be able to refine the first and last intervals as well:

# Skip first and last interval
for interval in 2:n_intervals-1
p = 2 * interval
if n_tot_refinements[interval] >= max_recursions

@BeastyBlacksmith
Copy link
Member Author

@mkborregaard This is ready for review. You need also my Plots-branch from JuliaPlots/Plots.jl#2204 to use the Plots interface.
@goretkin can you check, if this works for your function? Maybe add that to the list of functions in the test-directory.

Copy link
Member

@mkborregaard mkborregaard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have anything to add - impressed by the test suite, which seems to cover all the right corners.

@mkborregaard mkborregaard merged commit 53bc5c6 into JuliaPlots:master Oct 8, 2019
@mkborregaard mkborregaard mentioned this pull request Oct 8, 2019
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

Successfully merging this pull request may close these issues.

4 participants