0% found this document useful (0 votes)
14 views14 pages

Computational (Numerical) Methods For Chemical Engineers: Chapter One

The study of reaction

Uploaded by

Balemlay Animut
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views14 pages

Computational (Numerical) Methods For Chemical Engineers: Chapter One

The study of reaction

Uploaded by

Balemlay Animut
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Computational (Numerical) Methods For Chemical Engineers 2014E.C.

CHAPTER ONE
Chemical Engineering, Mathematical Modeling and Computational Methods

Objective
At the end of this chapter, student should be able to
 Understand the need for numerical methods, and
 Go through the stages (mathematical modeling, solving and implementation) of solving a
particular engineering problem.
 Find the true and relative true error,
 Find the approximate and relative approximate error,
 Relate the absolute relative approximate error to the number of significant digits at least
correct in your answers, and
 Know the concept of significant digits.
 Know that there are two inherent sources of error in numerical methods – round-off and
truncation error,
 Recognize the sources of round-off and truncation error, and
 Know the difference between round-off and truncation error.
 Understand the basics of Taylor’s theorem,
 Write transcendental and trigonometric functions as Taylor’s polynomial
Introduction
1.1. Definition
Mathematical models are an integral part in solving engineering problems. Many times, these
mathematical models are derived from engineering and science principles, while at other times
the models may be obtained from experimental data.

Mathematical models generally result in need of using mathematical procedures that include but
are not limited to:

a. Differentiation,
b. Nonlinear equations,
c. Simultaneous linear equations,
d. Curve fitting by interpolation or regression,
e. Integration, and
f. Differential equations.
These mathematical procedures may be suitable to be solved exactly as you must have
experienced in the series of calculus or applied mathematics courses you have taken, but in most
cases, the procedures need to be solved approximately using numerical methods.
Numerical or Computational methods is a subject concerned with developing methods for
computing, usually approximately, the solution of mathematical expressions which can’t be
solved analytically.
A numerical method is at the heart of the engineering discipline because most engineering
problems whose mathematical models are either very difficult or impossible to solve

DTU CHED By Marye M. (MSc) Page 1


Computational (Numerical) Methods For Chemical Engineers 2014E.C.
analytically can only be solved by the use of numerical analysis. The advent of high speed
computer to our use has made computation easier and fast.
1.2 Non-computer Problem Solving
Engineers approached to solve problems during pre-computer era.
1.2.1 Analytical Methods

Solutions have been derived for some engineering problems using analytical (or exact) methods.
In general there are few closed-form engineering or exact solutions. These solutions are often
useful and provide excellent insight into the behavior of an engineering system.
Advantage: provide excellent insight into the behavior of some systems
Disadvantage: only for simple linear models or simple geometry and low dimensionality
1.2.2 Graphical solutions
Advantage: able to characterize the behavior of systems
Disadvantage: the results are not precise and limited to three or less dimensions
1.2.3 Calculators approaches
Advantage: perfectly adequate for solving complex problems manually
Disadvantage: the calculations are slow, tedious and consistent results are elusive
1.3 Numerical Methods in Engineering Problems Solving
What is a Numerical method?
Numerical methods are techniques by which mathematical problems are formulated so that they
can be solved with arithmetic operations. Numerical methods involve large numbers of tedious
arithmetic calculations. These methods have gained popularity due to the advancements in
efficient computational tools such as digital computers and calculators.
Advantages of numerical methods (NM):
NM are extremely powerful problem-solving tools
 Capable of handling large systems of equation, complicated geometries etc., that are
often impossible to solve analytically.
NM are an efficient vehicle for learning to use computers
 It is an effective way to learn programming by writing the computer programs.
NM provide a vehicle to reinforce the understanding of mathematics
 This is done by reducing higher mathematics to basic arithmetic operations.

DTU CHED By Marye M. (MSc) Page 2


Computational (Numerical) Methods For Chemical Engineers 2014E.C.

1.4 Computer and Engineering Problems Solving

