# Question:Increasing numerical integration time. How to avoid it?

## Question:Increasing numerical integration time. How to avoid it?

The context.

I have to numerically integrate a complicated function over a wide x domain: int( f(x), x=0..2e8). Because of the characteristic of the function, to get accurate results, I must separate thi x domain in about 5000 sub-intervals. With a do loop doing 5000 iterations I apply the 'int" commant 5000 times and I add the results. In fact, in the do loop I use this specific command:

evalf(Int(fct(k0), k0 = j*interv .. (j+1)*interv, method = _Gquad, 'epsilon' = 1e-3))

The value of interv is 30000 and j goes from 0 to about 5327 by 1.

The problem.

At the beginning of the computation (for small values of j) the time needed to Maple to perform one loop is about 3.5 seconds. The problem is that loop after loop, this time always increase from 3.5 seconds up to 600 or 800 or even 1000 seconds. It then becomes prohibitive. (I have many of these computations to perform. It is a heavy computation that would need about 6 hours at 3.5 seconds per cycle. I let my computer work overnight. But at 800 seconds per cycle it would need weeks).

Sometimes, without any visible reasons, this time decreases back to 5 or 6 seconds per cycle and re-increases again. One can think that it depends on the local characteristics of the function, but if I stop the computation at any point (particularly when the time per cycle is large), re-insert the results already obtained at this point and restart the computations at this point, the time per cycle goes back to about 3.5 seconds and slowly increases again. It is like garbage accumulates somewhere and slows down Maple. When I stop Maple and restart it "flushes" this garbage.

I tried.

I have searched the net, MaplePrimes, Maple help… to solve it. I tried the command gc() even if it is not recommanded with no results. I use a MacBookPro i7 quad core 3.3 GHz with 16 Gig of RAM.

These computations use at most 1 or 2 Gig. When I do the command kernelopts(datalimit) I get infinity as the result. Then I presume that Maple have access to the full 16Gig of RAM (minus what is needed bye the system). (The same problem appears on different machines, Windows or Mac).

My question is very simple. What causes this problem and how can I solve it?

(Yes I could switch to a pure numerical computations software (C, fortran, MatLab…) but for some reasons I have to do that with Maple.) I have been a Maple user for about 30 years and never had that kind of problem.

Thank you very much.

Normand Beaudoin, Dept. of physics &astronomy. University of Moncton.

﻿