Curve Fitting to Approximate Volumes



Objective:  The purpose of this demo is to illustrate to students that techniques used to compute the volume of solids of revolution can be applied to real objects.  The demo employs digital photography and various curve-fitting techniques to approximate functions that, when revolved about an axis, yield a solid that approximates the object.  Here, the technique is applied to an ordinary light bulb and ideas for extensions to other areas are suggested. 

Level:  This demo is appropriate for calculus courses where volumes of solids of revolution are discussed.  It can be presented in courses, such as linear algebra and numerical analysis, where an emphasis on the curve-fitting aspect of the demo are appropriate.  Additionally, it can be extended to use in courses where numerical quadrature techniques are discussed.

Prerequisites:  Students need to know how to compute the volume of a solid of revolution using the disk method.  The demo involves the equation of a circle with radius r and center (h,k) and the solution of system of two equations in two variables.  Students can be reminded of these topics just-in-time. 

Curve-fitting techniques are employed, however in this presentation, details of those computations are not emphasized.  A utility such as TI Interactive!, graphing calculators, or software is used for "black-box" computations.  In a course where curve-fitting techniques are emphasized, students would need to know details of the computations involved in the curve fitting.

Platform:  The demo is presented using a digital photo, Geometer's Sketchpad 4.0, and TI- Interactive! which is used for the basic curve fitting.  An alternative to the TI-Interactive! software is the family of TI graphing calculators (such as TI-83 or TI-89). An animation of the surface of revolution was generated in Mathematica

The demo can be performed by importing the photo into MATLAB and using cubic splines to fit the curve. A sample M-file is provided to illustrate the photo manipulation, spline fitting and surface generation. 

An in-class presentation of this demo will require

  • a digital photo of a light bulb
  • a means for copying the photo
  • Geometer's Sketchpad 4.0 (GSP 4.0 is required for this demo.  Earlier versions do not have a feature for plotting functions.)
  • TI Interactive! or a graphing calculator that can fit a quadratic to a list of data points

Step-by-step instructions are provided.

The demo can be performed by importing the photo into MATLAB and using cubic splines to fit the curve.  A sample M-file is provided to illustrate the photo manipulation, spline fitting and surface generation.  The MATLAB presentation requires MATLAB 5.0 or 6.0.

Instructor's Notes:  One of the most important ideas that students need to learn in calculus is that calculus is not only a study of change but is also used to develop useful approximation tools.  As students learn about techniques for computing volumes of solids of revolution, it is not immediately obvious why approximation techniques can be useful.

It is easy to imagine that an ordinary light bulb can be modeled by a solid generated by revolving a curve about a horizontal axis.  To demonstrate this requires several steps.

Figure 1.  Light bulb modeled as a solid of revolution

The demo involves several steps:

Step 1:  IMPORT a digital photo of a light bulb into Geometer's Sketchpad (or MATLAB) so that it is symmetric along the horizontal axis.

Step 2:  DIGITIZE points along the edge of the bulb in the photo.

Step 3:  FIT a piecewise curve to the data points.

Step 4:  COMPUTE the volume by applying the disk method.

Because you will be switching between software packages, you might find it useful to have a student record information as you progress through the steps.  If calculators are used, you might ask students to participate in entering the data and performing the curve fitting.

Step 1:  Copy the photo onto your computer's clipboard.  If you do not have one, you may copy the picture below.  For the purpose of getting appropriate units, it is helpful to include a ruler alongside the bulb in the photo.

Step 2:  Paste the photo into a Geometer's Sketchpad document.  If you use your own photo, you may need to resize it--do so with care to maintain the appropriate aspect ratio.  If you use the photo above, do not resize it within Geometer's Sketchpad.

Under the Graph menu, select Show Grid.  Drag the unit point, the point at (1,0), so that it determines a unit length of approximately one inch (use the ruler).  Position the bulb so that the outline is symmetric to the x-axis.

Figure 2.

Step 3:  A reasonable and simple approach is to model the outline of the bulb using a piecewise curve consisting of a parabola and circle. 

Fitting a parabola:  Use the point tool to select points along the "quadratic" part of the bulb.  After each point is selected, use the Measure menu to show the coordinates of the points.

Figure 3.


Open TI-Interactive! Use the list editor to input the coordinates of the points.

Figure 4.

Use the Stat Calculation Tool in TI-Interactive! to obtain a quadratic regression (quadratic least squares approximation) to the data points.

Back in Geometer's Sketchpad, use the Graph->New Function menu to define the quadratic function that fits the data.

Plot the function.

Figure 5.

Fitting the circle:

Next model the bulbous end of the light bulb using a circle.  Ask students if they remember the equation of a circle centered at (h,k) with radius r (if no one remembers, give a quick reminder).  The equation is

