Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 51

Compiled By

COMPREHENSIVE A. S. Osunleke, PhD.,


(MNSChE, MNSE, R. ENG.)
COURSE NOTE ON DEPARTMENT OF
NUMERICAL METHODS CHEMICAL
ENGINEERING
IN ENGINEERING OBAFEMI AWOLOWO
UNIVERSITY, ILE-IFE
ANALYSIS
 Here is the course note for the first Part of
the Engineering Analysis taken at
Obafemi Awolowo University, Ile-Ife
Nigeria by all Year III Engineering
students.
 In preparing this note, I took cognisance
INTRODUCTION of the fact that the students in this
category represent all areas of
engineering disciplines namely, students
with Agricultural & Environmental,
Chemical, Civil, Computer,
Electronic/Electrical, Food, Mechanical
and Materials Science & Engineering
backgrounds.
With this in mind, I typically chose
examples in those various areas in
illustrating the principles and methods
in this course.
This course note is designed to support a
one-semester course in numerical
INTRODUCTION methods. It has been
written for students who want to learn
and apply numerical methods to solve
problems in engineering and science. As
such, the methods are motivated by
problems rather than by mathematics.
That said, sufficient theory is provided
so that students come away with insight
into the techniques and their
shortcomings.
This course note does assume that the
student has some working knowledge of
INTRODUCTION programming, features and
characteristic of nonlinear equations,
difference equations, differential
equations, linear and polynomial
approximations.
What to note!
 CA: 35 – 40 %
 Attendance (2 marks)
 Classwork (5 – 10 marks)
 Home assignments (15 – 20 marks)
INTRODUCTION
 Tests (40 – 50 marks)

Exam: 60 – 65 %
 Mainly (80 – 100 marks)
Not all in all a Note on
the course

Keep good jottings and


additional notes in class

INTRODUCTION Don’t miss the class

Don’t dub and dump


solutions to assignments
given to you
You will be required to work out some
examples in the class as class work. So,
you are expected to prepare ahead.
PRELIMINARIES
 Motivation
 Problem formulation and problem
solving
CONTENTS  MATLAB Fundamentals
 Programming with MATLAB
 Roundoff and Truncation Errors
ITERATIVE METHODS –
Solution of Nonlinear
Equation

Bisection Method
CONTENTS
Fixed-Point Iterative (FPI) Methods
Jacobi Iteration
Gauss-Seidel Iteration
INTERPOLATION AND
POLYNOMIAL
APPROXIMATION
Linear Interpolation
Quadratic Interpolation
CONTENTS Lagrange interpolation
Divided Difference Interpolation –
Divided differences and polynomials
Equal-spaced Interpolations
 Difference operators and difference Tables
 Forward, backward, and central differences
NUMERICAL INTEGRATION
AND DIFFERENTIATION
 Numerical Differentiation
 Difference Notation and Operators
 Numerical Integration
CONTENTS - Trapezoidal Rule
- Simpson’s Rule
- Mid-Point Rule
- Romberg Integration
NUMERICAL SOLUTION OF
INITIAL VALUE PROBLEMS
 Euler Method
CONTENTS
 Runge-Kutta Methods
 Predictor-Corrector Methods.
In the process of solving problems in
Science, Engineering, Economics, etc., a
physical situation is first converted into a
mathematical model.
This is often called formulation of the
PRELIMINARIES problem.
This mathematical model often gives rise
to mathematical problems which are too
difficult to solve in a neat, closed form
e.g.
 Integration: Find
 Nonlinear Equation: Solve
 Linear Algebra: Find the eigenvalues of a
large matrix
 Differential equations: Solve a system of
nonlinear differential equations.
PRELIMINARIES  When such problem arises, numerical
analysis is then used for developing
techniques to find a solution or
approximate solution of the
mathematical equations describing the
model.
 A numerical method (or a combination
of numerical methods) which can be to
solve a problem is often called an
algorithm.
 An algorithm is a complete and
unambiguous set of procedures leading
PRELIMINARIES
to the solution of a mathematical
problem.
 The results obtained for the solution of a
problem will be affected by various
source of error.
 Numerical analysts must consider how
much accuracy is required, estimate the
magnitude of round-off and discretization
errors, determine an appropriate step-size
or the number of iterations required,
provide for checks on the accuracy and
make allowance for corrective action in
PRELIMINARIES
cases of non-convergence.
 The efficiency of any numerical method
