It's Cold
August 20, 2013, 11:39 am
Apparently there is snow falling in the Australian alps which doesn't improve how I feel about how goddamn cold it suddenly got. Obviously, I need some code to heat up my laptop.
# some code to heat up my freaking lap
from cmath import exp, pi
import random
# thanks http://rosettacode.org/wiki/Fast_Fourier_transform for the FFT code
def fft(x):
N = len(x)
if N <= 1: return x
even = fft(x[0::2])
odd = fft(x[1::2])
return [even[k] + exp(-2j*pi*k/N)*odd[k] for k in xrange(N/2)] + \
[even[k] - exp(-2j*pi*k/N)*odd[k] for k in xrange(N/2)]
while (True):
print fft([random.random (),
random.random (),
random.random (),
random.random (),
random.random (),
random.random (),
random.random (),
random.random ()])
Permalink - Tags: Development