With the development of fast, efficient digital computer, the role of numerical methods in
engineering problem solving has increased dramatically in recent years. Although they have
great potential utility, computers are practically useless without a fundamental understanding of
how engineering systems work. This understanding is normally gained from empirical and
theoretical analysis, and is most useful when it is expressed in the form of a mathematical model.
Problem Solving Process

1.5 Mathematical Modeling of Engineering Problem

Equations that expresses the essential features of a physical systems


Represented as a functional relationship in the form of
Dependent Variables = f (independent variables, parameters, forcing function)
Dependent Variables: Reflects the behavior or state of the system
Independent Variables: Dimensions, such as time and space
Parameters: Reflective of the system’s properties or composition
Forcing Function: External influence acting upon it
Example on Mathematical Modeling: Force on falling parachutist
A parachutist with a mass of “m” falls from a certain height. Determine the terminal velocity of
freely falling body near the earth surface.
Solution:
Based on the expression
Dependent Variables = f (independent variables, parameters, forcing function)

DTU CHED By Marye M. (MSc) Page 3


Computational (Numerical) Methods For Chemical Engineers 2014E.C.
Newton second law of motion can be applied on this example.
“The time rate of change of momentum of a body is equal to the resultant force
acting on it. “
F = ma
a = F/m
Where: a – the dependent variable reflecting the system’s behavior, F – force
function and m – a parameter representing property of the system. For this simple
case there is no independent variable because we are not yet predicting how
acceleration varies with time or space.
The model for this case can be derived by the expressing the acceleration as the
time rate of change of velocity (dv/dt) and substitute it.
𝑑𝑣 𝐹
=
𝑑𝑡 𝑚
The net force can be expressed in terms of measurable variable and parameters. The
net force is a composed of two opposite forces: the downward pull of gravity FD
and upward force of resistance FV

If the downward force is assign as positive and FD = mg i.e. g = 9.81m/s2


Air resistance can be assumed as linearly proportion to the velocity and act upward i.e. Fv = -cv

Case 1: Analytical Methods


A parachutist of mass 68.1kg jumps out of a stationary hot air balloon. Compute the velocity
prior to opening the chute. The drag coefficient is equal to 12.5kg/s.

DTU CHED By Marye M. (MSc) Page 4


Computational (Numerical) Methods For Chemical Engineers 2014E.C.

According to the model, the parachutist accelerates rapidly a velocity of 44.87 m/s is attained
after 10s. Note also after a sufficient long time a constant velocity, called terminal velocity is
reached. This velocity is constant because, eventually, the force of gravity will be in balance with
the air resistance. Thus, the net force is zero the acceleration has ceased.
Equation 1 is called an analytical, or exact, solution because it exactly satisfies the original
differential equation. Unfortunately, there are many mathematical models that can’t be solved
exactly. In many of these cases, the only alternative is to develop a numerical solution that
approximates the exact solution.
Case 2: Numerical Method’s

New value = old value + (slope) (step size)

DTU CHED By Marye M. (MSc) Page 5


Computational (Numerical) Methods For Chemical Engineers 2014E.C.

Numerical methods capture the essential features of the exact solution. However, because we
have employed straight-line segments to approximate a continuously curving function, there is
some discrepancy between the two results. One way to minimize such discrepancies is to use a
smaller step size. For example, solving at 1-s interval results in a smaller error, as the straight-
line segment track closer to the true solution.
As mentioned at the beginning of this chapter, we generally see mathematical procedures that
require the solution of nonlinear equations, differentiation, and solution of simultaneous linear
equations, interpolation, regression, integration, and differential equations. A physical example
to illustrate the need for each of these mathematical procedures is given in the beginning of each
chapter. You may want to look at them now to understand better why we need numerical
methods in everyday life.

1.6 Error analysis

Numerical techniques yield approximate values and there are always errors associated with the
approximation. Understanding the concept of error is very important to the effective use of
numerical methods. Science for many applied engineering problems we can’t evaluate the true
error associated with our approximation. In this case we must settle for approximation or
estimates of the errors. Since we can’t avoid the error associated with our numerical endeavors,
our next target to answer the question “how much error is present in our calculation? And is it
tolerable?”
Errors
The accuracy of a numerical calculation is quantified by the error of the calculation.
Several types of errors can occur in numerical calculations.
1. Errors in the parameters of the problem (assumed nonexistent).

