Derivative Matrix for a Function Vector

From Class Wiki
Jump to navigation Jump to search

Author

John Hawkins

Problem

The following problem statement is that proposed by Prof. Frohne on the main class page:

  1. Explore how a linear operator, like for example ddt can be represented as some kind of a matrix multiply (with perhaps an infinite number of dimensions).

Solution

The solution presented here is limited to presenting a matrix representation of the operator d/dx.

First, let us consider the finite case. Let x be the independent variable with n components and let the components of x be defined such that xm+1=xm+Δx for all m<n and for some constant Δx. Also let y=f(x). We wish to find the slope of the function at y(xm) for any m. To do this for the finite case, we will approximate the slope at a point y(xm) as being the slope of the line between the two points y(xm1) and y(xm+1) given that 1<m<n. For the case when m=1 or m=n, we approximate dy/dx as the slope the lines between y(x1) and y(xn) respectively. These approximations are accomplished by the following matrix:

ddx=12(Δx)[220010100101101001010022]

Note that we need to divide by 1/2(Δx) because the distance between xm1 and xm+1 is 2Δx. Similarly, the nonzero entries in the first and last rows are 2 to cancel out the 2 in the denominator. Using this matrix, we find that

(ddx)y=12(Δx)[220010100101101001010022][y(x1)y(x2)y(x3)y(xn2)y(xn1)y(xn)]=[[y(x2)y(x1)]/Δx[y(x3)y(x1)]/2(Δx)[y(x4)y(x2)]/2(Δx)[y(xn1)y(xn3)]/2(Δx)[y(xn)y(xn2)]/2(Δx)[y(xn)y(xn1)]/Δx]

which corresponds with the slopes we wished to obtain.

Solution Picture

The figure below was created to demonstrate how the above matrix works. First, 10 points of the function are displayed. Then for each point the line between the two adjacent points is drawn and the slope of that line is shown to be dy/dx for the original point, calculated using the matrix shown above. After this has been done in the case of 10 points, the function and derivative vectors are shown for 15, 20, 30, 50, 100, 200, and 500 points. One can easily imagine the limiting case. The code used to develop this image can be found here.


Reviewed By

Read By

Comments