# Rewriting partial differential equation

I have some trouble rewriting a partial differential equation, more specifically the heat equation in one dimension:

$\frac{\partial u}{\partial t} = \frac{\partial^2 u}{\partial x^2} + f(x,t)\\$

with $x \in [0,1]$ and $t\geq0$.

The boundary conditions:

$u(x,0) = v(x), \space x \in [0,1], \\ u(0,t) = l(t), \space t>0, \\ u(1,t) = r(t), \space t>0.$

The spatial derivative can be replaced by its central difference approximation, and the forward difference approximation is used to replace the time derivative. Denoting the approximation of $u(x_i,t^k)$ as $u_i^k$ and introducing shorthand notation $f^k_i = f(x_i,t^k)$, the following is obtained:

$\frac{u_i^{k+1}-u_i^k}{\Delta t} = \frac{u^k_{i+1}-2u_i^k+u^k_{i-1}}{\Delta x^2} + f_i^k$

which holds at all internal grid points. This can be rewritten such that the numerical values $u_i^{k+1}$ at time $t^{k+1}$ can be computed independently from the other values at $t^{k+1}$:

$u_i^{k+1} = u^k_i + \frac{\Delta t}{\Delta x^2}(u^k_{i+1}-2u^k_i+u^k_{i-1}) + \Delta t f^k_i. (Eq. 6.3)$

The numerical solution at the boundaries of the finite difference grid can be defined as: $u^0_i = v(x_i)$

where $i = 1,2,...,M$ for the inital condition, and likewise for the boundary conditions:

$u^k_0 = l(t^k), \\ u^k_{M+1} = r(t^k),\\$

where $k = 1,2,...,K$.

To gain insight into the stability properties of the scheme invoked by above equation we can resort to an analysis that is based upon the Fourier series representation of the solution, which for this case with periodic boundary conditions and $f=0$ is given by:

$u^k_i=e^{iK x_i-i\omega t^k}, (Eq. 6.4)$

My question now is the following: I don't understand how the author goes from equation (6.3) to (6.4). He mentions the use of the complex Fourier series of $f(t)$ as

$F(t) = \Sigma^{+\infty}_{n=-\infty}a_ne^{i\omega_nt},$

but I don't know how he applied it here.

• Be very careful with the two different $i$s.
– Dirk
Commented Oct 14, 2014 at 20:19
• As in i for columns vs i imaginary number? I hope it doesn't confuse too much. Commented Oct 14, 2014 at 20:24
• I think there's some confusion here because there are two different k's in equation 6.4. I would write it $u^k_i=e^{iKx_i-i\omega t^k}, (Eq. 6.4)$ then derive K from the pde. This leads to a solution which is a superposition of damped waves travelling in opposite directions. Commented Oct 14, 2014 at 20:42
• Yes, exactly, I'll add some details to the question. Commented Oct 14, 2014 at 20:46

Plug equation 6.4 into the pde with $f=0$ and determine which values of $K$ satisfy it (hint: they're complex). Add these solutions (damped waves travelling in opposite directions) in amounts which match the periodic boundary conditions at $x=0$ and $x=1$. Then apply the same principle to the discretised version of the pde and compare the two solutions to assess the accuracy of the numerical solution.

• I tried this, but I think I already have trouble when plugging in the equation. Commented Oct 14, 2014 at 21:04
• Drop the $i$ subscript and the $k$ superscript for simplicity. You should then find $-i\omega u = - K^2u$, and therefore $-i\omega = - K^2$, $K = \pm \sqrt{iw}$. Commented Oct 14, 2014 at 21:12
• Perhaps a stupid question, but I was wondering how the author came up with the initial idea to write $u^k_i = e ^{iKx_i-i\omega t^k}$? Commented Oct 14, 2014 at 22:57
• A good question actually. Of course it wasn't the author who had this bright idea (solutions like this were first obtained by Joseph Fourier in the 1820's) but if you set the time dependence by looking for periodic solutions the $x$-dependence becomes an ordinary differential equation to which $e^{iKx}$ (for particular values of $K$) is the solution. If instead you look for exponentially decaying solutions the $x$-dependence becomes periodic and you get an eigenfunction representation (in this case a Fourier series in $x$). Commented Oct 15, 2014 at 7:47