Sie sind auf Seite 1von 17

Chemical Reaction Engineering

Polymath Tutorial

POLYMATH For Computational


Problems
We do not want to solve numerical problems on

our own
You have done it (hopefully) in the course of

In CRE,
we
will
use
POLYMATH
to
solve
Numerical Analysis !
Interpolation
Differentiation
Integration from data

Differential equations
Nonlinear equations
Linear equations

Least square/parameter estimation

What are the alternatives to Polymath


MATLAB, C, FOORTRAN, EXCEL, etc

Why Polymath
Simple, interactive, user friendly, compact

POLYMATH

Numerical Interpolation
Y=f(X)
X
1
5
10
20
40
60
100
200
400
760

Y
0.00422922
0.003944
0.0038219
0.00369617
0.00356189
0.0034656
0.00334169
0.00317108
0.00299625
0.00283086

Open POLYMATH
Click REG Tab at the top of the window
Write the data in columns
Click Analysis tab (bottom of the new windo)
Define independent, dependant variales (x and y)
on right side
Define the x value at which you want the value of y
Press the right arrow on top left to get the interpola
value
-3

x 10

4.5

Y(X=50) = ?
y

4
3.5
3
2.5
0

500

1000

Numerical Integration
Y=f(X)

Y
0.00422922
0.003944
0.0038219
0.00369617
0.00356189
0.0034656
0.00334169
0.00317108
0.00299625
0.00283086

-3

x 10

4.5
4

X
1
5
10
20
40
60
100
200
400
760

Independent variable = x
Dependent variable = y

3.5
3
2.5
0

500

Area under the curve=

=?

1000

Numerical Differentiation
Y=f(X)
Y
0.00422922
0.003944
0.0038219
0.00369617
0.00356189
0.0034656
0.00334169
0.00317108
0.00299625
0.00283086

-3

x 10

4.5
4

X
1
5
10
20
40
60
100
200
400
760

Independent variable = x
Dependent variable = y

3.5
3
2.5
0

500

=?

1000

Ordinary Differential Equations


d(A)/d(t) = -k1*A
d(B)/d(t) = k1*A-k2*B
d(C)/d(t) = k2*B

t0=0; tf= 3
at t = 0
A=1; B=0; C=0

k1 = 1
k2 = 2

Nonlinear Equation
P= R*T/(V-b) - a/V^2
Tc = 304.2
Pc = 72.9
R = 0.08206
a = (27/64)*(R^2*Tc^2/Pc)
b = R*Tc/(8*Pc)
T = 400
P=10
V=?

Solve the nonlinear state equation


for V

Linear Regression
Parameter Estimation
logP = a0 + a1(1/T) + a2T2 + a3logT
Here, T is in K and P in mmHg
T (oC)
-36.7
-19.6
-11.5
-2.6
7.6
15.4
26.1
42.2
60.6
80.1

P (mmHg)
1
5
10
20
40
60
100
200
400
760

SOLUTION
Variable
Value
a0
216.72144
a1
-9318.66
a2
4.445E05
a3
75.748179

What Did We Learn Today?


POLYMATH
Interpolation
Numerical Differentiation
Numerical Integration

Nonlinear Equation
Ordinary Differential Equations (ODE)
Least Square or Parameter Estimation or Linear
Regression

Polymath Practice

Set of linear equations


Solve the following three linear equations for x, y, and z

a1x+a2y+a3z=p1
b1x+b2y+b3z=p2
c1x+c2y+c3z=p3
Where,
a1=1; a2=3; a3=-2; p1=5
b1=3; b2=5; b3=6; p2=7
c1=2; c2=4; c3=3; p3=8

Solve nonlinear equation

K1=1
K2=-4
K3=2
K4=7

Interpolation, Differentiation, Integration


x

10

1.308

20

1.002

30

0.7978

40

0.6531

50

0.5471

60

0.4668

70

0.4044

80

0.3550

90

0.3150

100

0.2822

Find the value of y at x = 45


Find the numerical differentiation of y w.r.t x at x = 45
Find area under the curve of y vs x

Ordinary Differential Equations


(ODEs)

dy1/dt = k1*y2 * y3

dy2/dt = k2y1 * y3

K1=1
where,

dy3 /dt= k3 * y1 * y2

Solve the above ODEs between


t=0 to t=10 with initial condition
y1(0)=0; y2(0)=1; and y3(0)=1

K2=-1
K3=-0.51

Parameter estimation
x1
x2
y
1.0000 5.0000 12.6803
2.0000 10.0000
18.8114
3.0000 15.0000
23.8649
4.0000 20.0000
28.3607
5.0000 25.0000
32.5000
6.0000 30.0000
36.3861
7.0000 35.0000
40.0804
8.0000 40.0000
Find k1 and k2
43.6228
9.0000 45.0000

Write Two things that you


understood
Write Two things that you didnt
understand

Das könnte Ihnen auch gefallen