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

Add integrate() method to Function class #199

Open
israelmcmc opened this issue Mar 10, 2023 · 0 comments
Open

Add integrate() method to Function class #199

israelmcmc opened this issue Mar 10, 2023 · 0 comments
Assignees

Comments

@israelmcmc
Copy link

In various applications --e.g. convolving a detector response with a spectrum-- it would be desirable for functions to return the analytical integral within a range when possible. Even when analytics integration is not possible, numerical integration is a common task and it would be nice to provide it instead of everyone writing their own code.

Some initial thoughts on how to implement this:

  1. Add an integrate() method to the Function class that, by default, passes args, kwargs, and the Function.evaluate to scipy.integrate
  2. For functions with an analytic integral, override this method with the exact calculation
  3. For functions using scipy.integrate might be problematic in the context of composite functions --e.g. discontinuous functions-- throw a warning. Maybe a flag is needed to specify this?
@grburgess grburgess self-assigned this Mar 17, 2023
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

No branches or pull requests

2 participants