In [ ]:
x=[]
from math import sin
In [ ]:
for i in range(16):
x.append(sin(2*3.414*i))
In [ ]:
print field(x)
In [ ]:
ftx=fft(field(x))
In [ ]:
print ftx
[ 2.82478962+0.j 6.31709005-1.81185633j -3.40388355+1.55183369j -1.29011038+0.63553672j -0.85828316+0.38008808j -0.69344394+0.24260023j -0.61694776+0.14712145j -0.58138305+0.06992016j -0.57086604+0.j -0.58138305-0.06992016j -0.61694776-0.14712145j -0.69344394-0.24260023j -0.85828316-0.38008808j -1.29011038-0.63553672j -3.40388355-1.55183369j 6.31709005+1.81185633j]
In [ ]:
reals=extract(ftx,0)
imag=extract(ftx,1)
In [ ]:
print reals, imag
In [ ]:
power=pow(reals,2)+pow(imag,2)
In [ ]:
print power
In [ ]:
iftx=ifft(ftx)
In [ ]:
print iftx
[ -5.55111512e-17 +2.77555756e-17j 5.18259620e-01 -5.55111512e-17j 8.86455450e-01 -3.41803576e-17j 9.97975166e-01 -2.08166817e-17j 8.20527864e-01 +0.00000000e+00j 4.05494000e-01 -5.55111512e-17j -1.26951996e-01 +3.41803576e-17j -6.22638621e-01 -3.46944695e-17j -9.38038169e-01 +2.77555756e-17j -9.81825656e-01 +5.55111512e-17j -7.41322270e-01 -3.41803576e-17j -2.86166564e-01 -2.08166817e-17j 2.51849620e-01 -5.55111512e-17j 7.16941911e-01 +5.55111512e-17j 9.74441296e-01 +3.41803576e-17j 9.49787973e-01 +7.63278329e-17j]