DTU CHED By Marye M. (MSc) Page 6


Computational (Numerical) Methods For Chemical Engineers 2014E.C.
2. Algebraic errors in the calculations (assumed nonexistent).
3. Iteration errors.
4. Approximation errors.
5. Round off errors.
Iteration error is the error in an iterative method that approaches the exact solution of an exact
problem asymptotically. Iteration errors must decrease toward zero as the iterative process
progresses. The iteration error itself may be used to determine the successive approximation to
the exact solution. Iteration errors can be reduced to the limit of the computing device.
Approximation error is the difference between the exact solution of an exact problem and the
exact solution of an approximation of the exact problem. Approximation error can be reduced
only by choosing a more accurate approximation of the exact problem.
Round off error is the error caused by the finite word length employed in the calculations.
Round off error is more significant when small differences between large numbers are
calculated.
In any numerical analysis, errors will arise during the calculations. To be able to deal with the
issue of errors, we need to

a. Identify where the error is coming from, followed by


b. Quantifying the error, and lastly
c. Minimize the error as per our needs.
Q: What is true error?
A: True error denoted by Et is the difference between the true value (also called the exact value)
and the approximate value.
True Error  True value – Approximate value

Example 1
The derivative of a function f (x) at a particular value of x can be approximately calculated by
f ( x  h)  f ( x )
f ( x)  of f (2) For f ( x)  7e 0.5 x and h  0.3 ,
h
Find
a. The approximate value of f (2)
b. The true value of f (2)
c. The true error for part (a)
Q: What is relative true error?

DTU CHED By Marye M. (MSc) Page 7


Computational (Numerical) Methods For Chemical Engineers 2014E.C.
A: Relative true error is denoted by t and is defined as the ratio between the true error and the
true value.
True Error
Relative True Error 
True Value

Example 2
The derivative of a function f (x) at a particular value of x can be approximately calculated by
f ( x  h)  f ( x )
f ' ( x) 
h
For f ( x)  7e and h  0.3 , find the relative true error at x  2 .
0.5 x

Q: What is approximate error?


A: In the previous section, we discussed how to calculate true errors. Such errors are calculated
only if true values are known. An example where this would be useful is when one is checking if
a program is in working order and you know some examples where the true error is known. But
mostly we will not have the luxury of knowing true values as why you would want to find the
approximate values if you know the true values. So when we are solving a problem numerically,
we will only have access to approximate values. We need to know how to quantify error for such
cases.
Approximate error is denoted by Ea and is defined as the difference between the present
approximation and previous approximation.
Approximate Error  Present Approximation – Previous Approximation

Example 3
The derivative of a function f (x) at a particular value of x can be approximately calculated by
f ( x  h)  f ( x )
f ' ( x) 
h
For f ( x)  7e and at x  2 , find the following
0.5 x

a. f (2) using h  0.3


b. f (2) using h  0.15
c. Approximate error for the value of f (2) for part (b)
Q: What is relative approximate error?
A: Relative approximate error is denoted by a and is defined as the ratio between the
approximate error and the present approximation.
Approximat e Error
Relative Approximate Error 
PresentApproximat ion

DTU CHED By Marye M. (MSc) Page 8


Computational (Numerical) Methods For Chemical Engineers 2014E.C.
Example 4
The derivative of a function f (x) at a particular value of x can be approximately calculated by
f ( x  h)  f ( x )
f ' ( x) 
h
For f ( x)  7e , find the relative approximate error in calculating f (2) using values from
0.5 x

h  0.3 and h  0.15 .


Q: While solving a mathematical model using numerical methods, how can we use relative
approximate errors to minimize the error?
A: In a numerical method that uses iterative methods, a user can calculate relative approximate
error a at the end of each iteration. The user may pre-specify a minimum acceptable tolerance

called the pre-specified tolerance, s . If the absolute relative approximate error a is less than or

equal to the pre-specified tolerance s , that is, |a | s , then the acceptable error has been reached
and no more iterations would be required. Alternatively, one may pre-specify how many
significant digits they would like to be correct in their answer. In that case, if one wants at
least m significant digits to be correct in the answer, then you would need to have the
absolute relative approximate error, |a | 0.5 102m %.

