13
1 Enhancing Problem Problem Solving in Excel and MATLAB with Polymath 6.1* Michael B. Cutlip a , Mordechai Shacham b and Michael Elly c a Dept. Chem. Eng., University of Connecticut, Storrs, CT, USA b Dept. Chem. Eng., Ben-Gurion University, Beer-Sheva, Israel c Intel Corp., Qiryat Gat, Israel *Paper 206g, presented at the 2006 AIChE Annual Meeting, San Francisco, November 12-17, 2006 Outline Assessing the computing needs in undergraduate and graduate ChE education* Selecting a set of software packages to fulfill the computing needs Demonstration of the advantages and disadvantages of the various software packages by solving a benchmark problem. Combining the various software packages for more effective and efficient problem solving Conclusions *See also Edgar, T. F., “Enhancing the Undergraduate Computing Experience”, Chem. Eng. Edu., 40 (3), 231(2006)

Enhancing Problem Problem Solving in Excel and MATLAB … · Enhancing Problem Problem Solving in Excel and ... chemical, biochemical and other engineering ... POLYMATH and MATLAB

  • Upload
    buianh

  • View
    244

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Enhancing Problem Problem Solving in Excel and MATLAB … · Enhancing Problem Problem Solving in Excel and ... chemical, biochemical and other engineering ... POLYMATH and MATLAB

1

Enhancing Problem Problem Solving in Excel and

MATLAB with Polymath 6.1*

Michael B. Cutlipa, Mordechai Shachamb and Michael Ellyc

aDept. Chem. Eng., University of Connecticut, Storrs, CT, USA

bDept. Chem. Eng., Ben-Gurion University, Beer-Sheva, Israel

cIntel Corp., Qiryat Gat, Israel

*Paper 206g, presented at the 2006 AIChE Annual Meeting, San Francisco,

November 12-17, 2006

Outline

�Assessing the computing needs in undergraduate and graduate

ChE education*

�Selecting a set of software packages to fulfill the computing

needs

�Demonstration of the advantages and disadvantages of the

various software packages by solving a benchmark problem.

�Combining the various software packages for more effective

and efficient problem solving

�Conclusions

*See also Edgar, T. F., “Enhancing the Undergraduate Computing

Experience”, Chem. Eng. Edu., 40 (3), 231(2006)

Page 2: Enhancing Problem Problem Solving in Excel and MATLAB … · Enhancing Problem Problem Solving in Excel and ... chemical, biochemical and other engineering ... POLYMATH and MATLAB

2

Assessing the computing needs in undergraduate and

graduate ChE education

Ten Representative Problems from the ChE curriculum were

prepared for the ASEE Chemical Engineering Summer School

held in Snowbird, Utah on August 13, 1997.

The ten problems were solved using six software packages:

Excel - Edward M. Rosen

Maple - Ross Taylor

Mathematica - H. Eric Nuttall

Mathcad - John J. Hwalek, University of Maine

MATLAB - Joseph Brule, John Widmann, Tae Han, and Bruce

Finlayson

POLYMATH - Michael B. Cutlip, and Mordechai Shacham

Assessing the computing needs in undergraduate

and graduate ChE education

�The ASEE summer school presentations identified advantages

and disadvantages of the various software packages and lead to the

conclusion (see: Comput. Appl. Eng. Educ. 6: 169-180, 1998) that

there is a need to use a set of several packages in ChE education.

�One possible set of packages with a CACHE* connection:

- POLYMATH* – Serves as a general, easy to use, user friendly

Problem Solving Environment (PSE)

- Excel – Serves as a spreadsheet based PSE (the PSE most widely

used by practicing engineers)

- MATLAB – Serves as a programming language and symbolic

manipulation tool.

Page 3: Enhancing Problem Problem Solving in Excel and MATLAB … · Enhancing Problem Problem Solving in Excel and ... chemical, biochemical and other engineering ... POLYMATH and MATLAB

3

POLYMATH 6.1 Educational

�A proven computational system (PSE, Problem Solving

Environment) that supports advanced problem solving in

chemical, biochemical and other engineering disciplines.

�Capabilities include Linear Equations, Nonlinear Equations,

Differential Equations, Data Analysis and Regression.

�Low-cost site licenses are provided through the CACHE

Corporation for academic departments. These licenses enable

use in computer labs and distribution of individual copies to all

student, faculty, and staff.

�Individual use educational and professional versions are also

available.

�POLYMATH has a minimal learning curve and provides

extensive error checking during problem entry that leads to great

efficiency in problem solution.

Limitations of the Individual Packages

�In POLYMATH, the easiness of use and user friendliness

dictate a fixed set of capabilities and options. When a particular

problem does not fit into the options provided, repeated manual

rerunning of the problem may be necessary.

�In Excel, the PSE options were added in a late stage of

development. Thus the problem specification (using cell

addresses instead of variable names) is difficult and the

documentation of the problem statement is hard to understand.

�In MATLAB (as in other programming languages), it is the

user’s responsibility to take care of many technical details of the

solution that can be more efficiently done by the computer (like

arranging the equations in the calculation order). The error

messages may not be clear enough for a novice user.

Page 4: Enhancing Problem Problem Solving in Excel and MATLAB … · Enhancing Problem Problem Solving in Excel and ... chemical, biochemical and other engineering ... POLYMATH and MATLAB

4

DYNAMICS OF A HEATED TANK WITH PI

TEMPERATURE CONTROL* (DHT) – An Example

*Problem No. 10 presented in the session of “The Use of Mathematical Software

