You are on page 1of 34

ANKARA YILDIRIM BEYAZIT

UNIVERSITY

Energy System Engineering


Department

1
Course ESE 306

Numerical Methods for


Engineers
By
Dr. Musaria Karim MAHMOOD

2
Week Topic
1 Introduction to error analysis; round-off errors, truncation errors, and total error.
2 Review of calculus: vectors, matrices and linear algebra.
3 Solving non-linear equations and estimation of errors in numerical solutions.
4 Bisection method, Regula Falsi method, Newton-Raphson method, Secant method, fixed-
point iteration method.
5 Solution of non-linear systems: Newton-Raphson method, fixed-point iteration method.
6 Solving a system of linear equations: Direct methods; Gauss elimination method, Gauss
elimination method with pivoting, Gauss-Jordan elimination method, Cramer’s rule, LU
decomposition method, solution using inverse of a matrix.
7 Solving a system of linear equations: Indirect methods (iterative methods); Gauss-Siedel
method, Jacobi method.
8 Midterm
9 Numerical integration: Rectangular, midpoint, trapezoidal and Simpson’s methods
10 Numerical method for Ordinary Differentia Equations
11 Curve-fitting methods.
12 Curve-fitting methods. Lagrange and Newton interpolation polynomials
13 Review of the course
14 Final Exam

3
Student Evaluation:

1- Homework 10 points
2- Quiz 10 points
3- Participation 5 points
4- Midterm Exam 30 points
5- Final Exam 45 points
Total= 100 points

4
Week Topic
1 Introduction to error analysis; round-off errors, truncation errors, and total error.
2 Review of calculus: vectors, matrices and linear algebra.
3 Solving non-linear equations and estimation of errors in numerical solutions.
4 Bisection method, Regula Falsi method, Newton-Raphson method, Secant method, fixed-
point iteration method.
5 Solution of non-linear systems: Newton-Raphson method, fixed-point iteration method.
6 Solving a system of linear equations: Direct methods; Gauss elimination method, Gauss
elimination method with pivoting, Gauss-Jordan elimination method, Cramer’s rule, LU
decomposition method, solution using inverse of a matrix.
7 Solving a system of linear equations: Indirect methods (iterative methods); Gauss-Siedel
method, Jacobi method.
8 Midterm
9 Numerical integration: Rectangular, midpoint, trapezoidal and Simpson’s methods
10 Numerical method for Ordinary Differentia Equations
11 Curve-fitting methods.
12 Curve-fitting methods. Lagrange and Newton interpolation polynomials
13 Review of the course
14 Final Exam

5
Lecture No. 1

Introduction to error analysis;


round-off errors, truncation
errors, and total error.

6
Lecture Outlines

1. Introduction to Numerical methods


• Definition
• Applications
• Methods
• Solving steps
• Characteristic of Numerical methods
2. Number representation
3.Error Analysis

7
Introduction:

1-1-Numerical analysis

It is the area of mathematics and computer science


that creates, analyzes, and implements algorithms for
solving numerically the problems of
mathematics. Such problems originate generally
from real-world applications of algebra, geometry,
and calculus, and they involve variables which vary
continuously.

It is the study of algorithms that use


numerical approximation for the problems
of mathematical analysis. 8
Introduction:
In Engineering, we apply mathematical models to our problems. To
have a solution, we can either use analytical or numerical methods.

1- Analytical Methods: We have an exact solution. However, it may


not be computationally feasible to obtain it. (Remember: Calculus,
Linear Algebra and Differential Equations)

2- Numerical Methods: Since we may not always have an analytical


solution and even if it exists, it may not be computationally feasible to
calculate, we need to apply some approximations and have a “close
enough” solution. These methods are called Numerical Methods.
Some Examples: Integration, Differentiation, Optimization, etc…

9
1-2- Applications:

Numerical analysis finds application in all fields of


engineering and the physical sciences. Current growth in
computing power has enabled the use of more complex
numerical analysis, providing detailed and realistic
mathematical models in science and engineering.
Examples of numerical analysis include: ordinary
differential equations as found in celestial
mechanics (predicting the motions of planets, stars and
galaxies), numerical linear algebra in data analysis,
and stochastic differential equations and Markov chains for
simulating living cells in medicine and biology.

10
• What can we solve numerically?
• Patriot system hit by SCUD missile
– position predicted from time and velocity
– the system up-time in 1/10 of a second
was converted to seconds using 24bit precision
(by multiplying with 1/10)
– 1/10 has non-terminating binary expansion
– after 100h, the error accumulated to 0.34s
– the SCUD travels 1600 m/s so it travels >500m
in this time

• Ariane 5
– a 64bit FP number containing the horizontal
velocity was converted to 16bit signed integer
– range overflow followed
Numerical Methods in Energy Systems?

Numerical
Analysis of
Energy Converter
for Wave Energy
Power
Generation-
Pendulum System
1-3 Methods:

Use computable functions p(x) to approximate the values of


functions f(x) that are not easily computable or use
approximations to simplify dealing with such functions. The
most popular types of computable functions p(x) are
polynomials, and rational functions. Trigonometric
polynomials are also a very useful choice. A given function
f(x) is approximated within a given finite-dimensional family
of computable functions.
• The quality of the approximation is expressed by a
functional, usually the maximum absolute value of the
approximation error.
• Least squares approximations.
• Interpolation. A computable function p(x) is to be chosen to
agree with a given f(x) at a given finite set of points x .
• . 13
1-4- Steps to follow in Numerical Analysis
problem solution

