Skip to content

Add optional extrapolation methods #433

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

Conversation

simulutions
Copy link
Contributor

@simulutions simulutions commented May 26, 2025

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

Before, invert_integral inherits the extrapolation method from the interpolation it got in its construction.
If we did a piecewise linear interpolation with constant extrapolation, the inverted integral would not integrate beyond the input data. With this change, we can set the extrapolation method of invert_integral independent of the interpolation.

@ChrisRackauckas
Copy link
Member

Needs tests that this actually does what is expected.

SouthEndMusic
SouthEndMusic previously approved these changes May 26, 2025
Copy link
Member

@SouthEndMusic SouthEndMusic left a comment

Choose a reason for hiding this comment

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

Looking good! I added some small comments. Since there is no issue for this, it would be nice if you motivate these changes in the PR description.

Comment on lines 112 to 113
function invert_integral(A::ConstantInterpolation{<:AbstractVector{<:Number}},
extrapolation_left::ExtrapolationType.T = A.extrapolation_left,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
function invert_integral(A::ConstantInterpolation{<:AbstractVector{<:Number}},
extrapolation_left::ExtrapolationType.T = A.extrapolation_left,
function invert_integral(
A::ConstantInterpolation{<:AbstractVector{<:Number}};
extrapolation_left::ExtrapolationType.T = A.extrapolation_left,

Copy link
Member

@SouthEndMusic SouthEndMusic left a comment

Choose a reason for hiding this comment

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

Nice

@SouthEndMusic SouthEndMusic merged commit 38d1817 into SciML:master May 27, 2025
16 checks passed
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.

3 participants