(or algorithm) must also be considered.
 An algorithm would be of no practical
use if it required the largest computer
error built to obtain a useful answer.
The final phase in solving a problem is
programming. Programming is the transformation
of the algorithm into a set of unambiguous step-
by-step instructions for the computer.
In this segment of the course, we will look at the
design (formulation) and analysis of various
numerical methods and assess them in terms of
accuracy, efficiency and computer effort.
PRELIMINARIES
This will involve some mathematical analysis and
some practical work using MATLAB.
It is expected that students attending this course
avail themselves some software packages and get
them installed on their computing facilities
(Laptop, PC, etc.).
You may be required to bring these facilities to the
 What are numerical methods and why
should you study them?
 Numerical methods are techniques by
which mathematical problems are
formulated so that they can be solved with
PRELIMINARIES arithmetic and logical operations.
 Because digital computers excel at
1.1 Motivation performing such operations, numerical
methods are sometimes referred to as
computer mathematics.
 In the pre–computer era, the time and
drudgery of implementing such
calculations seriously limited their practical
 However, with the advent of fast, inexpensive
digital computers, the role of numerical
methods in engineering and scientific problem
solving has exploded.
 Because they feature so prominently in much
of our work, I believe that numerical methods
PRELIMINARIES should be a part of every engineer’s and
scientist’s basic education.
1.1 Motivation  Just as we all must have solid foundations in
the other areas of mathematics and science, we
should also have a fundamental understanding
of numerical methods.
 In particular, we should have a solid
appreciation of both their capabilities and their
 Beyond contributing to your overall
education, there are several additional
reasons why you should study numerical
methods:
 They greatly enhance your problem-
PRELIMINARIES solving skills.
 Numerical methods allow you to use
1.1 Motivation “canned” software with insight.
 It enables you to design your own
programs to solve problems without
having to buy or commission expensive
software.
 Numerical methods are an efficient vehicle
for learning to use computers. Because
numerical methods are expressly designed for
computer implementation, they are ideal for
illustrating the computer’s powers and
limitations.
PRELIMINARIES  Numerical methods provide a vehicle for you
to reinforce your understanding of
1.1 Motivation mathematics.

 With these reasons as motivation, we can


now set out to understand how numerical
methods and digital computers work in
tandem to generate reliable solutions to
 The primary objective of this Session is to
provide you with a concrete idea of what
numerical methods are and how they
relate to engineering and scientific
PRELIMINARIES problem solving.

1.2 Problem
Modelling Example 1.1
Formulation and
A mathematical model can be broadly
Problem Solving
defined as a formulation or equation that
expresses the essential features of a
physical system or process in
mathematical terms.
 In a very general sense, it can be represented as a
functional relationship of the form

(1.1)

PRELIMINARIES  where the dependent variable is a characteristic that


typically reflects the behavior or state of the system;
 the independent variables are usually dimensions,
1.2 Problem such as time and space, along which the system’s
Formulation and behavior is being determined;
Problem Solving  the parameters are reflective of the system’s
properties or composition; and
 the forcing functions are external influences acting
upon it.
The actual mathematical expression of Eq.
(1.1) can range from a simple algebraic
relationship to large, complicated sets of
differential equations.
PRELIMINARIES For example, based on his observations,
Newton formulated his second law of
1.2 Problem motion, which states that the time rate of
Formulation and change of momentum of a body is equal to
Problem Solving the resultant force acting on it.
The mathematical expression, or model, of
the second law is the well-known equation,
(1.2)
where F is the net force acting on the body (N, or kg
m/s2), m is the mass of the object (kg), and a is its
acceleration (m/s2).
The second law can be recast in the format of Eq.
(1.1) to give
PRELIMINARIES (1.3)

1.2 Problem where a is the dependent variable reflecting the


Formulation and system’s behavior, F is the forcing function, and m is
a parameter. Note that for this simple case there is no
Problem Solving independent variable because we are not yet
predicting how acceleration varies in time or space.
Equation (1.3) has several characteristics that are
typical of mathematical models of the physical
world.
 It describes a natural process or system
in mathematical terms.
It represents an idealization and
simplification of reality. That is, the
PRELIMINARIES model ignores negligible details of the
natural process and focuses on its
1.2 Problem essential manifestations.
Formulation and It yields reproducible results and,
Problem Solving consequently, can be used for predictive
purposes. For example, if the force on an
object and its mass are known, Eq. (1.3)
can be used to compute acceleration.
 Because of its simple algebraic form, the
