Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
12 views

LEC 1 Introduction

Uploaded by

ii76iiq
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

LEC 1 Introduction

Uploaded by

ii76iiq
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Engineering College Chemical Engineering Dept.

Chapter -1-
Numeric analysis
or briefly numeric has a distinct flavor that is different from basic calculus,
from solving ODEs algebraically, or from other (nonnumeric) areas. Whereas
in calculus and in ODEs there were very few choices on how to solve the
problem and your answer was an algebraic answer, in numeric you have many
more choices and your answers are given as tables of values (numbers) or
graphs.
Numeric provides an invaluable extension to the knowledge base of the
problem-solving engineer. Many problems have no solution formula (think of
a complicated integral or a polynomial of high degree or the interpolation of
values obtained by measurements). In other cases, a complicated solution
formula may exist but may be practically useless. It is for these kinds of
problems that a numerical method may generate a good answer. Thus, it is
very important that the applied mathematician, engineer, physicist, or scientist
becomes familiar with the essentials of numeric and its ideas, such as
estimation of errors, order of convergence, numerical methods expressed in
algorithms, and is also informed about the important numeric methods.
1.1 Introduction
As an engineer or physicist, you may deal with problems in elasticity and need
to solve an equation such as 𝑥 cosh 𝑥 = 1 or a more difficult problem of
finding the roots of a higher order polynomial. Or you encounter an integral
such as
2
∫ 𝑒 −𝑥 𝑑𝑥

that you cannot solve by elementary calculus. Such problems, which are
difficult or impossible to solve algebraically, arise frequently in applications.
They call for numeric methods, that is, systematic methods that are suitable
for solving, numerically, the problems on computers or calculators. Typical
numeric methods are iterative in nature and, for a well-chosen problem and a
good starting value, will frequently converge to a desired answer.
to an approximation suitable for numeric to a final answer usually requires the
following steps:
1
Engineering College Chemical Engineering Dept.

1. Modeling. We set up a mathematical model of our problem, such as an


integral, a system of equations, or a differential equation.
2. Choosing a numeric method and parameters (e.g., step size), perhaps
with a preliminary error estimation.
3. Programming.
4. Programming.
5. Interpreting the results in physical or other terms, also deciding to
rerun if further results are needed.

1.2 Roundoff
An error is caused by chopping discarding all digits from some decimal on)
or rounding. This error is called roundoff error, regardless of whether we chop
or round. The rule for rounding off a number to k decimals is as follows
Roundoff Rule. To round a number x to k decimals, and 5 ∗ 10−(𝑘+1) to x
and chop the digits after the (k +1)st digit.

EXAMPLE 1: Roundoff Rule


Round the number 1.23454621 to (a) 2 decimals, (b) 3 decimals, (c) 4
decimals, (d) 5 decimals, and (e) 6 decimals.
Solution. (a) k=2
5 ∗ 10−(2+1) = 0.005
that is, 1.2345621 + 0.005 = 1.23954621
Then we chop off the digits “954621” after the space or equivalently
1.2345621 − 954621 = 1.23
(b) 1.2345621 + 0.0005 = 1.2350462 so that for 3 decimals we get 1.234.
(c) 1.23459621 hopping give us 1.2345 (4 decimals).
Chopping is not recommended because the corresponding error can be larger than that
in rounding.

2
Engineering College Chemical Engineering Dept.

1.3 Loss of Significant Digits


This means that a result of a calculation has fewer correct digits than the numbers from
which it was obtained. This happens if we subtract two numbers of about the same size,
for example,
0.1439 - 0.1426
(“subtractive cancellation”). It may occur in simple problems, but it can be avoided in
most cases by simple changes of the algorithm— if one is aware of it! Let us illustrate
this with the following basic problem.
EXAMPLE 2: Quadratic Equation. Loss of Significant Digits
Find the roots of the equation
𝑥 2 + 40𝑥 + 2 = 0
using 4 significant digits (abbreviated 4S) in the computation.

