Skip to content

Integration over a subdomain of a Tabulated1D - #42

Merged
paulromano merged 3 commits into
paulromano:mainfrom
HunterBelanger:feature/tabulated_integration
Sep 3, 2026
Merged

paulromano merged 3 commits into
paulromano:mainfrom
HunterBelanger:feature/tabulated_integration

Conversation

@HunterBelanger

Copy link
Copy Markdown
Contributor

These changes add the functionality to perform a definite integral over a sub-range of a Tabulated1D function. As part of this work, I also added some static method to replace the old interpolation/integration logic, so that they could be more easily reused in different use cases.

There was already a Tabulated1D.integral method, but it returned a tabulation of the cumulative integral at all points, but this does not allow one to reconstruct the true curvature of the integral between tabulated points according to the interpolation rule. This new method facilitates this more easily.

@paulromano paulromano left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks @HunterBelanger and sorry for the delay! I made a few updates:

  • Corrected the linear-log antiderivative by including the missing interval-width factor in the constant term
  • Reworked log-linear integration to handle constant segments without producing NaN and using expm1 for numerical stability.
  • Added the logarithmic limiting form for log-log interpolation when the exponent is -1, avoiding division by zero.
  • Fixed clipped integration ranges that lie entirely outside the tabulated domain so they return zero instead of integrating backward.

@paulromano
paulromano merged commit 37611d8 into paulromano:main Sep 3, 2026
5 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.

2 participants