All published worksheets from http://sagenb.org
Image: ubuntu2004
Solving the Heat Equation
Portland State University
1. Introduction
For a metal rod of unit length, placed (for mathematical convenience) on the real interval , let denote the temperature of the rod at the cross-section units from the origin at time (we assume the temperature to be constant on each cross-section of the rod. Then the function is known to obey the Heat Equation: , where is a positive constant that is a property of the material used to form the rod.
Suppose, for simplicity, that , and we have these initial-boundary conditions:
(1) the ends of the rod are held at constant temperature zero for all time: for all , and
(2) the initial temperature of the rest of the rod is 1, i.e., on .
Then the solution to our our initial-boundary problem, consisting of the heat equation , along with boundary condition (1) and initial condition (2), is given by the series below:
To see that this series really does solve our initial-boundary problem for the heat equation, note that formal term-by-term differentiation (justified by the exponential decay of the time-dependent terms) shows that satisfies the heat equation, while the substitution and show that (1) is satisfied. As for (2): the series for is the Fourier sine series for the function over the interval . See [1, Sec. 1.8.3-1.8.4, pp. 63--70], [2, Sec. 18.10, especially pp. 999--1004], or [3] for more details, and to learn how to discover this formula for .
2. Plotting the solution
We'll define here a function that returns the sum of the first terms of the series (*), and another one, that plots this sum as a function of , using the time as a parameter.
SAGE commands featured here:
Here is the sum of the first five terms of the series (*)
For the infinite series (*) is the Fourier sine series of the function identically 1 on the interval . We superimpose the graph of this function (in red) on a plot of the sum of the first 25 terms of that sine series.
Now we define a function that maps the -th partial sum of (*) to a graphics object having as parameter (i.e., ). The command tests what we've done.
Next we plot, for t=.01, .5, 1,2,and 3, the 25th partial sum of series for . Compare the plot for with the one above for , noting how effectively the exponential "multiplier" smooths out the partial sum.
3. Visualizing the solution with
4. Animating the solution via @interact
Here's an animation inspired by a Maple program written by Paul Bourdon. We represent the rod by 100 large dots on the -axis, and the temperature of (the center of) each dot by a color, ranging from red (hot) to white(cold). The distribution of colors at time t represents . The animation shows the temperature at each point cooling from the initial temperature 1 toward zero as .
The first step is to define the function that colors the 100 consecutive points on the -axis according to the value .
References
[1] H. Dym and H.P. McKean, Fourier Series and Integrals, Academic Press 1972.
[2] A. Jeffrey, Advanced Engineering Mathematics, Harcourt/Academic Press 2002.
[3] Weisstein, Eric W. Heat Conduction Equation. From MathWorld--A Wolfram Web Resource.
<a href="http://mathworld.wolfram.com/HeatConductionEquation.html" target="_blank"
http://mathworld.wolfram.com/HeatConductionEquation.html