solution. A formula for the roots of a quadratic equation


𝑎𝑥 2 + 𝑏𝑥 + 𝑐 = 0 (1)
1
x1 = (−𝑏 + √𝑏 2 − 4𝑎𝑐 (2)
2𝑎
1
x2 = (−𝑏 − √𝑏 2 − 4𝑎𝑐 (3)
2𝑎
𝑐
Furthermore, since x1 x2 = another formula for those roots
𝑎
𝑐
x1 = (4)
𝑎x2

We see that this avoids cancellation in x1 for positive b


𝑐
If b < 0 calculate x1 from (2) and then x2 =
𝑎x1

Hence x2 = −20 − 19.95, involving no difficulty, and x1 = −20 + 19.95 = −0.05


poor value involving loss of digits by subtractive cancellation.
2
In contrast, (5) gives x1 = = −0.05006 the absolute value of the error being less
−39.95
than one unit of the last digit, as a computation with more digits shows. The 10S-value
is - 0.05006265674.
3
Engineering College Chemical Engineering Dept.

1.4 Errors of Numeric Results


Final results of computations of unknown quantities generally are approximations; that
is, they are not exact but involve errors. Such an error may result from a combination
of the following effects. Roundoff errors result from rounding, as discussed above.
Experimental errors are errors of given data (probably arising from measurements).
Truncating errors result from truncating (prematurely breaking off), for instance, if
we replace a Taylor series with the sum of its first few terms. These errors depend on
the computational method used and must be dealt with individually for each method.
Formulas for Errors. If is an approximate value of 𝑎̃ quantity whose exact value is
a, we call the difference
ϵ = 𝑎 − 𝑎̃
Th error of 𝑎̃
𝑎 = 𝜖 + 𝑎̃ , true value = Approximation + Error.
For instance, if 𝑎̃ = 10.5 is an approximation of a=10.2, its error is ϵ =-0.3
In the literature |𝑎 − 𝑎̃| (“absolute error”) or 𝑎 − 𝑎̃ are sometimes also
used as definitions of error.
The relative error ϵ𝑟 of 𝑎̃ is defined by
𝑎 − 𝑎̃ 𝐸𝑟𝑟𝑜𝑟
ϵ𝑟 = =
𝑎 𝑇𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒
This looks useless because a is unknown. But if is much less than 𝑎̃ then we can use 𝑎̃
instead of a and get
𝑎 − 𝑎̃
ϵ𝑟 ≈
𝑎̃
This still looks problematic because is unknown. But what one often can obtain in
practice is an error bound for 𝑎̃ that is, a number such that
|ϵ| ≤ 𝛽
This tells us how far away from our computed the unknown a can at most lie. Similarly,
for the relative error.

4
Engineering College Chemical Engineering Dept.

1.5 Algorithm. Stability


Numeric methods can be formulated as algorithms. An algorithm is a step-by-step
procedure that states a numeric method in a form (a “pseudocode”) understandable to
humans. The algorithm is then used to write a program in a programming language that
the computer can understand so that it can execute the numeric method. Important
algorithms follow in the next sections. For routine tasks your CAS or some other
software system may contain programs that you can use or include as parts of larger
programs of your own.
The algorithm is then used to write a program in a programming language that the
computer can understand so that it can execute the numeric method. Important
algorithms follow in the next sections. For routine tasks your CAS or some other
software system may contain programs that you can use or include as parts of larger
programs of your own.
To be useful, an algorithm should be stable; that is, small changes in the initial data
should cause only small changes in the final results. However, if small changes in the
initial data can produce large changes in the final results, we call the algorithm unstable.
This “numeric instability,” which in most cases can be avoided by choosing a better
algorithm, must be distinguished from “mathematical instability” of a problem, which
is called “ill-conditioning,” a concept we discuss in the next section.
Some algorithms are stable only for certain initial data, so that one must be careful in
such a case.

You might also like