0% found this document useful (0 votes)
310 views13 pages

Numerical Methods for Engineers

The document provides an introduction to numerical analysis and error analysis concepts. It outlines the course, which will cover introduction to MATLAB, error analysis, solving nonlinear and linear equations, interpolation, curve fitting, numerical differentiation and integration, and solving differential equations. It then defines sources of error in numerical methods as round-off error from limited precision arithmetic and truncation error from approximating infinite series. Examples are given to illustrate absolute and relative error, rounding vs chopping, loss of significance from subtraction, and impact of limited precision on results.

Uploaded by

Hero Mode
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)
310 views13 pages

Numerical Methods for Engineers

The document provides an introduction to numerical analysis and error analysis concepts. It outlines the course, which will cover introduction to MATLAB, error analysis, solving nonlinear and linear equations, interpolation, curve fitting, numerical differentiation and integration, and solving differential equations. It then defines sources of error in numerical methods as round-off error from limited precision arithmetic and truncation error from approximating infinite series. Examples are given to illustrate absolute and relative error, rounding vs chopping, loss of significance from subtraction, and impact of limited precision on results.

Uploaded by

Hero Mode
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

9/11/2022

:
Chapter One

References
 John H. Mathews & Kurtis D.
Fink, Numerical Methods Using
MATLAB, 4th edition (2004).

 Richard L. Burden & J. Douglas


Faires, Numerical Analysis, 9th
edition (2011).

Noha Medhat 2

1
9/11/2022

Course Outline
 Introduction to MATLAB (in the lab).
 Error Analysis.
 Solution of Non-linear Equations.
 Solution of Linear Systems.
 Interpolation
 Curve fitting
 Numerical Differentiation and Integration.
 Solution of Differential Equations.

Noha Medhat 3

Means of solving problems


 Analytical methods: exact solution.
 Numerical methods: approximate solution.

Why numerical methods?


 There are many problems which have not exact solutions:
1. Polynomial equations of degree > 4
2. Simple equation such as 𝒙 = 𝐜𝐨𝐬(𝒙)
𝒃 𝟐 𝒃 𝐬𝐢𝐧(𝒙)
3. Integrals of type ‫ 𝒙𝒅 𝒙𝒆 𝒂׬‬and ‫𝒂׬‬ 𝒅𝒙.
𝒙

Noha Medhat 4

2
9/11/2022

What is numerical analysis?


 Numerical analysis is concerned with the mathematical
derivation, description and analysis of techniques that are used
to obtain numerical solution of mathematical problems.

 These techniques use arithmetic operations {+, -, /, *} that can


be performed by a computer to give approximate but accurate
solution.

 This approximate solution satisfies a prescribed accuracy.

Noha Medhat 5

Error analysis
Why do we measure errors?
1. To determine the accuracy of numerical results.
2. To develop stopping criteria for iterative algorithms.
Accuracy:
It describes how close an approximation is to a true value.
We describe it using either absolute error or relative error.
Precision:
It describes how many significant digits we use to approximate
a particular value.
It also refers to how closely individual computed values agree
with each other.

Noha Medhat 6

3
9/11/2022

absolute
error

Noha Medhat 7

Example 1

Noha Medhat 8

4
9/11/2022

Example 2
Determine the absolute and relative errors:
• 𝑝 = 3 𝑎𝑛𝑑 𝑝ො = 3.1
𝐸𝑝 = 0.1, 𝑎𝑛𝑑 𝑅𝑝 = 0.0333

• 𝑝 = 0.3 × 10−3 𝑎𝑛𝑑 𝑝ො = 0.31 × 10−3


𝐸𝑝 = 0.1 × 10−4 , 𝑎𝑛𝑑 𝑅𝑝 = 0.0333

• 𝑝 = 3000 𝑎𝑛𝑑 𝑝ො = 3100


𝐸𝑝 = 100, 𝑎𝑛𝑑 𝑅𝑝 = 0.0333

This example shows that the same relative error occurs for
widely varying absolute errors.

Noha Medhat 9

Scientific Notation
It is a standard way to present a real number as
𝒑 = 𝒎 × 𝟏𝟎𝒏

