Interpolating Functions to Approximate Volumes

This notebook utilizes digital photos and the method of cross sections to approximate the volume of a wine bottle. A digital photograph is read and the "edges" of the bottle are approximated using a cubic interpolating function. The cross sections are constructed and displayed in an animation. The volume is computed using an integral involving the interpolating functions.

Read in graphics packages and turn off spelling checks.

In[203]:=

Import the digital photo. This demo does not account for forshortening so it is useful to include in a photo some article such as a ruler that would give a sense of scale. In this example, the photo is in JPEG format with a resolution of 72 pixels/inch. This will be used in the calculations. NOTE: If you use your own photograph or if you download the image, you will need to change the path before executing.

In[210]:=

Out[210]=

In[211]:=

Out[211]=

Select points along the top edge of the bottle in the photograph. Click on the picture and while holding the Control Key, click the edge while moving from left to right (if you look carefully you will see white pixels corresponding to the selected points). After selecting the points, choose Edit->Copy to copy the coordinates on the clipboard. Then paste into the notebook input cell for the variable "toppoints".

In[212]:=

Compute interpolating function and find maximum and minimum domain and range values. These values will be used later when constructing graphs.

In[213]:=

In[214]:=

Select points along the bottom edge of the photograph using the same approach as for the top points. Copy and paste into the input for variable "bottompoints."

In[220]:=

Compute interpolating function and find maximum and minimum domain and range values. These values will be used later when constructing graphs.

In[221]:=

In[222]:=

Compute upper and lower bounds for the graphs.

In[228]:=

Set PlotRange for the 3D plots. The parameter addabit may be adjusted to control the space around the graphics.

In[230]:=

In[231]:=

Show the interpolating function that fits the points.

In[232]:=

Out[232]=

In[233]:=

Out[233]=

Set up the partition.

In[234]:=

In[238]:=

Find the centers of the cross sections. Compute the radius function by computing 1/2 (top(x) - bottom(x)).

In[239]:=

Generate the cross sectional slices.

In[241]:=

Out[241]=

In[242]:=

Out[242]=

In[243]:=

The cross section (perpendicular to the base of the bottle) is generated by filled rectangles.

In[244]:=

In[248]:=

Out[248]=

Show the partition and the region.

In[249]:=

Out[249]=

Generate a 3-dimensional model of the bottle.

In[250]:=

Out[250]=

Generate the cross sections. The frames can be animated.

In[251]:=

The following codes set up frames to animate the selection of the points along the edges of the bottle. They are not necessary for the demo but might be useful in the event you wish to use a different photo.

In[252]:=

In[253]:=

This Mathematica notebook was developed for Demos with Positive Impact (NSF DUE -9952306) by

Lila F. Roberts (lila.roberts@gcsu.edu)

Georgia College & State University

Special thanks to James P. Braselton at Georgia Southern University for his Mathematica advice and assistance.

Created by Mathematica (December 31, 2003)