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:
Add an integrate() method to the Function class that, by default, passes args, kwargs, and the Function.evaluate to scipy.integrate
For functions with an analytic integral, override this method with the exact calculation
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?
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: