Skip to article frontmatterSkip to article content

Tensor-product discretizations

As you learned when starting double integration in vector calculus, the simplest extension of an interval to two dimensions is a rectangle. We will use a particular notation for rectangles.

The idea of the tensor product is that each variable independently varies over a fixed set. When the interval is the same in each dimension, we may write [a,b]2[a,b]^2.

The discretization of a two-dimensional tensor-product domain is straightforward.

Figure 13.1.1 shows a tensor-product grid on a rectangle. The grid is constructed from discretizations of xx with m=3m=3 and yy with n=5n=5. Each grid point (xi,yj)(x_i, y_j) lies at the intersection of a vertical line through xix_i and a horizontal line through yjy_j.

Tensor-product grid

Figure 13.1.1:A tensor-product grid (dark gray) on a rectangle constructed from discretizations of xx with m=3m=3 (blue) and yy with n=5n=5 (red).

13.1.1Functions on grids

The double indexing of the grid set (13.1.3) implies an irresistible connection to matrices. Corresponding to any function f(x,y)f(x,y) defined on the rectangle is an (m+1)×(n+1)(m+1)\times(n+1) matrix F\mathbf{F} defined by collecting the values of ff at the points in the grid. This transformation of a function to a matrix is so important that we give it a formal name

13.1.2Parameterized surfaces

We are not limited to rectangles by tensor products. Many regions and surfaces may be parameterized by means of x(u,v)x(u,v), y(u,v)y(u,v), and z(u,v)z(u,v), where uu and vv lie in a rectangle. Such “logically rectangular” surfaces include the unit disk,

{x=ucosv,y=usinv,0u<1,0v2π,\left\{ \begin{aligned} x &= u \cos v, \\ y &= u \sin v,\\ \end{aligned} \right. \qquad \qquad \left. \begin{aligned} 0 & \le u < 1, \\ 0 &\le v \le 2\pi, \end{aligned} \right.

and the unit sphere,

{x=cosusinv,y=sinusinv,z=cosv,0u<2π,0vπ.\left\{ \begin{aligned} x &= \cos u \sin v,\\ y &= \sin u \sin v,\\ z &= \cos v, \end{aligned} \right. \qquad \qquad \left. \begin{aligned} 0 & \le u < 2\pi, \\ 0 &\le v \le \pi. \end{aligned} \right.

13.1.3Partial derivatives

In order to solve boundary-value problems in one dimension by collocation, we replaced an unknown function u(x)u(x) by a vector of its values at selected nodes and discretized the derivatives in the equation using differentiation matrices. We use the same ideas in the 2D case: we represent a function by its values on a grid, and multiplication by differentiation matrices to construct discrete analogs of the partial derivatives ux\frac{\partial u}{\partial x} and uy\frac{\partial u}{\partial y}.

Consider first ux\frac{\partial u}{\partial x}. In the definition of this partial derivative, the independent variable yy is held constant. Note that yy is constant within each column of U=mtx(u)\mathbf{U} = \mtx(u). Thus, we may regard a single column uj\mathbf{u}_j as a discretized function of xx and, as usual, left-multiply by a differentiation matrix Dx\mathbf{D}_x such as (10.3.6). We need to do this for each column of U\mathbf{U} by Dx\mathbf{D}_x, which is accomplished by DxU\mathbf{D}_x \mathbf{U}. Altogether,

mtx(ux)Dxmtx(u). \mtx\left( \frac{\partial u}{\partial x} \right) \approx \mathbf{D}_x \, \mtx(u).

This relation is not an equality, because the left-hand side is a discretization of the exact partial derivative, while the right-hand side is a finite-difference approximation. Yet it is a natural analog for partial differentiation when we are given not u(x,y)u(x,y) but only the grid value matrix U.\mathbf{U}.

Now we tackle uy\frac{\partial u}{\partial y}. Here the inactive coordinate xx is held fixed within each row of U\mathbf{U}. However, if we transpose U\mathbf{U}, then the roles of rows and columns are swapped, and now yy varies independently down each column. This is analogous to the situation for the xx-derivative, so we left-multiply by a finite-difference matrix Dy\mathbf{D}_y, and then transpose the entire result to restore the roles of xx and yy in the grid. Fortunately, linear algebra allows us to express the sequence transpose–left-multiply–transpose more compactly:

mtx(uy)(DyUT)T=mtx(u)DyT.\mtx\left( \frac{\partial u}{\partial y} \right) \approx \Bigl(\mathbf{D}_y \mathbf{U}^T\Bigr)^T = \mtx(u)\, \mathbf{D}_y^T.

Keep in mind that the differentiation matrix Dx\mathbf{D}_x is based on the discretization x0,,xmx_0,\ldots,x_m, and as such it must be (m+1)×(m+1)(m+1)\times (m+1). On the other hand, Dy\mathbf{D}_y is based on y0,,yny_0,\ldots,y_n and is (n+1)×(n+1)(n+1)\times (n+1). This is exactly what is needed dimensionally to make the products in (13.1.7) and (13.1.8) consistent. More subtly, if the differentiation is based on equispaced grids in each variable, the value of hh in a formula such as (5.4.8) will be different for Dx\mathbf{D}_x and Dy\mathbf{D}_y.

13.1.4Exercises