I was wondering what really happens when taking the inverse discrete FFT on some set of numbers, for 3 times? Because looking at it, it looks like we're getting an output that is identically with the input, and I don't get why.
Also I was trying to implement my own inverse discrete Fourier transform in python, following wikipedia, looking at the IFFT provided by octave:

and at the plot provided by my code:

It just doesn't make any sense. Here is my code:
#!/usr/bin/python
import matplotlib.pyplot as plt
import numpy as np
import math
points = [24+0j, -18.39230+0.73205j, 8-3.46410j,
-2+4j, 0+0j, 2.39230-2.73205j, -4+0j, 2.39230+2.73205j, 0-0j,
-2-4j, 8+3.46410j, -18.39230-0.73205j]
def inverse_fourier_transform(points):
inversed_points = []
N = len(points)
for k in range(0, N):
s = 0.0
for n in range(0, N - 1):
s += points[n]*np.exp(1.j*2.0*np.pi*k*n/N)/N
inversed_points.append(s)
return inversed_points
inv_points = inverse_fourier_transform(points)
inv_points2 = inverse_fourier_transform(inv_points)
inv_points3 = inverse_fourier_transform(inv_points2)
x = []
y = []
for pt in inv_points3:
x.append(pt.real)
y.append(pt.imag)
plt.scatter(x, y, s=0.5)
plt.plot(x, y)
plt.show()
kbe in(0,N-1)? – Matt L. Dec 22 '19 at 13:37kandn, but it's actually worse – C. Cristi Dec 22 '19 at 17:44kshould go from0toN-1, not toN. – Matt L. Dec 22 '19 at 18:18