example of solving the heat equation

Let a .  Determine the temperature function  (x,y)u(x,y)  on the plate, when the faces of the plate are .

The equation of the heat flow (http://planetmath.org/HeatEquation) in this case is

2uuxx′′+uyy′′= 0 (1)

under the boundary conditionsMathworldPlanetmath

u(0,y)=0,u(π,y)=0,u(x,π)=C,uy(x, 0)=0.

We first try to separate the variables, i.e. seek the solution of (1) of the form


Then we get


and thus (1) gets the form

X′′Y+XY′′= 0 (2)

and the boundary conditions

X(0)=X(π)= 0,X(x)=CY(π),Y(0)= 0.

We separate the variables in (2):


This equation is not possible unless both sides are equal to a same negative -k2, which implies for  X′′=-k2X  the solution


and for  Y′′=k2Y  the solution


The two first boundary conditions give  0=X(0)=C1,  0=X(π)=0+C2sinkπ,  and since  C20,  we must have  sinkπ=0,  i.e.

0<k:=n= 1, 2, 3,



The fourth boundary condition now yields that  0=Y(0)=nD2;  thus  D2=0  and  Y(y):=D1coshny.  So (1) has infinitely many solutions

un:=C2D1sinnxcoshny=Ansinnxcoshny (3)

with  n+  and they all satisfy the boundary conditions except the third.  Because of the linearity of (1), also the sum


of the functions (3) satisfy (1) and those boundary conditions, provided that this series converges.  The third boundary condition requires that


on the interval0xπ.  But this is the Fourier sine seriesMathworldPlanetmath of the constant function  xC  on the half-interval  [0,π],  whence


The even (http://planetmath.org/EvenNumber) n’s here give 0 and the odd (http://planetmath.org/EvenNumber) give

A2m+1:=4C(2m+1)πcosh(2m+1)π(m=0, 1, 2,)

Thus we obtain the solution


It can be shown that this series converges in the whole of the plate.

Visualization of the solution

Figure 1: Surface plot of the solution u(x,y), for C=1
Figure 2: Color-coded plot of the temperature u(x,y)

Remark.  The function u has been approximated in the plot by computing a partial sum of the true infinite-series solution.  However, there is substantial numerical error in the approximate solution near  y=π,  evident in the small oscillations observed in the surface plot, that should not be there in .  This phenomenon is actually inevitable given that the boundary conditions are actually discontinuousMathworldPlanetmath at the corners  (0,π)  and  (π,π).

More precisely, observe that when  y=π,  the for  u(x,y)  reduces to the Fourier series


for the discontinuous function on  [-π,π]:


That means the Fourier will necessarily be subject to the Gibbs phenomenon.  Of course, the series also cannot converge absolutely; in other of the series decay too slowly in magnitude, adversely affecting the numerical solution.

  • http://gold-saucer.afraid.org/math/planetmath/ExampleOfSolvingTheHeatEquation/heat.pyPython program to compute  u(x,y)  and produce the two figures

Title example of solving the heat equation
Canonical name ExampleOfSolvingTheHeatEquation
Date of creation 2014-09-28 17:02:21
Last modified on 2014-09-28 17:02:21
Owner pahio (2872)
Last modified by pahio (2872)
Numerical id 25
Author pahio (2872)
Entry type Example
Classification msc 35Q99
Synonym stationary example of heat equation
Related topic LaplacesEquation
Related topic BlackScholesPDE
Related topic AnalyticSolutionOfBlackScholesPDE
Related topic SolvingTheWaveEquationByDBernoulli
Related topic TimeDependentExampleOfHeatEquation
Related topic ExampleOfSummationByParts