Since the center of the desired circle is on the x-axis, the y-coordinate of the center is 0.  Using this fact, the equation can be simplified to the form

There are two unknowns:  h and r.  We need to select two points on the outline of the bulb so that we can determine the unknown values. To make the equations to solve easier, select one of these points to be on the x-axis.

Figure 6.

Based on the selected points, we need to solve

This system of equations is easy to solve using substitution (any appropriate method can be used).  In this example, the center of the circle is approximately (2.49130,0) and the radius is approximately 1.4387. After solving the system of equations it is a good idea to look at the picture to make sure that the values obtained are reasonable.

The function we need to plot in Geometer's Sketchpad is 

The circle and parabola are shown together in Figure 7.

Figure 7.

Intersection points:  

Before we can find the volume, we need to find the points of intersection of the parabola and circle. 

It appears that there are two points of intersection and the one we desire is nearest the point labeled F.  We use TI-Interactive! to estimate the coordinates of the point we desire.

Figure 8.

The piecewise function that models our light bulb is 

Step 4:  To calculate the volume, we use the disk method.  The approximate volume is 

The integral can be approximated using TI-Interactive!

The volume is approximately 14.38332 cubic inches or 235.7 cubic centimeters.  It makes sense to talk about whether this is a reasonable estimate.  Since one cubic inch holds approximately 0.5541 fluid ounce, we can approximate the amount of water the light bulb would hold by computing

Our bulb will hold slightly less than a cup of liquid.

It is useful to discuss sources of errors and discrepancies between volumes calculated in repeated trials.

An Alternate Approach using MATLAB

A careful look at the plot of the graph of our bulb function shows that the pieces of the curve do not quite match "smoothly" at the intersection point.

Figure 9.

The parabolic portion meets the circular portion with a slightly steeper slope.  Thus the pieces match (that is, the function is continuous), but the derivatives are not the same at the point of intersection.  For the purpose of our approximation, this difference in slope is hardly noticeable so we would not expect it to be very serious.  It is possible, however, to do better using another curve fitting approach called a spline approximation.  

While there are different types of spline approximations, a cubic spline fits data points with cubic polynomials such that the resulting piecewise function is continuous and that the first and second derivatives match at the data points.  Not only do the pieces match, but the slopes and concavity (curvature) agree.  Cubic splines are very popular for fitting data smoothly; in fact, they are used commonly enough so that many computer software systems have built-in cubic spline functions.  

MATLAB has such a built-in spline function.  Figure 10 illustrates a cubic spline fit to data points that have been carefully selected along the outline of the bulb. 

Figure 10.

The solid of revolution, as produced by MATLAB is shown in Figure 11.

Figure 11

The MATLAB spline command returns coefficients of the cubic polynomials that join the points we selected along the outline of the bulb.  If the x-coordinates of the points are x1, x2, ..., xn, the cubic polynomial on the interval [xk,xk+1

for k = 1, 2, ..., n - 1.  The resulting piecewise function is 

The approximate volume is 

For this example the volume approximation is approximately 15.306152 cubic inches, or 8.4811 ounces.  Although there seems to be a large discrepancy between this calculation and the previous example, there are several factors that come into play.  For example, the scaling of the photo placed in the MATLAB grid is slightly different than the scaling in Geometer's Sketchpad.   It is also easier in GSP to position the points closer to the outline of the bulb.  Finally, the placement of the bulb on the grid is not exactly the same.  Given all the possible sources for error, it is a little surprising that the discrepancy is only about half an ounce!  This brings up the important point that approximations may have a margin of error that is unacceptably high due to errors in the data.  

Remarks:  A MATLAB script, as well as the image that was used, may be downloaded from this link.  The file uses the ginput command to select the points along the outline of the bulb. If you use the MATLAB extension to the demo, you should prepare the demo in advance and practice doing a careful selection of the points using the mouse.  The Symbolic Math Toolbox is used to compute the value of the integral.  An animated gif illustrating the M-file can be viewed here.

Additional Comments and Extensions:

This demo illustrates techniques students can use for individual projects involving volumes that can be generated by revolving a piecewise curve about an axis, such as those shown in Figure 12.

Figure 12.

The techniques discussed in this demo can be useful to explore other problems.  What can you do with these images?

Using digital images, the tools described in this demo, and a little imagination, approximating volumes of solids will be fun and meaningful!


Curtis F. Gerald and Patrick O. Wheatley, Applied Numerical Analysis, Fifth Edition, Addison-Wesley, 1994.

Credits:  This demo was submitted by

Judy O'Neal
Mathematics and Computer Science Department
North Georgia College and State University
Dahlonega, GA

and is included in Demos with Positive Impact with her permission.

MATLAB extensions to the demo were developed by Lila Roberts and David Hill.

LFR 4/23/02                                        last updated 5/16/2006  DRH