Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS123 Engineering Computation Lab Lab 3 Bruce Char Department of Computer Science Drexel University Spring 2011.

Similar presentations


Presentation on theme: "CS123 Engineering Computation Lab Lab 3 Bruce Char Department of Computer Science Drexel University Spring 2011."— Presentation transcript:

1 CS123 Engineering Computation Lab Lab 3 Bruce Char Department of Computer Science Drexel University Spring 2011

2 Lab 3 Overview Based on materials from Chapters 19 and 20 –Chapter 19 – Calculus and Optimization Develop an objective function for the minimum surface area of a can and find optimal dimensions (radius and height) using Maple’s Optimization feature –Chapter 20 – more Maple support for mathematical modeling Solving integration problems – finding the surface area of an irregularly shaped object Piecewise expressions – irregularly shaped curve consisting of a series of “piecewise” expressions Curve fitting using Splines – generating spline curves of various degrees to connect a series of data points

3 Lab 3 Overview Lab 3 outline –Part 0 – practice with Maple mechanics for Optimization, piecewise expressions, integration and differentiation, Spline curve fitting –Part 1 – Find the minimum dimensions of a can that holds a specified volume of liquid using Maple’s Optimization function Create an expression for the can’s surface area (objective function) to hold a constant volume of liquid Use the Maple Optimization function to find the minimum dimensions (radius and height) for the surface area –Part 2 – finding the surface area of an irregularly shaped machine part Define top of object in terms of a series of piecewise expressions Bottom = a single expression Plot top, bottom expressions  shape of object Integrate (top – bottom)  area between curves

4 Lab 3 Overview Lab 3 outline –Part 3 – Spline curve fitting to analyze the power of a baseball bat swing Given a table of times (seconds) versus power (hp), create and plot spline curves of degrees 1 through 4 Answer 4 questions using the results of the spline plots –Notes: –B. total energy transferred is the integral of the power curve –C. point of maximum power increase – take derivative of power curve and then find maximum (optimization)

5 Lab 3 Overview New lab description format for Lab 3 –Basic lab description document in form of a shell, directing you to starter scripts for each of 4 parts (Part 0, 1, 2 and 3) –Each starter script consists of text directions for completing that Part –Maple statements and results to be generated at various points within starter scripts Mix of text and math modes

6 Lab 3 Maple Concepts: Discussion and Demo Part 1 – Maple’s Optimization feature –Creating the Objective function (surface area of a can) Surface area = lateral area + top and bottom SA = 2*pi*r*h + 2*pi*rsquared –Since the surface area needs to be a function of a single variable (eg. radius=r), we need to find an function relating h (height) to r and substitute. Since the volume is constant at 1000: 1000 = pi*rsquared*h  h = 1000 / (pi*rsquared) Substitute this equation for h into the SA equation above to obtain the objective function SA(r).

7 Lab 3 Maple Concepts: Discussion and Demo Part 1 – Maple’s Optimization feature - continued –Now use this objective expression SA(r) to find the minimum surface area over a range of radii that holds a volume = 1000 –minRslt:=Optimization[ Minimize](objexpression,r=1..10) You will obtain 2 results minRslt[1]  minimum surface area minRslt[2]  radius that produces this minimum SA –Substitute minRslt[2] into the equation for h to obtain the associated height –Note Optimize[Minimize](objexp,x=a..b) → produces set of approximate results Minimize(objexp,a=a..b, location) → produces set of exact results

8 Lab 3 Maple Concepts: Discussion and Demo Part 2 – Area between 2 curves –Piecewise expressions Use clickable interface as opposed to textual I/F To add more than 2 piecewise expressions –Ctrl-Shift-R (PC) (Command=Shift-R for Mac) –Be sure to highlight each area and type over it –(not as “free-form” as you would like) – see demo –“otherwise” condition – can use to denote all other values not defined in piecewise expressions Be sure to assign the piecewise expression a name → top := “piecewise expression” –Integration Indefinite integral  int(f(x),x)  generates function in terms of x Definite integral  int(f(x),x=a..b)  numeric result –Differentiation → result := diff(somefunction, x);

9 Lab 3 Maple Concepts: Discussion and Demo Problem 3 – analysis of batter’s swing Plot_structure:=CurveFitting[Spline](x values, y values, name for independent variable, degree=degree of Spline fit) Or, can use with(CurveFitting); Spline( ); –Ex. CurveFitting[Spline](T,p,t,degree=3) Will produce a Spline curve fit using cubic piecewise expressions –Some Spline details Curve passes through all points (note that linear least squares curve fit produces a “best straight line estimate” for all points, and may possibly not pass through any point) A piecewise expression will be generated to connect each pair of adjacent points

10 Lab 3 – Maple Part0 Exercises 1. Maple optimization logistics 2. Piecewise expression and integration 3. More on integration and differentiation 4. Curve fitting with Splines

11 Quiz Week (7) Activities Quiz 1 will be released on Friday (5/6) at 6 PM –Deadline: Wednesday (5/11) at 4:30 PM –Makeup quiz – from Thursday (5/12) at 9 AM through Sunday (5/15) at 11:00 PM 30% penalty Pre-lab 3 quizlet –From Thursday (5/12 – noon) through Monday (5/16 – 8 AM) Be sure to visit the CLC for quiz or general Maple assistance


Download ppt "CS123 Engineering Computation Lab Lab 3 Bruce Char Department of Computer Science Drexel University Spring 2011."

Similar presentations


Ads by Google