Significand/Mantissa Exponent

 0.0000747= 𝟕. 𝟒𝟕 × 𝟏𝟎−𝟓

 9, 𝟕𝟎𝟎, 𝟎𝟎𝟎, 𝟎𝟎𝟎 = 𝟗. 𝟕 × 𝟏𝟎𝟗

 4𝟏𝟒. 𝟓𝟔𝟕 = 𝟒. 𝟏𝟒𝟓𝟔𝟕 × 𝟏𝟎𝟐

Noha Medhat 10

10

5
9/11/2022

Significant Digits
Significant digits are the digits of a number that are
meaningful in terms of precision. They include:

 Any non-zero digit as 31 (2) or 125.1 (4)

 Zeros between non-zero digits as in 3003 (4) or


45.60009 (7)

 Trailing zeros only when there is a decimal point as in


50.00 (4) or 27.300 (5)

Noha Medhat 11

11

Non-Significant Digits
Digits of a number are not significant when they do not add
information regarding the precision of that number. They
include:

 Leading zeros as in 𝟎. 𝟎𝟎𝟐𝟑 = 𝟎. 𝟐𝟑 × 𝟏𝟎−𝟐 (2)

 Leading zeros as in 𝟎. 𝟎𝟓𝟓𝟎 = 𝟎. 𝟓𝟓𝟎 × 𝟏𝟎−𝟏 (3)

 Trailing zeros when no decimal point is present as in


𝟒𝟓𝟎𝟎 = 𝟎. 𝟒𝟓 × 𝟏𝟎𝟒 (2)

Noha Medhat 12

12

6
9/11/2022

Sources of errors
Two sources of numerical error:
 Round-off error.
 Truncation error.

Round-off Error:
A computer’s representation of real numbers is limited to
the fixed number of digits of precision (finite-digit
arithmetic).
1
≈ 0.3333 …
3

2 ≈ 1.4142 …

Noha Medhat 13

13

 Round-off errors are introduced and propagated in


successive computations.
Rounding method
Consider a real number that is expressed in the following form:
𝒑 = ±𝟎. 𝒅𝟏 𝒅𝟐 𝒅𝟑 … 𝒅𝒌 𝒅𝒌+𝟏 … × 𝟏𝟎𝒏

𝒇𝒍𝒓𝒐𝒖𝒏𝒅 𝒑 = ±𝟎. 𝒅𝟏 𝒅𝟐 𝒅𝟑 … 𝒓𝒌 × 𝟏𝟎𝒏


where
𝒓 𝒌 = 𝒅𝒌 𝒊𝒇 𝒅𝒌+𝟏 < 𝟓

Or 𝒓 𝒌 = 𝒅𝒌 + 𝟏 𝒊𝒇 𝒅𝒌+𝟏 ≥ 𝟓

Round 21.867 to one decimal place : 21.9


Round 1.143 to two decimal places: 1.14
Noha Medhat 14

14

7
9/11/2022

Chopping method
It is done by discarding a part of the number 𝒅𝒌+𝟏 …
𝒑 = ±𝟎. 𝒅𝟏 𝒅𝟐 𝒅𝟑 … 𝒅𝒌 𝒅𝒌+𝟏 … × 𝟏𝟎𝒏
𝒇𝒍𝒄𝒉𝒐𝒑 𝒑 = ±𝟎. 𝒅𝟏 𝒅𝟐 𝒅𝟑 … 𝒅𝒌 × 𝟏𝟎𝒏

Chop 21.867 to one decimal place : 21.8


Chop 1.143 to two decimal places: 1.14

Example 3
𝒑 = 𝟐𝟐Τ𝟕 = 𝟑. 𝟏𝟒𝟐𝟖𝟓𝟕𝟏𝟒𝟐𝟖𝟓𝟕𝟏𝟒𝟐𝟖 ⋯
For six-digit arithmetic representation:
𝒇𝒍𝒓𝒐𝒖𝒏𝒅 𝒑 = 𝟑. 𝟏𝟒𝟐𝟖𝟔
𝒇𝒍𝒄𝒉𝒐𝒑 𝒑 = 𝟑. 𝟏𝟒𝟐𝟖𝟓

