Transcript System

Summary
Basic Probability
(Chapter 2, W.J.Decoursey, 2003)
Objectives:
- Define probability and its relationship to relative
frequency of an event.
- Learn the basic rules of combining probabilities.
- Understand the concepts of mutually exclusive / not
mutually exclusive and independent / not
independent events.
Basic Probability
Summary of Combining Rule
When doing combined probability problems, ask yourself:
1. Does the problem ask the logical OR or the logical
AND?
2. If OR, ask your self are the events mutually exclusive
or not? If yes, Pr [ A U B ] = Pr [A] +Pr [B],
other wise
Pr [ A U B ] = Pr [A] +Pr [B] – Pr [A ∩ B]
3. If AND, use the multiplication rule and remember
conditional probability. A probability tree may be helpful.
4. Fault Tree Analysis
Descriptive Statistics
Objectives: (Chapter 3, Decoursey)
- To understand the definition of mean, median,
variance, standard deviation, mean absolute
deviation and coefficient variation and calculate
these quantities.
- To calculate some of these quantities using the
statistical functions of Excel.
Descriptive Statistics
1
x or  
N
N
 
2
 (x
i 1
i
x
/ or s/ x
i
 )
N
2
s 
2
N
N

2
(
x


)
 i
i 1
N
 (x
i 1
i
 x)
N 1
N
s
2
(
x

x
)
 i
i 1
N 1
2
Probability Distributions, Discrete
Random Variables
Objectives: (Chapter 5, DeCoursey)
- To define a probability function, cumulative
probability, probability distribution function
and cumulative distribution functions.
- To define expectation and variance of a
random variable.
- To determine probabilities by using Binomial
Distribution.
Probability Distributions, Discrete Random
Variables
k
Pr[ X  x]   p( xi )
 p( x )  1
p ( xi )  0
i
i 0
xi  x
p( xi )  Pr[ X  xi ]  Pr[ X  xi 1 ]
E( X )   x 
 ( x ) p( x )
i
i
all xi
 x  E( X   x )  E[ X ]  
2
2
2
where E[ X ]   x p( xi )
2
2
x
2
i
all i
 x  E[( X   x ) ]  E ( X )   x
2
2
2
Probability Distributions, Discrete
Random Variables
Binomial Distribution:
Let p = probability of “success”
q=probability of “failure” = 1-p
n = number of trails
r = number of “success” in “n” trails
Then the probability of r successes for n trials is given by the
following general formula:
n!
Pr[ R  r ] 
p r q ( nr )
r!(n  r )!
 n C r p r q ( nr )
E ( R)    np
  npq
Probability Distributions, Continuous
Variables
Objectives: (Chapter 6, DeCoursey)
- To establish the difference between probability
distribution for discrete and continuous
variables.
- To learn how to calculate the probability that a
random variable, X, will fall between the limits
of “a” and “b”.
Continuous Variable
Discrete Variable
 p( x )
b
Pr[ a  x  b]   f ( x)dx
a  xi b
a
x1
Pr[ X  x1 ] 

f ( x)dx
Pr[ X  x]   p( xi )
xi  x

 p( x )  1

F ( ) 

f ( x)dx  1

  E( X ) 
i
all xi

 xf ( x)dx
E( X )   x 
x 
2
x

2
f ( x)dx   x
2
 ( x ) p( x )
i
i
all xi


i
 x   xi2 p( xi )   x2
2
all i
Normal Distribution
f(z)
z
z
x
(X variable)

( z1 )  Pr[  Z  z1 ]
Pr[ z1  Z  z 2 ]  ( z 2 )  ( z1 )
Statistical Inference for the Mean
Compare
x
to μ
S. D. of population σ is
known and unchanged
S. D is from the sample
Use Normal Distribution
Use t Distribution
z
x
t
/ n
x
s/ n
Table A2
Table A1
( z1 )  Pr[  Z  z1 ]
Pr[t  t1 ] at df  n  1
Test at a specified Level of significance
Confidence
Interval:
xz

n
xt
s
n
Statistical Inference for the Mean
Compare
x1 to x 2
Unpaired samples:
independent test
Paired samples: dependent test
d=x1-x2
Use t Distribution
Use t Distribution
x1  x 2
t
s( x  x )
1
s
d
d
t

