Computing the Fourier Transform We find the expansion coefficients, A(q ) , by computing the Fourier transform of the wave packet in x-space. The Fourier transform is defined in terms of continuous variables x and q. To implement this in MATLAB® we need to approximate +∞ A(q) = F (Ψ ( x)) = ∫ e − iqxΨ ( x)dx −∞ by use of the discrete equation F (Ψ ( x)) ≈ ∑ e−iqxΨ ( x)δ x { x} To do this, we create a vector with all of our x values, i.e.: ⎛ x1 ⎞ ⎜ ⎟ ⎜ x2 ⎟ x = ⎜ x3 ⎟ ⎜ ⎟ ⎜ ⎟ ⎜x ⎟ ⎝ n⎠ Similarly, we define a vector with all the values of Ψ ( x ) : ⎛Ψ ( x1 ) ⎞ ⎜ ⎟ ⎜Ψ ( x2 ) ⎟ Ψ ( x) = ⎜Ψ ( x3 ) ⎟ ⎜ ⎟ ⎜ ⎟ ⎜Ψ ( x ) ⎟ n ⎠ ⎝ We then define a vector for our reciprocal space: ⎛ q1 ⎞ ⎜ ⎟ ⎜ q2 ⎟ q = ⎜ q3 ⎟ ⎜ ⎟ ⎜ ⎟ ⎜q ⎟ ⎝ n⎠ The values for q are determined by the properties of the discrete Fourier transform. Note, in general, x and q do not contain the same number of elements, i.e. m ≠ n . Now, the outer product of x and q is ⎛ x1q1 ⎜ xq T x⋅q = ⎜ 2 1 ⎜ ⎜ ⎝ xn q1 x1q2 … x1qm ⎞ ⎟ x2 q2 … x2 qm ⎟ ⎟ ⎟ xn q2 xn qm ⎠ Taking the exponential of i times each element of the above matrix yields: φq ( x ) = e ix ⋅qT ⎛ eix1q1 ⎜ ix2 q1 e =⎜ ⎜ ⎜⎜ ixn q1 ⎝e eix1q2 eix2 q2 eixn q2 eix1qm ⎞ ⎟ eix2 qm ⎟ ⎟ ⎟ eixn qm ⎟⎠ Note, the MATLAB® command `` exp'' takes the exponent of each element in a matrix. Then, A(q ) = ∑ φq ( x)Ψ ( x)δ x { x} = φ q† ( x) ⋅Ψ ( x)δ x ⎛ eix1q1 ⎜ ix2 q1 e =⎜ ⎜ ⎜⎜ ixn q1 ⎝e ⎛ e −iq1x1 ⎜ −iq2 x1 e =⎜ ⎜ ⎜⎜ − iqm x1 ⎝e eix1q2 eix2 q2 eixn q2 e −iq1x2 e −iq2 x2 e − iqm x2 † ⎛Ψ ( x1 ) ⎞ eix1qm ⎞ ⎜ Ψ ( x2 ) ⎟⎟ ix2 qm ⎟ ⎜ e ⎟ ⋅ ⎜Ψ ( x ) ⎟ δ x 3 ⎟ ⎜ ⎟ ⎟ ⎜ ⎟ eixn qm ⎟⎠ ⎜ ⎟ ⎝Ψ ( xn ) ⎠ ⎛Ψ ( x1 ) ⎞ e − iq1xn ⎞ ⎜ Ψ ( x2 ) ⎟⎟ − iq2 xn ⎟ ⎜ e ⎟ ⋅ ⎜Ψ ( x ) ⎟ δ x 3 ⎟ ⎜ ⎟ ⎟ ⎜ ⎟ e − iqm xn ⎟⎠ ⎜ ⎟ ⎝Ψ ( xn ) ⎠ ⎛ Ψ ( x1 )e −iq1x1 +Ψ ( x2 )e− iq1x2 + ⎜ Ψ ( x1 )e− iq2 x1 +Ψ ( x2 )e− iq2 x2 + ⎜ = ⎜ ⎜⎜ − iqm x1 +Ψ ( x2 )e − iqm x2 + ⎝Ψ ( x1 )e +Ψ ( xn )e− iq1 xn ⎞ ⎟ +Ψ ( xn )e− iq2 xn ⎟ δx ⎟ ⎟ +Ψ ( xn )e− iqm xn ⎟⎠ i.e. a vector indexed by q which contains the sum we defined to be an approximation to the Fourier transform, known as the Discrete Fourier Transform (DFT).