4/25/05
1
Program Development Example
4/25/05
2
Functions: Shapes of Animals
• Consider heat loss in animals.
• Heat content proportional to volume.
• Heat loss rate proportional to area.
• Time to lose heat proportional to
volume/area.
• Example, fluid leak:
Tank holds 10 liters and leaks at rate of 2
liters/hour. Time till empty is 10/2 = 5 hours.
4/25/05
3
Physicist Analysis
• Question: What shape minimizes heat loss?
• Simplify:
Real animal shapes complicated.
Consider a box shape with sides a, b, c.
V = a b c
A = 2
(ab + bc + ac)
• For given V, what shape has largest V/A
ratio, i.e. takes longest time to lose heat?
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document4/25/05
4
The Physicist's Animal
4/25/05
5
Equation for V/A
a = V/(b*c)
V/A = V / (2*(V/c + b*c + V/b))
• Thus we have for constant V, two variables.
• We can make a table of V/A values with
rows for b and columns for c.
4/25/05
6
The Programming Problem
• Make a function to calculate V/A for given
V, b, c.
• Make a table showing V/A values for a
range of b and c.
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '08
 Staff
 Thermodynamics, C Programming, Ratio, Row

Click to edit the document details