FFT of a mirrored array

according to the definition of the Fourier transformation we have for a real function:

1. if $F{{(a(t))}}$ = $A(f)$
2. then $F{{(-a(-t))}}$ = $-A$*$(f)$, with * for conjugate

import numpy as np
a= np.array([1, 2, 3,4,5,6,7,8,9,10])
a_mirrored = np.array(list(-a[::-1]))

A_f = np.fft.fft(a)
A_f_star = -np.conjugate(np.fft.fft(am))


So why is A_f different from A_f_star ? Can anyone tell please?

• Are you sure you're plotting the exact right thing? I'm severely missing the symmetry of A_f here... – Marcus Müller Apr 18 '17 at 17:17
• I am plotting the real part of both, there is no symmetry there. It is strange, that the first element is correct, so equal, but for others it is negated. It should be equal over all. – Tassou Apr 18 '17 at 17:19
• I don't know Python. Is there a padding involved? What happens with a power of two length? (1:16) – Laurent Duval Apr 18 '17 at 17:23
• The magnitude will be the same but the phase not. Time reversal isn't done properly (see answer) – Hilmar Apr 18 '17 at 17:45

This is occurring because you have not time-reversed the signal properly. The time reversal intended by your identity is for $X[n] = X[(N-n)_N]$ where the notation $(\cdot)_N$ means that you should take the result modulo $N$. In other words $X[0] = X[(N)_N] = X[0]$ doesn't change position.

For your example, you start with the finite-length signal $a = [1, 2, 3, 4, ... 9, 10]$. The true time reversal of $a$ is $a_r = [ 1, 10, 9, 8, ... 3, 2 ]$. But the python code results in simply reversing the order of the components without respect to their indices, thus the result is the signal $a_m = [ 10, 9, 8, 7, ... 2, 1 ]$.

The reason the first entry is the same in both cases is because it is simply the sum of the elements which is equal for all three signals $a$, $a_r$ and $a_m$.

Here is a function that will time reverse your signal.

def time_reverse(x):
xrev = [ x[0] ]
xrev.extend(x[-1:0:-1])
return xrev


So, you can add this function definition to the top of the file and replace the line

a_mirrored = np.array(list(-a[::-1]))


with the line

a_mirrored = -np.array(time_reverse(a))


Then your plots should match up fine.