Class activity
If one chooses 6 terms of the Maclaurin series for e x to calculate e 0.7 , how many significant
digits can you trust in the solution? Find your answer without knowing or using the exact
answer.

1.6.1 Sources of Error

Error in solving an engineering or science problem can arise due to several factors. First, the
error may be in the modeling technique. A mathematical model may be based on using
assumptions that are not acceptable. For example, one may assume that the drag force on a car is
proportional to the velocity of the car, but actually it is proportional to the square of the velocity
of the car. This itself can create huge errors in determining the performance of the car, no matter
how accurate the numerical methods you may use are. Second, errors may arise from mistakes
in programs themselves or in the measurement of physical quantities. But, in applications of
numerical methods itself, the two errors we need to focus on are

1. Round off error


2. Truncation error.

DTU CHED By Marye M. (MSc) Page 9


Computational (Numerical) Methods For Chemical Engineers 2014E.C.
What is round off error?
1
A computer can only represent a number approximately. For example, a number like may be
3
represented as 0.333333 on a PC. Then the round off error in this case is
1
 0.333333  0.0000003 3 . Then there are other numbers that cannot be represented exactly.
3
For example,  and 2 are numbers that need to be approximated in computer calculations.

Engineering example error created by round off errors


Twenty-eight Americans were killed on February 25, 1991. An Iraqi Scud hit the Army barracks
in Dhahran, Saudi Arabia. The patriot defense system had failed to track and intercept the Scud.
What was the cause for this failure?

The Patriot defense system consists of an electronic detection device called the range gate. It
calculates the area in the air space where it should look for a Scud. To find out where it should
aim next, it calculates the velocity of the Scud and the last time the radar detected the Scud.
Time is saved in a register that has 24 bits length. Since the internal clock of the system is
measured for every one-tenth of a second, 1/10 is expressed in a 24 bit-register as
0.00011001100110011001100. However, this is not an exact representation. In fact, it would
need infinite numbers of bits to represent 1/10 exactly. So, the error in the representation in
decimal format is