sd sd / n
2
1
1
s (n  1)  s 2 (n2  1)
 sc (  ) sc 2  1 1
n1 n2
(n1  1)  (n2  1)
2
2
2
2
( x1  x 2 )
Pr[t  t1 ] at df  n1  1  n 2  1
Pr[t  t1 ] at df  n  1
Test at a specified Level of significance
Statistical Inference for the Mean
Test of Significance:
- State the null hypothesis in terms of the mean difference
- State the alternative hypothesis in terms of the same population
parameters.
- Determine the mean and variance.
- Calculate the test statistic t or z of the observation.
- Determine the degrees of freedom for t-test.
- State the level of significance – rejection limit.
- If probability falls outside of the rejection limit, we reject the Null
Hypothesis, which means the difference of the two samples are
significant.
Assume the samples are normally distributed.
Regression and Correlation of Data
Summary
Procedures for regression:
1. Assume a regression equation.
2. If the equation is simple linear form, use least
squares method to determine the coefficients.
If not, convert it to the form linear in coefficients and
then use least squares method.
Or use Excel functions such as Solver, Trendline or
Linest.
3. Evaluate the regression by statistical analysis
Regression and Correlation of Data
Summary
Simple Linear Regression:
yˆ i  a  bxi
Method of Least Squares: a and b are determined by
minimizing the sum of the squares of errors (SSE),
deviation, residuals or difference between the data set
and the straight line that approximate it.
n
n
n
i 1
i 1
i 1
SSE   ei2   [ y i  yˆ i ] 2   [ y i  (a  bxi )] 2

( SSE )  0
a

( SSE )  0
b
Regression and Correlation of Data
Summary
1  n  n

xi y i    xi   y i 

n  i 1  i 1 
i 1
n
b
1

xi    xi 

n  i 1 
i 1
n
n
a
y
i 1
n
2
2
n
i
 b xi
i 1
n
Centroidal point: ( x, y )
 y  bx
Regression and Correlation of Data
Summary
Other forms linear in coefficients: Forms transformable to linear
in coefficients: e.g.
e.g.
1
 a  bx
y
3
ln y  a  bx y  a  bx
y  ae bx
ln y  ln a  bx
Y  A  BX
1 a
 b
y x
x
y
a  bx
Use least square method to determine the coefficients.
Convert the equation to the form containing the original variables.
Regression and Correlation of Data
Summary
Statistical analysis of the regression:
Sum of the squares of errors (SSE),
n
SSE   [ y i  (a  bxi )] 2
i 1
SSE  S yy  bS xy
n
n
n
i 1
i 1
i 1
S yy   ( y i  y ) 2 , S xy   ( xi  x)( y i  y ), S xx   ( xi  x) 2
Estimated variance of the
points from the line:
s
2
y x
SSE

n2
Estimated standard deviation or
standard error of the points from the line:
sy x 
SSE
n2
The degrees of freedom=n data points – the number of estimated coefficients
Regression and Correlation of Data
Summary
Correlation Coefficient:
r 
S xy
S xx S yy
r =1: the points (xi,yi) are in a perfect straight line and the slope
of that line is positive;
r =-1: the points (xi,yi) are in a perfect straight line and the
slope of that line is negative;
r close to +1 or -1: X and Y follow a linear relation affected by
random errors.
r=0: there is no systematic linear relation between X and Y.
Regression and Correlation of Data
Summary
Coefficient of determination:
n
r2 
2
ˆ
(
y

y
)
 i
i 1
n
2
(
y

y
)
 i
i 1
n
2
ˆ
(
y

y
)
 i
 S xy
r 2  i n1

 S S
2
 ( yi  y)  xx yy
2

 for the simple linear form


