# Improving efficency in generating Tables with large numbers of values

I'm simulating some transient data for fast Fourier transform -- on the order of 20 million points. Understandably MM takes a while to do this.

Are the any techniques in table generation optimisation when dealing with such large numbers? Or is this just a computational limit I have to accept?

This is my current attempt:

MyFunction[VMax_, Tau_, t_] := VMax Sin[2 Pi t] Exp[-t/Tau];
TransientData = Table[MyFunction[t],{t,0,60,3*10^-6}]
• @HenrikSchumacher I'll add the function to make the question more complete. I wasn't sure how relevant the function would be. Commented Feb 13, 2019 at 14:17
• Ping me when you are ready. Commented Feb 13, 2019 at 14:17
• @HenrikSchumacher Ping. Typical values for VMax = 1E-7, Tau = 400. Commented Feb 13, 2019 at 14:20

VMax = 1. 10^-7;
Tau = 400.;
MyFunction[VMax_, Tau_, t_] := VMax Sin[2 Pi t] Exp[-t/Tau];

You exforce that a great part of the compuations is performed in exact arithmetic which is just slow. Since the function MyFunction is built from elementary and vectorized functions, we may exploit that by applying it to the list instead of looping over it with Table. Here is a timing example; notice the introduction of decimal dots at critical positions:

n = 200000;
TransientData = Table[MyFunction[VMax, Tau, t], {t, 0, 60, 60/(n - 1)}]; //
AbsoluteTiming // First
TransientData1 = MyFunction[VMax, Tau, Subdivide[0., 60., n - 1]]; //
AbsoluteTiming // First

Max[Abs[TransientData - TransientData1]]

1.84223

0.004158

4.06758*10^-14

• +1 There should be a space in the definition of VMax, i.e., VMax=1. 10^-7 or use VMax=10.^-7 Commented Feb 13, 2019 at 15:30
• Good point @Bob. Thank you. Commented Feb 13, 2019 at 16:06