Matlab code from the Dhushara blog translated into Mathematica – Fourier transform

I have written this code just to remember it. DO NOT run it! It eats up all of your computers memory.

Mathematica 8

scale = 10^6;
start = 1;
fin = 50;
its = 490;
xres = 600;
y = N[Accumulate[Table[MangoldtLambda[i], {i, 1, scale}]], 10];
x = scale;
a = 1;
myspan = 800;
xres = 4000;
xx = N[Range[a, myspan, (myspan - a)/(xres - 1)]];
stpval = 10^4;
F = Range[1, xres]*0;

For[t = 1, t <= xres, t++,
For[yy = 0, yy <= Log[x], 1/stpval++,
F[[t]] =
F[[t]] +
Sin[t*myspan/xres*yy]*(y[[Floor[Exp[yy]]]] - Exp[yy])/Exp[yy/2];
]
]
F = F/Log[x];
ListLinePlot[F]

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.