- #1
daviddoria
- 97
- 0
I want to integrate a function in c++ - so I dug out some numerical integration functions. However, they do not produce the correct results when the limits are infinite.
Simply using 1e6 or something instead of infinity seems like a very "hack" solution... and I also don't know the function ahead of time so I wouldn't know if 1e3 is good enough? or do I need 1e8, etc.
Of course you can find the analytic integral and just evaluate it, but not if the function doesn't have an analytic integral!
What do people usually do to numerically evaluate infinite integrals?
Thanks!
Dave
Simply using 1e6 or something instead of infinity seems like a very "hack" solution... and I also don't know the function ahead of time so I wouldn't know if 1e3 is good enough? or do I need 1e8, etc.
Of course you can find the analytic integral and just evaluate it, but not if the function doesn't have an analytic integral!
What do people usually do to numerically evaluate infinite integrals?
Thanks!
Dave