Skip to main content
1 of 2
KennyColnago
  • 15.3k
  • 27
  • 63

I managed to double the speed by simply moving some multiplications and divisions...

AbsoluteTiming[
  or2 = -2./Omegar^2.;
  oz2 = 2./Omegaz^2.;
  p = p^2.;
  Io*Table[
           Exp[(p[[i, t, 1]] + p[[i, t, 2]])*or2 - p[[i, t, 3]]*oz2],
           {t, 1, Deltat + 1}, {i, n}];
]
KennyColnago
  • 15.3k
  • 27
  • 63