Is there any way how to speed up this double summation?
(*Define Function*)
a = -0.07;
b = -0.45;
c = 2.;
d = 3.;
tau = 2.;
dt=10.^-2;
e = c*tau;
ft[t1_] = a*Exp[-t1/d] - b*Exp[-t1/e];
g[t1_, t2_, t3_] = ft[t1]*ft[t2]*ft[t3];
factor[x_, y_] := factor[x, y] = g[0., x*dt, y*dt]
sumfactor[h_, g_] := Sum[factor[x, y], {x, 0, h}, {y, 0, g}]
Module[{k = 3000}, sumfactor[k, k]]
For arguments like 3000 in the function sumfactor
this is pretty slow unfortunately.
tau2
have a value? What aboutdt
? $\endgroup$factor[x,y] == factor[y,x]
, so you need only iterate fory > x
. $\endgroup$