Derivatives and differences

Okay, so we have a second-order partial differential equation:

How can we deal with this sort of equation?

One way to deal with it is to create a spatial grid of temperature; in other words, an array of temperature values.



     index    i       1      2      3      4      5      6

 position    x(i)    3.1    3.2    3.3    3.4    3.5    3.5

 Temperature T(i)    128    131    135    139    144    150


We can compute a numerical difference which is approximately equal to the derivative of temperature with respect to position; in fact, we can do it in two ways:

Your job: fill in the table below.



     index    i       1      2      3      4      5      6

 position    x(i)    3.1    3.2    3.3    3.4    3.5    3.5

 Temperature T(i)    128    131    135    139    144    150

 first difference       ____   ____   ____   ____   ____  

Now, Laplace's equation involves a second derivative with respect to position, so we have to do this a second time. This time, you can approximate the second derivative at position xi by using the surrounding first differences to compute a centered second difference:

Your job: fill in the table below.



     index    i       1      2      3      4      5      6

 position    x(i)    3.1    3.2    3.3    3.4    3.5    3.5

 Temperature T(i)    128    131    135    139    144    150

 first difference       ____   ____   ____   ____   ____  

second difference          _____  _____  _____  _____      

So, if you need to compute the second derivative of temperature with respect to position, and you have arrays of temperature and position, you can get an approximate value by using differences. The finer your arrays are, the more nearly your differences will approach the true derivatives.


Watch out for the boundaries

Go back to our example of temperatures and positions.



     index    i       1      2      3      4      5      6

 position    x(i)    3.1    3.2    3.3    3.4    3.5    3.5

 Temperature T(i)    128    131    135    139    144    150

 first difference       ____   ____   ____   ____   ____  

You can compute a first difference at the location corresponding to x = 3.15, between elements i = 1 and i = 2. But what about the value of the difference to the left of the first measured temperature, at x = 3.05 m?

Ooops.

It turns out that the difference at this location is undefined -- and, likewise, the first derivative is also undefined. Note that the number of first differences we could compute is smaller than the number of temperature values were are given: an array of 6 temperature measurements yields only 5 first differences. That's a general result: if you have N measurements, you can compute at most N-1 first differences.



  Q:  If you have N = 6 temperatures and positions,
      how many second differences can you compute?


In situations like this, one needs to pay special attention to the boundary conditions. One common type of boundary condition provides a constant value (here, constant temperature) at the edges of the space.


                  BOUNDARY                                         BOUNDARY
                    FIXED                                            FIXED
     index    i              1      2      3      4      5      6

 position    x(i)           3.1    3.2    3.3    3.4    3.5    3.5

 Temperature T(i)    125    128    131    135    139    144    150    160

A large class of common phyical situations can be broken down into the solution of a set of differential equations, subject to a set of boundary conditions.