CBE 40445 Monday, 29th August 2011lllee/tutorialpm.pdfOpen Polymath Fogler from the start menu....

35
Polymath Tutorial CBE 40445 Monday, 29th August 2011

Transcript of CBE 40445 Monday, 29th August 2011lllee/tutorialpm.pdfOpen Polymath Fogler from the start menu....

Polymath Tutorial

CBE 40445

Monday, 29th August 2011

Polymath Capabilities• Linear Equations Solver

• Nonlinear Equations Solver

• Differential Equations Solver

• Regression – Linear & Polynomial

– Data Table

– Multiple Linear or Multiple Nonlinear Regression

• Additional Capabilities– Export to Excel

– Calculator and unit conversion tools

– Polymath Export to Matlab (see help Menu for more information)

Today’s Class

• Provide information on Polymath– How to open and use the software

• Learn how to input and solve nonlinear and differential equations– Provide step-by-step instructions so you can practice

and compare results

• Address the question: Why learn another software program?

Starting Polymath1. Open Polymath Fogler from the start menu.

Navigating the Menu

1. New program2. Open file3. Open recent file4. Save file5. Cut6. Copy7. Paste8. Delete9. Find10. Find and replace11. Solve system of linear equations12. Solve system of nonlinear equations

13. Solve system of ODEs14. Regress and analyze data15. Calculator16. Unit converter17. Scientific constants18. Setup preferences19. Help

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

For more information: Help Menu

Help Menu

Example 1: Nonlinear Equation SolverConsider the following set of equations:

k·CA12 = v·(CA0-CA1)/Vk·CA22 = v·(CA1-CA2)/V

where k = 0.075, v = 30, CA0 = 1.6, and CA2 = 0.2 CA0.

Therefore, we have two remaining variables: variables CA1 and V.

We will use initial estimates: CA1=1 and V=300.

How do we do this in Polymath?

Nonlinear Equation Solver

Rearrange:

0 = k·CA12 – v(CA0 - CA1)/V 0 = k·CA22 – v(CA1-CA2)/V

In Polymath, the appropriate forms for these equations are:

f(CA1) = k·CA12 – v(CA0 - CA1)/V = 0f(V) = k·CA22 – v(CA1-CA2)/V = 0

Can f(CA1) and f(V) be switched?

1. Open a new sheet by clicking on the blank sheet in the upper corner.2. Open Nonlinear Equations

3. In the upper left corner, click the f(x)+ button. This will allow you to enter one of the two equations.4. A new window will open. 5. Type in the first equation as shown before.

3. In the upper left corner, click the f(x)+ button. This will allow you to enter one of the two equations.4. A new window will open. 5. Type in the first equation as shown before. 6. Press Done.

7. You should see the new equation in the worksheet, as well as the comments.8. Enter the second equation by repeating the same steps.

9. You will see the two equations and two initial value guesses in the worksheet.10. The red X displays the undefined variables.11. Enter the undefined variables by either 1) clicking on the x(=)+ button in the menu or 2) entering directly into the worksheet.

9. You will see the two equations and two initial value guesses in the worksheet.10. The red X displays the undefined variables.11. Enter the undefined variables by either 1) clicking on the x(=)+ button in the menu or 2) entering directly into the worksheet.12. Now you should see a blue check mark indicating this system of equations can be solved. 13. To solve, click the purple arrow.

Results:

CA1 initial guess: 1V initial guess: 300

CA1 = 0.602V= 1102

Example 2: Solving a System of Ordinary Differential Equations (ODEs)This system may contain two types of equations: 1) first order ordinary differential equations and 2) explicit algebraic equations.

The differential equations must be entered in the following form: d(x)/d(t)= ……….

Here t is the independent variable and x is a dependent variable.

Auxiliary algebraic equations must be entered in the form: x = …….

For differential equations, an initial value is needed for all variables. A final value is needed for the independent variable.

1. Open a new program (blank sheet)2. Select Differential Equations

3. Select the d(x)+ button to add a new differential equation.

What should we solve?

Series Reaction: A B C

Using Polymath, we can monitor the conversion of A, the formation (and disappearance) of B, and the formation of C.

Species Balances:

Let’s solve this series of differential equations.

k1 k2

Aktd

Ad*1

)(

)( BkAk

td

Bd*2*1

)(

)( Bk

td

Cd*2

)(

)(

4. Select the d(x)+ button to add a new differential equation.

5. Add the three equations with the following initial parameters: A(0)=1, B(0)=0, C(0)=06. We still have two undefined variables: k2 and k17. Enter k1 as 1 and k2 as 2.

5. Add the three equations with the following initial parameters: A(0)=1, B(0)=0, C(0)=06. We still have two undefined variables: k2 and k17. Enter k1 as 1 and k2 as 2.

We have an error. We need to enter the initial and final values for our independent variable (t).

8. To add the final values for t, select Edit followed by Define Initial and Final values…9. Then enter the initial and final values for t: 0 and 3.

8. To add the final values for t, select Edit followed by Define Initial and Final values…9. Then enter the initial and final values for t: 0 and 3.10. Select Problem and Arrange Equations to sort the list.

8. To add the final values for t, select Edit followed by Define Initial and Final values…9. Then enter the initial and final values for t: 0 and 3.10. Select Problem and Arrange Equations to sort the list.

Before we solve, let’s add a title.11. Select Edit and Enter Problem Title…

12. Click the Graph box to add graphing options.

Graph

13. To run the program, click the purple arrow.

Run Program

Final values:A = 0.050B = 0.047C = 0.903

Concentration ProfilesGraph generated to show disappearance of reactant A.

Concentration ProfilesGraph generated to show disappearance of reactant A.

Click Graph to modify

Concentration Profiles

Click brush to edit

How can B maximized?• A B C• If k1>>k2, what happens?• Change k2 to 0.5 and k1 to 2

With k1 = 1 and k2 =2,Bmax = 0.25

With k1 = 2 and k2 =0.5,Bmax = 0.63

k1 k2

To order Polymath

• http://www.polymath-software.com/

• 5 day free trial

– Use the trial to see if you would like to purchase the software

• $20/4 months