## Solving the Heat and Wave Equations with the (Fast) Discrete Fourier Transform

Alkiviadis G. Akritas*, Jerry Uhl**, and Panos S. Vigklas*
*Department of Computer and Communication Engineering
University of Thessaly
GR-38221, Volos, Greece
**Department of Mathematics
University of Illinois at Urbana-Champaign
Urbana, IL 61801, USA

Abstract. In this paper we present a very readable derivation of the heat (and wave) equations. This is achieved by first using the Fast Fourier Transform (FFT) to implement, in Mathematica, the Fast Fourier Fit (FFF) - a procedure that helps us approximate periodic functions with sines and cosines. The FFF program described in this paper is easy to follow and we demonstrate its use with an example.

The heat equation problem can be stated as follows: Start with a heated wire L units long with the temperature allowed to vary from position to position on the wire. The function startertemp(x) gives the temperature at the point x, for 0 <= x <= L, of the wire at the start of the experiment. Without loss of generality, we take startertemp(0) = startertemp(L) = 0. (That way we can easily obtain a pure sine approximation.) Think of the wire as the interval 0 <= x <= L. At the start of the experiment, we instantly cool the ends at x = 0 and x = L and maintain these ends at temperature 0; we also take pains to guarantee that the rest of the wire is perfectly insulated. The problem is to find a formula for temp(x, t), so that we can tell the temperature at a given point x, at time t after the start of the experiment.

With the FFF program in place, we can easily obtain the formula for the solution temp(x, t) of the heat equation problem as follows: a. Adjust the function startertemp(x) (that is, make startertemp(x) an odd function) and using the fast Fourier fit obtain a sines only approximation of it, for a given accuracy n. Given the original assumptions startertemp(0) = startertemp(L) = 0, this step is easily done. b. Pick off the coefficients A(k) of the sin(k Pi x/L) terms of the sines only approximation of the adjusted startertemp(x), and c. Write down the formula for temp(x, t) as:

temp(x, t) = Sum[A(k) e^{-(k Pi/L)^2 t} sin(k Pi x/L), {k,1,n}]

We conclude with a detailed explanation and an example.