1. Setup a Mathematical model for the Problem,


2. Choosing a suitable numerical method and define
the required parameters,
3. Choosing a programming language to run the
algorithm (numerical method Algorithm),
4. Performing the computations,
5. Results interpretation (ex: evaluation of Error)

• . 14
1-5- Characteristics of Numerical
Methods
1. The solution procedure is iterative, with the
accuracy of the solution improving with each
iteration.
2. The solution procedure provides only an
approximation to the true, but unknown, solution.
3. An initial estimate of the solution may be
required.
4. The algorithm is simple and can be easily
programmed.
5. The solution procedure may occasionally diverge
from rather than converge to the true solution.
3- 15
Numerics is about numbers
• Numerical methods: Numerical approximation of
solutions to understood problems
• Two main objectives
– quantify errors
Approximation without error estimation is useless
– increase efficiency
Solutions which take years or need more
resources that you have are useless
• Nowadays, many fields depend on numeric
• Accuracy. How close is a computed or
measured value to the true value
• Precision (or reproducibility). How close is a
computed or measured value to previously
computed or measured values.
• Inaccuracy (or bias). A systematic deviation
from the actual value.
• Imprecision (or uncertainty). Magnitude of
scatter.

by Lale Yurttas, Texas Chapter 3 17


A&M University
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Fig. 3.2

by Lale Yurttas, Texas Chapter 3 18


A&M University
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
2-Number representation
Decimal representation

Numbers can be represented in various forms. The familiar decimal


system (base 10) uses ten digits 0, 1, ... , 9. A number is written by a
sequence of digits that correspond to multiples of powers of 10.
2-Number representation
Binary representation
However, a number can be represented using
other bases. A form that can be easily
implemented in computers is the binary (base 2)
system. In the binary system, a number is
represented by using the two digits O and 1. A
number is then written as a sequence of zeros
and ones that correspond to multiples of powers
of 2.
Computers store and process numbers in binary form.
Each binary digit (one or zero) is called a bit. Binary
arithmetic is used by computers because modem
transistors can be used as extremely fast switches.
Therefore, a network of these may be used to represent
strings of numbers with the "1" referring to the switch
being in the "on" position and "O" referring to the "off'
position.
3-Errors
Numerical solutions can be very accurate but in general are not
exact.
Two kinds of errors are introduced:

1- round-off errors: occurs because of the way that digital


computers store numbers and execute numerical operations.

2- Truncation errors: It is introduced by the numerical method


that is used for the solution. Numerical methods use
approximations for solving problems. The errors introduced by the
approximations are the truncation errors.

Together, the two errors constitute the total error of the numerical
solution, which is the difference between the true (exact) solution
and the approximate numerical solution
What is about numbers
1- Absolute Error is the numerical difference between
the true value of a quantity and its approximate
value.
2-In many cases, absolute error may not reflect its
influence correctly as it does not take into account the
order of magnitude of the value under study. For this
we introduce the concept of relative error which is
‘normalized’ absolute error.
3-The fractional form of relative error, can also be
expressed as the percentage relative error.
Example: Square Root
• To find the value of x

x0 + x = x x0 : initial estimate
x : error
x − x02
x =
2 x0
x1 = x0 + x
Generalizing, xi +1 = xi + x
x − xi2
x =
2 xi
3- 31
• Assume x=150. Because 122=144, let x0=12.
x − x02 150 − 12 2
x = = = 0.25
2 x0 2(12)

x − x12 150 − (12.25) 2


x = = = −0.00255
2 x1 2(12.25)

x − x 22 150 − (12.24745) 2
x = = = −0.12861 10 −5
2 x2 2(12.24745)

true solution : 150  12.24744871

3- 32
Numerical Based on Errors

1. If 0.333 is the approximate value of 1/3, find


absolute, relative and percentage errors.

Sol: Let the True Value (xt) = 1/3


And the approximate Value (xa) = 0.333
𝟏
∴ 𝑨𝒃𝒔𝒐𝒍𝒖𝒕𝒆 𝑬𝒓𝒓𝒐𝒓 𝒆𝒂 = 𝒙𝒕 − 𝒙𝒂 = − 𝟎. 𝟑𝟑𝟑 = 𝟎. 𝟑𝟑𝟑𝟑𝟑𝟑 − 𝟎. 𝟑𝟑𝟑
𝟑
−𝟑
= 𝟎. 𝟎𝟎𝟎𝟑𝟑𝟑 = 𝟎. 𝟑𝟑𝟑 × 𝟏𝟎
𝒆𝒂 𝟎. 𝟎𝟎𝟎𝟑𝟑𝟑
𝑹𝒆𝒍𝒂𝒕𝒊𝒗𝒆 𝑬𝒓𝒓𝒐𝒓 𝒆𝒓 = = = 𝟎. 𝟎𝟎𝟎𝟗𝟗𝟗 = 𝟎. 𝟗𝟗𝟗 × 𝟏𝟎−𝟑
𝒙𝒕 𝟎. 𝟑𝟑𝟑𝟑𝟑𝟑

% 𝑹𝒆𝒍𝒂𝒕𝒊𝒗𝒆 𝑬𝒓𝒓𝒐𝒓 𝒆𝒑𝒓 = 𝒆𝒓 × 𝟏𝟎𝟎 = 𝟎. 𝟎𝟎𝟎𝟗𝟗𝟗𝟗 × 𝟏𝟎𝟎 = 𝟎. 𝟎𝟗𝟗 %


34

You might also like