W14-FuncExample

W14-FuncExample - Program Development Example 4/25/05 1...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
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?
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4/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.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/28/2009 for the course CS 151 taught by Professor Staff during the Spring '08 term at Oregon State.

Page1 / 7

W14-FuncExample - Program Development Example 4/25/05 1...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online