solution of Eq. (1.2) was obtained easily.
However, other mathematical models of
physical phenomena may be much more
complex, and either cannot be solved exactly
PRELIMINARIES
or require more sophisticated mathematical
techniques than simple algebra for their
1.2 Problem solution.
Formulation and To illustrate a more complex model of this
Problem Solving kind, Newton’s second law can be used to
determine the terminal velocity of a free-
falling body near the earth’s surface. Our
falling body will be a bungee jumper (Fig.
1.1).
 For this case, a model can be derived by
expressing the acceleration as the time rate of
change of the velocity (dv/dt) and substituting it
into Eq. (1.3) to yield
(1.4)
PRELIMINARIES
where v is velocity (in meters per second). Thus,
1.2 Problem
the rate of change of the velocity is equal to the
Formulation and net force acting on the body normalized to its
Problem Solving mass.
If the net force is positive, the object will
accelerate. If it is negative, the object will
decelerate. If the net force is zero, the object’s
velocity will remain at a constant level.
PRELIMINARIES

1.2 Problem
Formulation and
Problem Solving

(Fig. 1.1): Forces acting on a free-falling bungee jumper


Next, we will express the net force in terms
of measurable variables and parameters.
For a body falling within the vicinity of the
earth, the net force is composed of two
PRELIMINARIES opposing forces: the downward pull of
gravity FD and the upward force of air
1.2 Problem resistance FU.
Formulation and (1.5)
Problem Solving If force in the downward direction is
assigned a positive sign, the second law
can be used to formulate the force due to
gravity as
(1.6)
where g is the acceleration due to gravity
(9.81 m/s2).
Air resistance can be formulated in a
variety of ways.
PRELIMINARIES Knowledge from the science of fluid
mechanics suggests that a good first
1.2 Problem approximation would be to assume that it is
Formulation and proportional to the square of the velocity,
Problem Solving
(1.7)
where cd is a proportionality constant called
the lumped drag coefficient (kg/m).
Therefore, Eqs. (1.4) through (1.7) can be
combined to yield

(1.8)
PRELIMINARIES

1.2 Problem Equation (1.8) is a model that relates the


Formulation and acceleration of a falling object to the
Problem Solving forces acting on it.
It is a differential equation because it is
written in terms of the differential rate of
change (dv/dt) of the variable that we are
interested in predicting.
However, in contrast to the solution of
Newton’s second law in Eq. (1.3), the
exact solution of Eq. (1.8) for the velocity
of the jumper cannot be obtained using
PRELIMINARIES simple algebraic manipulation.
Rather, more advanced techniques such as
1.2 Problem those of calculus must be applied to
Formulation and obtain an exact or analytical solution.
Problem Solving For example, if the jumper is initially at
rest (v = 0 at t = 0), calculus can be used
to solve Eq. (1.8) for

(1.9)
 Note that Eq. (1.9) is cast in the general form of
Eq. (1.1) where v(t) is the dependent variable, t is
the independent variable, cd and m are
parameters, and g is the forcing function.
Illustration 1: Analytical Solution to the Bungee
PRELIMINARIES Jumper Problem
 Problem Statement: A bungee jumper with a
1.2 Problem mass of 68.1 kg leaps from a stationary hot air
Formulation and balloon.
Problem Solving  Use Eq. (1.9) to compute velocity for the first 12
s of free fall.
 Also determine the terminal velocity that will be
attained for an infinitely long cord.
 Use a drag coefficient of 0.25 kg/m.
Solution: Inserting the parameters into Eq.
(1.9) yields

PRELIMINARIES

1.2 Problem
Formulation and which can be used to compute the Table
Problem Solving below
PRELIMINARIES

1.2 Problem
Formulation and
Problem Solving
According to the model, the jumper accelerates
rapidly (Fig. 1.2). A velocity of 49.4214 m/s
(about 110 mi/hr) is attained after 10 s.
Note also that after a sufficiently long
time, a constant velocity, called the
terminal velocity, of 51.6983 m/s (115.6
mi/hr) is reached.
PRELIMINARIES This velocity is constant because,
eventually, the force of gravity will be in
1.2 Problem balance with the air resistance.
Formulation and Thus, the net force is zero and acceleration
Problem Solving has ceased.
PRELIMINARIES

1.2 Problem
Formulation and
Problem Solving
FIGURE 1.2: The analytical solution for the bungee jumper
problem as computed in Example 1.1. Velocity increases with time
and asymptotically approaches a terminal velocity.
Modelling Example 1.2
0