Packages in ChE” in the ASEE ChE Summer School, Snowbird, Utah, 1997.

DHT Example – POLYMATH MODEL

Page 5: Enhancing Problem Problem Solving in Excel and MATLAB … · Enhancing Problem Problem Solving in Excel and ... chemical, biochemical and other engineering ... POLYMATH and MATLAB

5

DHT Example – POLYMATH SOLUTION

DHT Example – Excel SOLUTION

Note the use of cell addresses

instead of variable names

The worksheet does not provide enough information regarding

the model used. It cannot serve as stand alone documentation

Page 6: Enhancing Problem Problem Solving in Excel and MATLAB … · Enhancing Problem Problem Solving in Excel and ... chemical, biochemical and other engineering ... POLYMATH and MATLAB

6

Visual Basic Program for Fixed Step Size RK

Integration by E. M. Rosen

DHT Example – Visual Basic Model (functions)

Note null function

Page 7: Enhancing Problem Problem Solving in Excel and MATLAB … · Enhancing Problem Problem Solving in Excel and ... chemical, biochemical and other engineering ... POLYMATH and MATLAB

7

DHT Example – Excel Solution

Combining the Packages for Greater

Efficiency in Effective Problem Solving –

POLYMATH and Excel

1. The problem is entered and solved in its basic form

using POLYMATH.

2. POLYMATH 6.1 automatically converts the

problem into a well documented Excel spreadsheet,

ready for solution.

3. The problem can be modified within Excel for

parametric studies (using “two input data tables, for

example)

Page 8: Enhancing Problem Problem Solving in Excel and MATLAB … · Enhancing Problem Problem Solving in Excel and ... chemical, biochemical and other engineering ... POLYMATH and MATLAB

8

DHT Example – Excel Model Generated by POLYMATH

POLYMATH

converts

variable

names to cell

addresses

Model documentation by

variable names, POLYMATH

equations and comments

DHT Example – Integrating by the Unique POLYMATH

ODE solver for Excel

Page 9: Enhancing Problem Problem Solving in Excel and MATLAB … · Enhancing Problem Problem Solving in Excel and ... chemical, biochemical and other engineering ... POLYMATH and MATLAB

9

DHT Example – MATLAB Model (function)

Note the loss of clarity because of the need to define arrays of variables

(instead of using variable names) and the special syntax requirements.

Row(3)=d(Tm)/dt

DHT Example – MATLAB “Main Program”

Note many problem specific components in the “Main Program”

Page 10: Enhancing Problem Problem Solving in Excel and MATLAB … · Enhancing Problem Problem Solving in Excel and ... chemical, biochemical and other engineering ... POLYMATH and MATLAB

10

DHT Example – MATLAB Solution

0 10 20 30 40 50 60 70 80 90 10064

66

68

70

72

74

76

78

80

82Temperatue vs time

time in minutes

Tem

pera

ture

in C

Tank

Outlet T

Measured T

Combining the Packages for Greater

Efficiency in Effective Problem Solving –

POLYMATH and MATLAB

1. The problem is entered and solved in its basic form using

POLYMATH.

2. POLYMATH 6.1 automatically converts the problem into a

MATLAB function and provides a template m file to run

this function.

3. The problem can be modified within MATLAB for

parametric studies, optimization, control etc. (using for and

while statements, for example)

Page 11: Enhancing Problem Problem Solving in Excel and MATLAB … · Enhancing Problem Problem Solving in Excel and ... chemical, biochemical and other engineering ... POLYMATH and MATLAB

11

DHT Example – MATLAB Model (function) Generated

by POLYMATH.

Note consistent use of

variable names and

reordering the equations

DHT Example – MATLAB “Main Program” Available in

the POLYMATH “Help”

Only the initial and

final values are

problem specific

Page 12: Enhancing Problem Problem Solving in Excel and MATLAB … · Enhancing Problem Problem Solving in Excel and ... chemical, biochemical and other engineering ... POLYMATH and MATLAB

12

DHT Example – MATLAB Solution Using the Program

Generated by POLYMATH

0 10 20 30 40 50 60 70 80 90 10064

66

68

70

72

74

76

78

80

82 Plot of dependent variable y1

Independent variable (t)

Dependent

variable

y1

Conclusions

The Excel worksheets and MATLAB functions generated by

POLYMATH are well documented problem models of uniform

structure obtained by minimal effort on behalf of the user.

These models can be easily modified to carry out parametric

studies, optimization, control, etc., automatically. Thus the

advantages of the various programs can be fully utilized while

the required effort is reduced.

The POLYMATH conversion utility provides also considerable

educational benefits by enabling learning of Excel and

MATLAB by modifying existing spreadsheets or programs.

Learning by modification may prevent frustration caused by

repeated failures to obtain a working program when

programming from scratch.

Page 13: Enhancing Problem Problem Solving in Excel and MATLAB … · Enhancing Problem Problem Solving in Excel and ... chemical, biochemical and other engineering ... POLYMATH and MATLAB

13

Inexpensive site licenses for POLYMATH 6.1 are available from the CACHE Corporation

Educational Site License Information

The site license allows an academic department to use

POLYMATH in all computer labs and to make individual copies

available to all students, faculty, and staff for installation and use

on their computers. POLYMATH can be provided by computer

networks.

The current site license costs for POLYMATH are $175 and $125

for each successive year thereafter. CACHE nonmember

institution rates are an initial $200 and a $150 annual fee for

subsequent years. These fees cover any updates or new versions.