Application of spectral methods to numerically solving differential equations

133 Views Asked by At

Consider a simple differential equation such as $$ iU_t +U_{xx} = 0 $$ To solve using a spectral method I would do a Fourier transform and obtain $$ i\hat{U_t} - k^2 \hat{U} = 0 $$ Where the hat refers to transformed quantities, and $k$ is from the spatial Fourier transform. To apply the numerical solving, I would take time steps $\Delta t$ along the time axis and write $$ \hat{U}^{n+1} = \hat{U^n} - ik^2 \Delta t \hat{U^n} $$ and here the superscript denotes the time step, so $U$ at the next time step is now written as a function of the previous time step. Iterating over this gives an approximation to the solution on the desired time interval. Then I can take the inverse transform and it is done.

My question is how to apply such a theory. I can have an initial condition vector, at $t=0$, call it $U_0$. It needs to give a value to each point on the mesh along the $x$ interval in which I am interested. Then all things on the RHS are known, and the transforms are the fast Fourier transforms, done discretely. I never used the discrete transform before, it looks like this: $$ X_k = \sum_{n=0}^{N-1} x_n e^{-i2\pi kn /N} $$ (from wikipedia).

So all the vectors are now indexed by $k$, but that seems strange, putting this into the numerical equation will mean each vector element is multiplied by its index? So in my equation I should have an element-wise multiplication of a vector $\textbf{k}_i = i^2$ with the vector $\hat{U}$