## Thursday, April 17, 2008

### DiffEq

I have, to date, successfully avoided taking any differential equations classes. When I think about them, 'ugly' jumps to mind. Sure, I enjoyed Euler's method when we learned it (in high school, unless I'm totally mis-remembering something). And sure, differential equations seem to be what drive the real world. But the real world is also fairly ugly (unclean might be a better word), so it seems to work out.

Anyway, the point is, I learned a little something the other day about differential equations that I liked, and thought I'd share.

So, suppose you have a rectangle in the plane, with edges parallel to the coordinate axes (we might as well put the lower-left corner on the origin), with integer width, w, and height, h. Suppose you have a fixed value for each edge of the rectangle, representing temperatures along those edges, and would like to model the temperature of interior points of the rectangle. For simplicity, suppose you want to approximate the temperature at integer coordinates in the interior of the rectangle. Let Ti,j denote the temperature at coordinate (i,j). We already know this value along the boundary of the rectangle (i=0,w or j=0,h), and would like the (w-1)(h-1) interior points.

To get our approximation for the values, we think about relationships among them we might like to assume. An easy and reasonable thing to assume (to get our approximation, anyway) is that the temperature at point (i,j) is the average of the four neighboring points (one up, down, left, or right). In equations:

4*Ti,j=Ti-1,j+Ti,j-1+Ti+1,j+Ti,j+1

This gives us (w-1)(h-1) linear equations in the same number of variables, and so we expect a unique solution. In fact, if you think about it in terms of matrices, the coefficient matrix has no more than 5 nonzero entries in any row (less than 5 if the point is one away from the boundary).

I don't know for sure, but the notes I was looking at seemed to indicate that this was called the 'finite difference method'. You may also notice a complete lack of derivatives, and thus differential equations. I'm sure they are there somewhere, but I also expect I like it just as well with them hidden.