PRELIMINARIES Cannon 
Target
d

1.2 Problem Figure 1.1: Aiming a Cannon

Formulation and
Where = angle of elevation.
Problem Solving
v0= muzzle speed.
From kinematic and projectile motion, the
distance travelled by the canon ball is
obtained as follows.
(1.11)

(1.12)
PRELIMINARIES

1.2 Problem (1.13)


Formulation and
Problem Solving
(1.14)
Analysis:
When y = 0,

PRELIMINARIES

1.2 Problem
Formulation and
Problem Solving

(1.15)
Distance travelled to hit the target,

PRELIMINARIES

1.2 Problem
Formulation and
(1.16)
Problem Solving

The distance travelled by the canon ball is


given by (1.16) where g= acceleration due
to gravity.
Distance travelled to hit the target,

PRELIMINARIES

1.2 Problem
Formulation and
(1.16)
Problem Solving

The distance travelled by the canon ball is


given by (1.16) where g= acceleration due
to gravity.
In order to find the correct elevation  to
hit the target requires satisfying the
equation

PRELIMINARIES (1.17)

1.2 Problem so, we require to solve f()=0 ; where,


Formulation and
Problem Solving (1.18)
Note the following observations:
 The modelling process gives an
idealisation: Some features have been
ignored e.g. air resistance, length of the
PRELIMINARIES
muzzle. They may be significant.
1.2 Problem  The nonlinear equation may not have a
Formulation and solution. The maximum range is
when  = /4.
Problem Solving
 So, if , the target is out of range.
 The nonlinear equation may have many
solutions. If  = * is a solution, then so
is  = * +2k for any integer k. These are
trivial rotated solutions. If a solution,
PRELIMINARIES then so is
 The equation can be rearranged and solved
1.2 Problem easily as
Formulation and
Problem Solving (1.19)

(1.20)
 Aside from Newton’s second law, there are
other major organizing principles in
science and engineering.
PRELIMINARIES  Among the most important of these are the
conservation laws.
1.3
 Although they form the basis for a variety
CONSERVATION
of complicated and powerful mathematical
LAWS IN models, the great conservation laws of
ENGINEERING science and engineering are conceptually
AND SCIENCE easy to understand.
 They all boil down to
(1.24)
Change = increases - decreases
 This is precisely the format that we employed when
using Newton’s law to develop a force balance for the
bungee jumper [Eq. (1.8)].
 Although simple, Eq. (1.14) embodies one of the mos
PRELIMINARIES
fundamental ways in which conservation laws are
used in engineering and science-that is, to predict
1.3 changes with respect to time. We will give it a special
name-the time-variable (or transient) computation.
CONSERVATION
 Aside from predicting changes, another way in which
LAWS IN conservation laws are applied is for cases where
ENGINEERING change is non-existent. If change is zero, Eq. (1.14)
AND SCIENCE becomes
Change = 0 = increases – decrease
Or
(1.25)
Increases = decreases
 Thus, if no change occurs, the increases
and decreases must be in balance.
 This case, which is also given a special
PRELIMINARIES
name—the steady-state calculation—has
many applications in engineering and
1.3 science. For example, for steady-state
CONSERVATION incompressible fluid flow in pipes, the
LAWS IN flow into a junction must be balanced by
ENGINEERING flow going out, as in,
AND SCIENCE Flow in = Flow out (1.26)
PRELIMINARIES

1.3
CONSERVATION
LAWS IN FIGURE 1.5: A flow balance for steady incompressible fluid flow at the junction of pipes.

ENGINEERING
AND SCIENCE
 For the junction in Fig. 1.5, the balance
can be used to compute that the flow out
of the fourth pipe must be 60.
 For the bungee jumper, the steady-state
condition would correspond to the case
where the net force was zero or [Eq. (1.8)
PRELIMINARIES with dv/dt = 0]
(1.26)
1.3  Thus, at steady state, the downward and
CONSERVATION upward forces are in balance and Eq. (1.26)
LAWS IN can be solved for the terminal velocity,
ENGINEERING
AND SCIENCE (1.27)
 Eqs. (1.24) and (1.25) embody the two
fundamental ways that conservation laws
are employed in engineering and science.

PRELIMINARIES

1.3
CONSERVATION
LAWS IN
ENGINEERING
AND SCIENCE

You might also like