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

Icte361-Numerical Methods Lesson 1

Uploaded by

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

Icte361-Numerical Methods Lesson 1

Uploaded by

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

ICTE361-NUMERICAL

METHODS AND
ANALYSIS
LECTURE 1
Analytic Methods, Numerical Methods and Errors

Analytic method
An analytic method for solving a given mathematical problem is any
method based on rigorous mathematical analysis and whose application
leads to the true (exact) solution, also known as analytic solution.

Numerical method
A numerical method for solving a given mathematical problem is any
method based on rigorous mathematical analysis whose application, in
most cases, can only lead to an approximate (non-exact) solution, also
known as numerical solution.
Algorithms
• The methods that are developed and evaluated for computing
numerical results from given data is known as Algorithms.
• Different algorithms exist for solving the same problem.
• We chose one algorithm over the other by considering speed and
accuracy.
• There are some problem that do not have any algorithm for solving
them.
Example: Quadratic equation
• Exact method
• The exact solutions of the nonlinear equation can be obtained
using the well known quadratic formula (analytic method)
this gives the analytic solutions
Numerical algorithm: Quadratic
equation
• an algorithm

which is an iteration formula (numerical method) may


also be applied to approximate one of the two solutions
of the given quadratic equation. This method can only
give an approximate numerical solution.
Numerical algorithm: square root of
2
To find the square root of 2 to four decimal places.
• We can use the algorithm
• from which we can get or rounded to four decimal places
• Note that are all approximate numerical solution for . The more
iteration we computer, the closer are answer to the exact value of .
Some examples of Numerical
methods
•Numerical integration
 Trapezium rule

 Simpson’s rule

• Where
•Solution to non-linear equations
 Bisection method
 Newton’s method
 Secant method

•Numerical differentiation and interpolation


 Lagrange form
 Divided difference
 First-Derivative Formulas via Taylor Series
 Richardson Extrapolation
Need for numerical methods
•We need to learn numerical methods for the following three main reasons.
1. For some problems the analytical solution may not be known. A typical examples
is given by the following cases.

• Example 1.2:
• An integral, such as is perfectly defined but the anti‑derivative
of the integrand cannot be expressed using known
mathematical functions.
2. In some cases, it may be possible to find a mathematical
expression for the analytical solution of a given problem. However,
the expression may be computationally too complicated to handle
numerically.
• Example 1.3:
• A typical problem is that of finding an anti‑derivative After
some tedious manipulations involving factorization of the
denominator followed by application of the method of partial
fractions, one finds the general anti‑derivative

• where C is an arbitrary constant of integration. This complicated


result makes the evaluation of a typical associated definite
integral almost impossible to carry out with any meaningful
degree of accuracy.
Errors
•Let X * be an approximation to an exact (true) quantity
X. Then, the error in X * is defined by
•The absolute error in X * is defined by
•Relative error is defined by
•The percentage error in X * is defined by
•Example:
•Consider and
•The absolute errors in both cases are the same:
•On the other hand, the relative error is the first case is

• And the relative error in the second case is

•Thus the relative errors shows that is closer to


than is to , whereas the absolute errors give
no indication of this at all.
•Note:
Precision and Accuracy
•Precision refers to how big or how small the absolute error |X − X *|
is. The absolute error is therefore a measure of the precision of an
approximation.
•Accuracy refers to how closely the approximation X * agrees with the
true value X
•Accuracy is therefore measured by the relative error
Types of errors
•Initial errors
•Any mathematical problem meriting to be solved numerically involves some initial
data. Initial error occurs when initial date deviates from their respective true values.
Errors in the initial data can have devastating effect on the final numerical solution
to a problem.
•How to reduce initial error
•Ensure that all data given with or computed for use in solving a problem is as
accurate as is humanly possible.
•Discretization error
•The true (exact) solutions of some mathematical problems are continuous
functions y = f (x) of their respective independent variables.
•A numerical methods for solving such problems approximate the unknown
continuous solution f (x) by a sequence {f( xn)} of approximate values of the
solution at a discrete set of points { xn} in the domain of the solution function
f(x) .
•The error resulting from the selection of the constant distance (h) between two
consecutive discrete values of the variable x is called discretization error.
•How to reduce discretization error
•Discretization error can be reduced by being careful in selecting a numerical
method whose discretization error is known to be relatively small. For
example, choosing Simpsons law over trapezoidal rule in numeric integration.
•Truncation error
•This is the error in a method, which occurs because
some infinite process is stopped prematurely (truncated)
to a fewer number of terms or iterations in the process.
•How to reduce truncation error
•The truncation error can be reduced either by (a)
Choosing a numerical method with a small truncation
error or (b) Carrying out the infinite process sufficiently
far.
•Rounding error
•Rounding errors are errors introduced during numerical calculations due to
the inability of calculating devices to perform exact arithmetic. For example,
if we multiply two numbers, each with six decimal digits, the product will
have twelve decimal digits. Unfortunately some calculating devices may not
be able to display all twelve decimal digits. In such cases one is forced to
work with fewer digits thereby necessitating dropping some of the (less
significant) digits on the right of the product.
•How to reduce Rounding error
•Rounding error can be reduced by rounding off figures instead of chopping
the numbers.
•Example 1.5:
•Find the sum of the numbers 2.35, 1.48, 4.24 using a
calculating device that can only
handle numbers with two significant figures.
Solution
•The exact sum is S = 2.35 +1.48 + 4.24 = 8.07
•If we neglect the second decimal digit (chop off) from each
term and form their sum we find
the approximate sum
•The absolute error inis:

