Question: Problem with for loop

Dear all,

I am using Maple to perform numerical integrations. When the final index in the loop is set to 5, the computation is fast and the results are quickly delivered. When I set a number higher than that, even 6, the program gets really slow and often crashes.

I herewith attach the script I use to generate the results. I guess that there should be a problem of memory management and I tried to use gc() as suggested in some forms but without success. I would appreciate it if someone here could explain the reason behind the problem.

Thank you,
question.mw

restart; Ts := 1.; sigma := 1.; C := 1.; B := 2./(1+C); with(inttrans); beta := B*Ts*omega; assume(Tb > 0); assume(u >= 0); FzzS := -(3/2)*u^3*((2*u+I*beta)*(exp(2*sigma*u)+sigma^2*exp(2*u))-4*sigma*u*((1+sigma)*u-1))/((2*u+I*beta)^2*exp((2*(1+sigma))*u)-4*u^2*((1+sigma)*u-1)^2); InvFzzS := simplify(invfourier(FzzS, omega, t)); logTimeMin := -2; logTimeMax := -1; NumSteps := 6; logTimeStep := evalf(1.0*(logTimeMax-logTimeMin)/NumSteps); curdirectory(); A := matrix(NumSteps, 2); T1 := Array(1 .. NumSteps); AF := Array(1 .. NumSteps); for i to NumSteps do logTime := evalf(i*logTimeStep+logTimeMin); curTime := evalf(10^logTime); A[i, 1] := curTime; A[i, 2] := evalf(Int(eval(InvFzzS, t = curTime), u = 0 .. infinity, epsilon = 10^(-5))); T1[i] := A[i, 1]; AF[i] := A[i, 2] end do

 

 

``

 

Download question.mw

Please Wait...