Numerical integration in Log space
O3
I'm working on a numerical integration problem where the function I'm integrating spans several orders of magnitude. To handle this, I'm considering performing the integration in logarithmic space.
Could anyone advise on the best methods or algorithms for numerical integration in log space?
What is the problem with using this: integrate/METH=1 x2_g1 /D=ix2_g1 /X=X2_u
November 6, 2024 at 05:47 pm - Permalink
Thank you for your response.
Sorry for the lack of my explanation.
I'm trying to calculate the area between the wave and zero.
When I use
AreaXY
function, the problem is that it picks up errors on the long-time side.Do you have any good solutions?
November 7, 2024 at 01:48 am - Permalink
The area at any time is the value of the integral wave. Any integration method will follow the steps on the curve, including the steps that are considered as "errors" (noise). The two ways often taken to go around this problem are as follows: a) calculate an average final value over a range of the integral curve to average out the noise or b) smooth the source curve before integrating it.
November 7, 2024 at 08:20 am - Permalink
There are two issues to consider here:
1. The x-range: Here I would recommend splitting the range to say N intervals and then sum the N contributions. This may be done for you in some of the adaptive algorithms (see Integrate1D) that will subdivide the domain until the integral converges. Counting on the adaptive algorithm is not the most efficient method. Ideally, you should be able to determine proper intervals and apply Integrate1D in each one.
2. The noise at the high end: here, regardless of integration method, it would be best to replace the original data with an acceptable smooth (and continuous) version thereof. If you are using Integrate1D you can write a user function that returns the value of the integrand and handles the "smooth and continuous" requirement.
AG
November 8, 2024 at 01:59 pm - Permalink