Recipe 10.4. Calculating the Second Moment of an Area
You've learned how to compute area and center of area using numerical integration as discussed in the previous recipe and now you want to learn how to compute the second moment of the area.
Use the same technique as discussed in the previous recipe for computing the first moment of the area, but this time use the product of x 2 and y instead of x and y .
You can easily extend the example shown in Figure 10-2 from the previous recipe to include computing the second moment of the area. In mechanics, the second moment of an area is called the moment of inertia and is computed according to the following formula:
This yields the moment of inertia about the y -axis. The formula for computing the second moment about the x -axis is very similar; the x s and y s are just swapped.
Often, you're more interested in the moment of inertia about an axis that
Here, I na is the moment of inertia of the area about an axis parallel to the y -axis, but passing through the centroid of the area. A is the area, and d is the distance from the y -axis to the axis passing through the centroid.
Figure 10-2 includes the results of these
Application of the parallel axis theorem yields the moment of inertia about an axis that passes through the center of the area. Cell C24 computes this value using the formula
. In this case, the
Read Recipe 10.3 for more information on applying Simpson's rule to calculate areas and centers of areas.
Recipe 10.5. Dealing with Double Integrals
You need to
Separate the problem into two
Computing multiple integrals numerically can be challenging,
Figure 10-3. 3D surface
Let's assume you want to compute the volume under that surface bounded by y = [0,1] and x = [0,1]. This is a three-dimensional problem, but instead of computing a multiple integral, you can compute a series of single integrals.
The first step is to consider cross-sections of this surface at successive y -values. Each cross-section, at each y -value, will yield a curve. We can compute the area under each of these curves using a standard integration rule. You'll end up with a new set of data that represents cross-sectional areas as a function of y . You can then integrate the resulting curve of areas to get the volume under the surface.
Figure 10-4 shows the data that represents the surface in Figure 10-3.
The table contains z -values for corresponding x - and y -values. As outlined a moment ago, the first task is to compute cross-sectional areas corresponding to cross-sections
Figure 10-4. Data for 3D surface
taken of the surface at each y -value. This means that for each y -value, held constant, we can integrate along the x -axis to compute the area under the cross-section curve.
The row labeled
on row 16 of the spreadsheet shows the results of integrating the cross-section curves for each
-value. I applied the trapezoidal rule here, using formulas like
If you plot the resulting cross-sectional areas versus the y -values, you end up with a curve like that shown in Figure 10-5.
This plot was generated using the
-data in the cell range D4:N4 and the area data in the cell range D16:N16. The area under this curve is the volume under the surface. So now all you need to do is integrate this cross-sectional area curve to get the volume.
That's all there is to it. This technique is
Figure 10-5. Cross-sectional area curve