Noha Medhat 15

15

Truncation Error:
 It is introduced when a complicated mathematical expression
is replaced with Taylor polynomial (series).

 The term truncation error in the Taylor polynomial refers to


the error involved in using a truncated, or finite summation
to approximate the sum of an infinite series.

Noha Medhat 16

16

8
9/11/2022

𝒙𝟎 𝒙

S. C. Chapra, Applied Numerical Methods for Engineers (7th edition)

Noha Medhat 17

17

Some examples of Taylor polynomials about 𝑥0 = 0


𝒙𝟐 𝒙𝟑
𝒆𝒙 = 𝟏 + 𝒙 + + +⋯
𝟐! 𝟑!

𝒙𝟑 𝒙𝟓 𝒙𝟕
𝐬𝐢𝐧 𝒙 = 𝒙 − + − +⋯
𝟑! 𝟓! 𝟕!

𝒙𝟐 𝒙𝟒 𝒙𝟔
𝐜𝐨𝐬 𝒙 = 𝟏 − + − + ⋯
𝟐! 𝟒! 𝟔!

Noha Medhat 18

18

9
9/11/2022

Example 4

𝑝 − 𝑝ො
𝑅𝑝 = = 7.03442 × 10−7
𝑝
J. H. Mathews & K. D. Fink, Numerical Methods using MATLAB (4th edition)

Noha Medhat 19

19

Loss of significance
(Subtractive Cancellation)
 It occurs when two nearly equal numbers are subtracted to
produce a result much smaller than the original numbers.

 The effect is that the number of significant digits in the


result is reduced (reduction in the precision).

 Consider p = 3.1415926536 and q = 3.1415957341, which


are nearly equal, and both carry 11 decimal digits of
precision,
p – q = – 0.0000030805 = 𝟎. 𝟑𝟎𝟖𝟎𝟓 × 𝟏𝟎−𝟓 , the difference
contains only five decimal digits of precision.

Noha Medhat 20

20

10
9/11/2022

Example 5
Compare the results of calculating 𝑓(500) and g(500) using six
digits rounding arithmetic.
Exact value is 11.174755300747198 (g involves less error)
𝒙
𝒇 𝒙 =𝒙 𝒙+𝟏− 𝒙 , g(𝒙) =
( 𝒙 + 𝟏 + 𝒙)

Noha Medhat 21

21

Example 6

Using four digits arithmetic in the rounding:

Subtraction of nearly
equal numbers :
0.04000 𝒃 ≈ 𝒃𝟐 − 𝟒𝒂𝒄

Noha Medhat 22

22

11
9/11/2022

−0.01611 + 0.02000
≈ 0.2415
−0.01611
For 𝒙𝟐

0.3222 × 𝟏𝟎−𝟑

(b > 0)
Noha Medhat 23

23

Subtraction of nearly equal numbers

0.04000
0.1946

For (b < 0) and 𝒃 ≈ 𝒃𝟐 − 𝟒𝒂𝒄

Noha Medhat 24

24

12
9/11/2022

Propagation of Errors
 In numerical methods, the calculations are not made with
exact numbers.

 Addition of two numbers p and q (true values) with the


ෝ and 𝒒
approximate values 𝒑 ෝ which contain errors 𝝐𝒑 and 𝝐𝒒
respectively.

ෝ + 𝝐𝒑 + 𝒒
𝒑+𝒒= 𝒑 ෝ + 𝝐𝒒 = 𝒑
ෝ+𝒒
ෝ + 𝝐𝒑 + 𝝐𝒒

ෝ+𝒒
𝒑+𝒒 − 𝒑 ෝ = 𝝐𝒑 + 𝝐𝒒

Noha Medhat 25

25

Propagation of Errors
 Multiplication

𝝐𝒑 𝝐𝒒
ෝ /𝒑 ≈ 𝟏, 𝒒
For good approximations: 𝒑 ෝ/𝒒 ≈ 𝟏, and 𝑹𝒑 𝑹𝒒 = ≈𝟎
𝒑 𝒒

Noha Medhat 26

26

13

You might also like