Figure 1 Patriot missile (Courtesy of the US Armed Forces,


http://www.redstone.army.mil/history/archives/patriot/patriot.html)
1
 (0  2 1  0  2  2  0  2 3  1 2  4  ...  1 2  22  0  2  23  0  2  24 )
10
 9.537108

The battery was on for 100 consecutive hours, hence causing an inaccuracy of

s 3600s
 9.537108 100 hr 
0.1s 1hr
 0.3433s

DTU CHED By Marye M. (MSc) Page 10


Computational (Numerical) Methods For Chemical Engineers 2014E.C.
The shift calculated in the range gate due to 0.3433s was calculated as 687 m . For the Patriot
missile defense system, the target is considered out of range if the shift was going to more than
137 m .

What is truncation error?

Truncation error is defined as the error caused by truncating a mathematical procedure. For
example, the Maclaurin series for e x is given as

x2 x3
ex  1 x    ....................
2! 3!

This series has an infinite number of terms but when using this series to calculate e x , only a finite
number of terms can be used. For example, if one uses three terms to calculate e x , then
x2
e  1 x  .
x

2!
The truncation error for such an approximation is
 x2 
Truncation error = e  1  x  ,
x

 2! 
x3 x4
   .......................
3! 4!
But, how can truncation error be controlled in this example? We can use the concept of relative
approximate error to see how many terms need to be considered. Assume that one is calculating
e1.2 using the Maclaurin series, then
1.2 2 1.2 3
e1.2  1  1.2    ...................
2! 3!

Let us assume one wants the absolute relative approximate error to be less than 1 %. In Table 1,
we show the value of e1.2 , approximate error and absolute relative approximate error as a function
of the number of terms, n .

n e 1 .2 Ea a %
1 1 - -
2 2.2 1.2 54.546
3 2.92 0.72 24.658
4 3.208 0.288 8.9776
5 3.2944 0.0864 2.6226
6 3.3151 0.020736 0.62550
Using 6 terms of the series yields a a < 1%.

DTU CHED By Marye M. (MSc) Page 11


Computational (Numerical) Methods For Chemical Engineers 2014E.C.
1.7 Significant Digits
The significant digits, or figures, in a number are the digits of the number which are known to
be correct. Engineering and scientific calculations generally begin with a set of data having a
known number of significant digits. When these numbers are processed through a numerical
algorithm, it is important to be able to estimate how many significant digits are present in the
final computed result.
Significant Figure
The significant figures (sig figs) of a number are the digits from the first nonzero digit on the
left to either last digit (zero or non) on the right if there is a decimal, or last nonzero digit of a
number if there is no decimal.
• 2300 or 2.3×103 has 2 sig figs
• 2300. or 2.300×103 has 4 sig figs
• 2300.0 or 2.3000×103 has 5 sig figs
• 23,040 or 2.304×104 has 4 sig figs
• 0.035 or 3.5×10-2 has 2 sig figs
• 0.03500 or 3.500×10-2 has 4 sig figs
Example
Give some examples of showing the number of significant digits.

Purpose of significant figure


The number of sig figs in a reported value of a measured or calculated quantity provides
indication of the precision with which that quantity is known: the more sig figs, the more precise
is the value.
 i.e., 8.3 g means between 8.25 g and 8.35 g
 whereas, 8.300g means between 8.2995 g and 8.3005 g
Rule of significant figure
When two or more quantities are combined by multiplication and/or division, the number of
sig figs in the result should equal the lowest number of sig figs of any of the multiplicands or
divisors.
(3) (4) (7) (3)
3.574.286  15.30102  15.3

(2) (4) (3) (9) (2) (2)


   
5.2 10 0.163510 / 2.67  318.426966 3.2 10  320
4 7 2

When two or more numbers are added/subtracted
1.0000
1530
0.0036
 2.56
 0.22  1530
 1.26 1527.44
1.2560

DTU CHED By Marye M. (MSc) Page 12


Computational (Numerical) Methods For Chemical Engineers 2014E.C.
Differentiate Preliminaries - general terms and concepts
Precision refers to how closely a number represents the number it is representing. It is governed
by the number of digits being carried in the numerical calculations.
Accuracy refers to how closely a number agrees with the true value of the number it is
representing. It is governed by the errors in the numerical approximation; precision and accuracy
are quantified by the errors in a numerical calculation.
1.8 Properties of numerical methods
The following criteria are crucial to the performance of a numerical algorithm:
1. Consistency: The discretization of a PDE should become exact as themes size tends to
zero (truncation error should vanish)
2. Stability: Numerical errors which are generated during the solution of discretized
equations should not be magnified
3. Convergence: The numerical solution should approach the exact solution of the PDE
and converge to it as the mesh size tends to zero
4. Conservation: Underlying conservation laws should be respected at thediscrete level
(artificial sources/sinks are to be avoided)
5. Boundedness: Quantities like densities, temperatures, concentrations etc. should remain
nonnegative and free of spurious wiggles
These properties must be verified for each component of the numerical scheme

Taylor Theorem Revisited

The use of Taylor series exists in so many aspects of numerical methods that it is imperative to
devote a separate chapter to its review and applications. For example, you must have come
across expressions such as
x2 x4 x6
cos(x)  1     (1)
2! 4! 6!
x3 x5 x7
sin(x)  x     (2)
3! 5! 7!
x2 x3
ex  1 x    (3)
2! 3!
All the above expressions are actually a special case of Taylor series called the Maclaurin series.
Why are these applications of Taylor’s theorem important for numerical methods? Expressions
such as given in Equations (1), (2) and (3) give you a way to find the approximate values of these

DTU CHED By Marye M. (MSc) Page 13


Computational (Numerical) Methods For Chemical Engineers 2014E.C.
functions by using the basic arithmetic operations of addition, subtraction, division, and
multiplication.
Example 1
Find the value of e 0.25 using the first five terms of the Maclaurin series.
Example 2
x3 x5 x7
Derive the Maclaurin series of sin x   x    
3! 5! 7!

DTU CHED By Marye M. (MSc) Page 14

You might also like