•A better approximation of S under the same limitations is to


round off the figures
The absolute error inis: . This error is significantly smaller than
Significant figures
• In computational mathematics, the words
“figure” and “digit” are synonyms.
• They are used interchangeably to mean any one
of the ten numerals in the set {0, 1, 2, 3, 4, 5,
6, 7, 8, 9}.
• In the decimal system of real numbers, a number
N is a string or an ordered sequence of figures or
digits.
• A typical example is the number
N = 00073920600365.00004507000
Which digits in a number are
Significant?
The following rules apply in deciding which digits or
figures in a given number are
significant.
1. Nonzero integers are always significant figures.
2. Any zeros on the leftmost part of a number are not significant.
3. All zero digits positioned between nonzero digits are significant.
4. Zeros at the rightmost end of a number are counted as significant only
if the number contains a decimal point.
How many Significant Figures are in
a given Number
•How many Significant Figures are in a given Number
The number of significant figures in a given number is found
using the following rule:
•Rule 1: The number of significant figures in a purely integer
number (with no decimal digits) is obtained by counting,
starting with the leftmost nonzero digit and ending with the
rightmost nonzero digit.
Example 1.5:
The number 541500409 has 9 significant figures.
The number 002507030 has 6 significant figures
• Rule 2: The number of significant figures in a
number having a decimal part is obtained by
counting all the digits, starting with the leftmost
nonzero digit.
Example 1.7:
The number 6.00213 has 6 significant figures.
The number 6.00213000 has 9 significant
figures
NOTE: All zero digits at the end of a decimal
number are significant.
Rules for Rounding Numbers
• In order to reduce the error in rounding numbers, the
rejection of digits beyond some predetermined
position (n) is accompanied by making adjustments
to the digit retained in position (n-1).
• The adjustment involves either leaving the digit in
position (n) unchanged or increasing it by one
(unity).
• The decision to retain or increase by 1 the digit
occupying position (n-1) is governed by the following
rules.
a.If the digit in position (n +1) is greater than 5
then the digit in position (n) is increased by 1.
b.If the digit in position (n +1) is 5 and at least one
other digit to its right is non zero then the digit in
position (n ) is increased by 1.
c.If the digit in position (n +1) is less than 5 then
the digit in position (n) is left unchanged.
d.If the digit in position (n +1) is 5 and all other
digits to the right of position (n +1) zero, then
i. The digit in position (n) is increased by 1 if it is
an odd number (1,3,5,7,9) ;
ii.The digit in position (n) is retained unchanged if
it is an even number (0,2,4,6,8) .
Example : Rounding a given number correct to two significant figure
S/N Number Rounded to 2 Rule Used
significant
figures
1 8.361 8.4 (a)
2 8.351 8.4 (b)
3 8.350 8.4 (d) (i)
4 8.450 8.4 (d) (ii)
5 8.050 8.0 (d) (ii)
6 8.349 8.3 (c)
7 2.55 2.6 (d) (i)
8 2.65 2.6 (d) (ii)
9 0.0557 0.056 (a)
10 0.0554 0.055 (b)
End of Lesson 1

You might also like