i 1
The coefficient of determination is the fraction of the sum of
squares of deviations in the y-direction from y is explained
by the relation between y and x given by regression.
Regression and Correlation of Data
Summary
Statistical analysis of the regression:
Residuals (also used for graphical checks):
ei  yi  yˆ i
Percentage Error:
ei
yi  yˆ i
*100% 
*100%
yi
yi
Absolute Percentage Error:
yi  yˆ i
abs(
*100%)
yi
Modeling with Unsteady State Material
and Energy Balance
Objectives: (Mainly in Chapters 6 & 22, Himmelblau)
- To review the material and energy balance concept.
- To discriminate between unsteady state and steady
state material balance.
- To perform unsteady state material and energy
balance and solve the resulting first order linear
differential equations.
System
(Himmelblau, D., 2004, p.136)
System: any arbitrary portion of or a whole process
that you want to consider for analysis.
- You can define a system such as a reactor, a section of
a pipe, or an entire refinery by stating in words what the
system is.
- You can define the limits of the system by drawing the
system boundary, namely a line that encloses the portion
of the process that you want to analyze.
fi=100 L/hr
C, P V, t
fo=100 L/hr
Closed System
(Himmelblau, D., 2004, p.136)
Closed system: That material neither enters nor leaves
the vessel, that is , no material crosses the system boundary.
- Changes can take place inside the system, but for a
closed system, no mass exchange occurs with the
surroundings.
C, P V, t
Open System
(Himmelblau, D., 2004, p.136)
Open system: also called a flow system because
material cross the system boundary.
fi=100 L/hr
fo=100 L/hr
Modeling with Unsteady State Material
and Energy Balance
Basic laws: conservation law
output through
Input through
system boundaries
system boundaries
Accumulation
=
within system
+
Generation
within system
-
Consumption
within system
- mass
- energy
- momentum
- rate expression for generation or
consumption
Modeling with Unsteady State Material
and Energy Balance
Basic laws: conservation law
output through
Input through
system boundaries
system boundaries
Accumulation
=
within system
+
Generation
within system
-
Consumption
within system
Steady State: accumulation is zero. The quantity
does not change with time.
Unsteady State: The quantity changes with time.
Modeling with Unsteady State
Material and Energy Balance
Procedures:
- Specify the system
- Bring together all variables of interest
- Set down finite and differential elements
- Develop equations by conservation law
and/or rate expression
- Generate differential equations as the
differential elements shrink in the limit.
- Specify boundary conditions
Modeling with Unsteady State
Material Balance
Basic laws:
Mass output through
Mass Input through
system boundaries
system boundaries
Mass
=
Accumulation
within system
+
Mass generation within system
Mass consumption
within system
Liquid, gas and solid systems
Closed or open system
Modeling with Unsteady State
Energy Balance
Basic energy balance:
Energy
=
Accumulation
within system
Energy output through
Energy Input through
system boundaries
system boundaries
+ Energy generation within system
Energy consumption
within system
Open or closed systems: T vs t
Modeling with Unsteady State
Energy Balance
Et+ ∆ t – Et = (U + K.E.+ P.E.) t+ ∆ t - (U + K.E.+ P.E.)t
= Q + W + (H+K.E.+P.E.)in - (H+K.E.+P.E.)out + ∆Hr
In most chemical engineering processes, the change of
K.E. and P.E. can be negligible, the above equation
for a open system becomes
Et+ ∆ t – Et = (U) t+ ∆ t - (U)t = Q + W + (H)in - (H)out + ∆Hr
For a closed system, the above equation becomes
Et+ ∆ t – Et = (U) t+ ∆ t - (U)t = Q + W + ∆Hr
dU = mCvdT dH = mCpdT
M: mass (g), Cv: heat capacity at constant volume (J/goC);
Cp: heat capacity at constant pressure (J/goC).
SOLVE ODEs
Approach: separation of variables
(Adams, Calculus, 1999, p.525)
If a 1st order differential equation has the form
dy
 F ( x, y ) = g(x)h(y)
dx
Then separate and integrate both sides
dy
 g ( x)dx
h( y )
dy
 h( y)   g ( x)dx
Apply initial condition, unique solution to y can be determined.
(See in-class example)
Summary of Integrating Factor
Write the general equation of 1st order linear ODE
dy
  ( x) y  f ( x)
dx
Determine integrating factors I (x)

Ix   exp  x dx

Determine dependent variable or unknown function y
1
C
y
I x  f x dx 

I x 
I x 
Arbitrary constant C is determined by the boundary condition.