The One-Dimensional Heat Equation


Physical and Mathematical Background

Consider a long thin rod which we divide into N cells. Let u[i] denote the temperature of the i-th cell. Thus, if N = 5 and if i runs from 0 to 4, we could have a temperature distribution like this:
  index i:   0  1   2   3   4
  temp u[i]: 0  0   0   0   1
This represents a temperature distribution where the right-most cell is "hot," at temperature 1 and the other cells are "cold," at temperature 0.

What is the temperatue u at future times, given that (a) the temperatures are held fixed at the ends of the rod and (b) the rest of the rod is well insulated? To answer this question we make use of the following physical principle:

The rate of change of the temperature at a given point is proportional to the difference between the average temperature near the point and the temperature at the point.
Let us see how this applies to our model, in which we have divided the rod into finitely many cells each of which has a unique temperature. This is, of course an approximation, since the temperature in a cell will in fact vary. However, if the cell is small, the approximation will be a good one. Now, assuming that u[i] is the temperature of the i-th cell at time t, let uu[i] denote the temperature of the i-th cell at time t + h, where h is small. Then our principle reads
   uu[i] = u[i] + k( u[i-1] + u[i+1] )/2 - u[i] )
   for i = 1..N-2
Here k is the constant of proportionality. Note that when k = 1, this is particularly simple:
   uu[i] = ( u[i-1] + u[i+1] )/2
   for i = 1..N-2

It is not difficult to write a program which computes and displays the future temperatures of a thin, insulated rod given a temperature distribution at time t = 0. Here is an outline for it:

PSEUDOPROGRAM:

Constants: N, the number of cells
           T, the number of time steps

Variables: u, an array which holds the current temperature distribution
           uu, an array which holds the "next" temperature distribution

Program:

  Set up the array u;
  Print it out;

  For t from 1 to T:
    Compute uu from u
    Print out uu
    Copy uu into u


Problems

  1. Let k = 1. Find uu from u using the initial data (0 0 0 0 1) given above. Do this by hand.
  2. Write a program based which computes and displays the future temperatures at times t = 1..N given an initial temperature distribution. Use the pseudoprogram given above as an outline, and use u = (0 0 0 0 1) as the initial data. First try T = 1 and use the results of the previous exercise to check the proper functioning of your program.
  3. Once your program is running, try N = 10 and u = (0 0 0 0 0 0 0 0 0 1) as initial data. What is the temperature distribution at t = 5 and t = 10? Give the result (a) as a table, (b) as a graph of temperature versus position.
  4. Discuss the limiting behavior of the temperature distribution: what is it for t very, very large, and what is its limit as T goes to infinity?

Back to syllabus
Back to Department of Mathematics, University of Utah
Last modified: Feb 21, 1995
Copyright © 1995 Department of Mathematics, University of Utah