background image

NUMERICAL METHODS

NUMERICAL METHODS

AND PROGRAMMING

AND PROGRAMMING

BASIC CONCEPTS AND FIELDS OF 

BASIC CONCEPTS AND FIELDS OF 

APPLICATIONS OF NUMERICAL 

APPLICATIONS OF NUMERICAL 

ANALYSIS

ANALYSIS

Joanna Iwaniec

SHORT 

SHORT 

HISTORY OF NUMERICAL

HISTORY OF NUMERICAL

ANALYSIS

ANALYSIS

2000 years ago -

l

l

inear interpolation

inear interpolation

was already in use …

Works  of  great  mathematicians  on  numerical  analysis  →

important 

algorithms: 

Newton's 

method

Newton's 

method

Lagrange 

Lagrange 

interpolation  polynomial,  Gaussian  elimination,  Euler's 

interpolation  polynomial,  Gaussian  elimination,  Euler's 

method

method

, etc. 

Books containing formulas, tables of data such as interpolation 
points and function coefficients, making it possible to:

look  up  values  to  plug  into  the  formulas  given  and  achieve 
very good numerical estimates of some functions.

Invention of 

mechanical calculator

mechanical calculator

for hand computation.

1940s - invention of electronic computers.

background image

BASIC CONCEPTS AND 

DEFINITIONS

BASIC DEFINITIONS

BASIC DEFINITIONS

1.

1.

NUMERICAL  ANALYSIS

NUMERICAL  ANALYSIS

1

1

:

:

the  study  of  approximation 

techniques  for  solving  mathematical  problems,  taking  into  account 
the extent of possible errors.

2.

2.

NUMERICAL  ANALYSIS

NUMERICAL  ANALYSIS

2

2

the  study  of 

algorithms

for  the 

problems of continuous mathematics. Example areas of interest are:

real variable or complex variable questions, 

numerical linear algebra,

solution of 

differential equations

,

other problems arising in the physical sciences and engineering. 

3.

3.

ALGORITHM

ALGORITHM

1

1

step-by-step 

problem-solving 

procedure, 

especially  an  established,  recursive  computational  procedure  for
solving a problem in a finite number of steps

background image

NUMERICAL PROBLEM / ALGORITHM

NUMERICAL PROBLEM / ALGORITHM

NUMERICAL  PROBLEM

NUMERICAL  PROBLEM

:  clear  and  unequivocal  description  of 

functional relation between 

input data

(independent data) and 

output 

data 

(problem solution).

INPUT  /  OUTPUT  DATA

consist  of  finite  number  of  real  / 

conjugant values  and  can  be  represented  in  the  form  of  finite-
dimensional vectors.

ALGORITHM

ALGORITHM

2

:  for  a  given  numerical  problem  - a complete 

description of operations transforming vector of input data into vector 
of output data.

OPERATION

:  arithmetic  or  logical  operation  that  can  be 

performed  by  a  computer  as  well  as  calls  for  previously  defined 
algorithms.

WHY DO WE USE NUMERICAL ANALYSIS?

WHY DO WE USE NUMERICAL ANALYSIS?

Many  problems  in  continuous  mathematics  do  not  possess  a 

closed

closed

-

-

form solution

form solution

.

.

EXAMPLES

EXAMPLES

:

:

finding the 

integral 

integral 

of exp(-x

2

) , 

solving a general 

polynomial

polynomial

equation of degree five or higher.

In these situations, one has two options left:

try to find an approximate solution using 

asymptotic analysis

asymptotic analysis

,

seek a numerical solution

Th

Th

e latter choice describes the field of numerical 

e latter choice describes the field of numerical 

analysis

analysis

.

.

background image

DIRECT  METHOD

DIRECT  METHOD

:  an  algorithm  providing  the  exact 

solution of a given problem.

Examples

Examples

:

:

Gaussian elimination

Gaussian elimination

for solving 

systems of linear equations

,

simplex method

simplex method

in 

linear programming

.

For most problems no direct methods exist . In such cases 
it is sometimes possible to use an 

iterative method

iterative method

ITERATIVE  METHOD

ITERATIVE  METHOD

:  method  starting  from  a  guess 

and  finds  successive  approximations  that  hopefully 

converge

to the solution. 

Even  when  a  direct  method  does  exist,  an  iterative  method 
may be preferable because it is more efficient or more stable

DIRECT AND ITERATIVE METHODS

DIRECT AND ITERATIVE METHODS

ITERATION: 

ITERATION: 

repeating certain model activity or process. 

EXAMPLE:

EXAMPLE:

iterative  method  of  solving  equation  in  the  following 

form:

F(x

where:  F:  differentiable  function,  which  values  can  be  calculated  for 
an arbitrary value of variable (from a given band).

By the use of iterative method, starting from  initial  approximation x

0

the following sequence is calculated:

x

1

F(x

0

), x

2

F(x

1

), x

3

F(x

2

), ... 

where: x

n+1

F(x

n

): iteration.

If the sequence {x

n

} is convergent to limit value α, then:

ITERATIVE METHODS

)

(

)

(

)

(

lim

x

F

x

satisfies

x

F

x

F

n

=

=

α

background image

DISCRETIZATION

DISCRETIZATION:

DISCRETIZATION:

process 

of 

replacing 

the 

continuous problem by a discrete problem whose solution 
is known to approximate that of the continuous problem.

E

E

XAMPLE

XAMPLE

:

:

• the  solution  of  a 

differential  equation

is  a  function.  This 

function must  be  represented by  a  finite  amount  of  data, 
for instance by its value at a finite number of points at its 
domain, even though this domain is a continuum. 

NUMERICAL REPRESENTATION

BINARY SYSTEM

FLOATING POINT NOTATION

background image

NUMERICAL REPRESENTATION

 Numerical data

: written in basic units of storage made up of a fixed 

number of consecutive bits.

 The most commonly used units:

 byte (8 consecutive bits),
 the word (16 consecutive bits),
 double word (32 consecutive bits)

 Number:

is  represented  (in  each  unit  type)  by  setting  the  bits 

according to the binary representation of the number.

 Bits in a byte

are numbered, from right to left, beginning with 0. 

 The rightmost bit

(numbered 0) is called the least significant bit 

 The leftmost bit

(numbered 7) is called the most significant bit.

 Higher units

are numbered also from right to left: the rightmost bit 

is  labeled  0  and  the  leftmost  bit  is  labeled  (?  1),  where  is  the 
number of bits available.

NUMERICAL REPRESENTATION

Since each bit may have one of two values, 0 or 1, 

n

bits 

can represent 

2n

different unsigned numbers.

To represent positive or negative numbers, one of the bits 
is chosen as the 

sign bit

.

Usually,  the 

leftmost  bit

(or  most  significant  bit)  is 

considered the 

sign bit

.

In the sign bit: 

0 - positive number, 1- negative one

Similar  convention  is  followed  for  higher  storage  units, 
including words and double words.

background image

Since each position indicates a specific power of 2,e.g.:

342 = (3 × 102) + (4 × 101) + (2 × 100)

decimal  equivalent  of  a  binary  number  can  be  calculated  by  adding 
together each digit multiplied by its power of 2, e.g.:

binary  number  1011010  ↔ (1  × 26)  +  (0  × 25)  +  (1  × 24)  +  (1  × 23)  + 
+ (0 × 22) + (1 × 21) + (0 × 20) = 64 + 0 + 16 + 8 + 0 + 2 + 0 = 90 in the 
decimal system.

 Binary numbers

are sometimes written with a subscript “b” to distinguish 

them from decimal numbers having the same digits.

 In computer applications

, any binary digit, or bit, can be transmitted and 

recorded electronically simply by the presence  or  absence  of  an electrical 
pulse or current.

BINARY SYSTEM

Binary  system

:  system  based  on  powers  of  2,  in  which  only  the 

digits 0 and 1 are used. 

Floating-point notation

In computer systems, real numbers 

x

are stored as:

N

W

where: 

– mantissa  of  number  x

W  – exponent

(in  Polish: 

‘wykładnik  części  potęgowej’), 

N  – base  of  power

(in  Polish: 

‘podstawa potęgi’).

 Base N

: 2 or 10 (usually 2)

In  the  floating  point  notation  real  number  is represented  by  two 

groups of bits:

M  (0.5  ≤ <  1):  interpreted  as  fractional  part  (‘część

ułamkowa’),

W: interpreted as integer (‘liczba całkowita’)

background image

Errors of floating point notation

Assuming that: 

x  – certain number in decimal system,

x’ – floating-point representation of x

Absolute error:

|– x’| 

(‘błąd bezwzgldny’): 

 Relative error:

e

such that

x’ = x(1 + e’)

In  computer  systems  it  is  possible  to  increase  the  precision  of 

computations by usage of so called ‘

double precision

’ (

DP

).

 In  DP,  M  and  W  are  represented  by 

twice

as  many  bits  as 

normally, which reduces relative error according to relation:

e

DP

e

2

Floating-point notation

Example 1

: the following notation:

= (1)1101

(0)10

M

W

in binary system equals:

-0,1101 * 2

+10  

=  -(1/2 + 1/4 + 0/8 + 1/16) * 2

+(1*2 +0*1) =

= -3,25 

background image

GENERATION AND 

PROPAGATION OF ERRORS

GENERATION AND PROPAGATION OF 

GENERATION AND PROPAGATION OF 

ERRORS

ERRORS

There  are  several  ways  in  which  error  can  be  introduced  in  the 
solution of the problem:

Round

Round

-

-

off errors

off errors

arise because it is impossible to represent all 

real 

numbers

exactly on a 

finite-state machine

(which is what all practical 

digital computers

are).

Truncation

Truncation

errors

errors

are  committed  when  an  iterative  method  is 

terminated

and  the  approximate  solution  differs  from  the  exact 

solution. 

D

D

iscretization  error

iscretization  error

result  from  discretization  process  since  the 

solution of the discrete problem does not coincide with the solution of 
the continuous problem. 

background image

GENERATION OF ERRORS 

GENERATION OF ERRORS 

-

-

EXAMPLES

EXAMPLES

Rounding error: 

Rounding error: 

difference between the calculated approximation 

of a number and its exact mathematical value. 

In  numerical  analysis 

rounding  error

is  estimated  when  using 

approximation  equations  /  algorithms,  especially  when  using  finite 
digits to represent infinite digits of real numbers.

EXAMPLE:

EXAMPLE:

GENERATION OF ERRORS 

GENERATION OF ERRORS 

EXAMPLES

EXAMPLES

•The length of representation is unimportant. 
•If  a  representation  has  finitely  many  digits,  there  will  be  error  for 

uncountably many

real numbers. 

This kind of error is unavoidable for conventional representations of 

numbers

• The most popular ways of performing the 

termination at the limited 

digit place

:

truncation

truncation

: simply chop off the remaining digits. 

0,142857 ≈ 0,142 (

chopping

at the 5th digits.) 

rounding:

add 5 to the next digit and then chop it. 

0,142857 ≈ 0,143 (

rounding up

at the 5th digits) 

0,142857 ≈ 0,14 (

rounding down

at the 4th digits)

background image

PROPAGATION OF ERRORS

PROPAGATION OF ERRORS

Once  an  error  is  generated,  it  will  generally 

propagate

through 

the calculation. 

This leads to the notion of 

numerical stability

numerical stability

An algorithm is numerically stable if an error, once it is generated, 
does not grow too much during the calculation.

Only well-conditioned problems can be numerically stable.

The problem is said to be 

well-conditioned

if the solution changes 

by only a small amount if the problem data are changed by a small 
amount.  If  a  problem  is 

ill-conditioned

,  even  small  data  errors 

result in significant solution errors.

NUMERICAL STABILITY

NUMERICAL STABILITY

WELL

WELL

-

-

POSED PROBLEMS

POSED PROBLEMS

WELL

WELL

-

-

CONDITIONED PROBLEMS

CONDITIONED PROBLEMS

background image

NUMERICAL STABILITY, WELL

NUMERICAL STABILITY, WELL

-

-

POSED 

POSED 

WELL

WELL

-

-

CONDITIONED PROBLEMS

CONDITIONED PROBLEMS

An  algorithm  that  solves  a 

well-conditioned  problem

may  or 

may not be 

numerically stable

An art of numerical analysis is:

to  find  a 

stable algorithm

for  solving  a 

well-posed

mathematical problem. 

to find 

stable algorithms

for solving 

ill-posed problems

.

 Ill-posed  problem

solving:  finding  a  well-posed  problem 

whose  solution  is  close  to  that  of  the  ill-posed  problem  and 
solving this well-posed problem instead.

Mathematical model of a physical phenomena is 

well-posed 

(according 

to definition given by Hadamard) if: 

 Its solution exists, 
 The solution is unique, 
 The solution depends continuously on the data. 

WELL

WELL

-

-

POSED PROBLEM

POSED PROBLEM

S

S

Problems  that  are 

not  well-posed

on  the  sense  of  Hadamard  are 

termed 

ill-posed

. (Inverse problems are often ill-posed).

A  measure  of 

well-posedness

of  a  discrete  linear  problem  is  the 

condition number

If  a  problem  is 

well-posed

,    its  solution  can  be  find on  a  computer

using a stable algorithm. 

If  it  is 

ill-posed

,  it  needs  to  be  re-formulated  (

regularized

)  for 

numerical treatment (e.g. additional assumptions, such as smoothness of 
solution, should be made). 

background image

APPLICATIONS OF NUMERICAL ANALYSIS

APPLICATIONS OF NUMERICAL ANALYSIS

Algorithms  of  numerical  analysis

Algorithms  of  numerical  analysis

are  applied  to  solve  many 

problems in science and engineering, e.g. to:

 design of structures like bridges and airplanes,
 weather forecasting, climate models,
 analysis and design of molecules (computational chemistry).

Almost  all 

supercomputers

supercomputers

are  continually  running  numerical 

analysis algorithms.

Since efficiency plays an important role, a heuristic method may be 

preferred above a method with a solid theoretic foundation because it 
is more efficient. 

Generally,  numerical  analysis  uses 

empirical

empirical

results

results

of 

computation  runs  to  probe  new  methods  and  analyze  problems, 
though it of course also employs 

mathematical 

mathematical 

axioms

axioms

theorems

theorems

and 

and 

proofs

proofs

DISCIPLINES

DISCIPLINES

OF NUMERICAL ANALYSIS

OF NUMERICAL ANALYSIS

According to the problem that is to be solved, numerical analysis 

can be divided into different disciplines, e. g.:

Computing values of functions

Curve fitting

Interpolation, approximation

Solving equations and systems of equations

Optimization

Evaluating integrals

Differential equations

Solving eigenvalue problems

background image

Thank you for your attention!

Thank you for your attention!

Differential  equation

Differential  equation

:  an  equation  that  expresses  a  relationship 

between functions and their derivatives.

Polynomial

Polynomial

:  mathematical  expression  which  is  a  finite  sum,  each 

term being a constant times a product of one or more variables raised 

to powers. With only one variable the general form of a polynomial 

is:

a

0

x

a

1

n−1

+a

2

n−2

+ ... + 

n−1

a

n

where n: is a positive integer, a

0

a

1

a

2

,..., a

n

are any numbers.

Degree  of  a  polynomial:

Degree  of  a  polynomial:

in  one  variable  is  the  highest  power  of 

the variable appearing with a nonzero coefficient.

DIFFERENTIAL EQUATION / POLYNOMIAL 

DIFFERENTIAL EQUATION / POLYNOMIAL 

-

-

DEFINITIONS

DEFINITIONS

background image

CLOSED

CLOSED

-

-

FORM SOLUTION

FORM SOLUTION

E

E

quation

quation

/  system  of  equations  is  said  to  have  a  closed

/  system  of  equations  is  said  to  have  a  closed

-

-

form 

form 

solution

solution

if,  and  only  if,  at  least  one  solution can  be  expressed 

analytically in terms of a bounded number of 

well

well

-

-

known operations.

known operations.

Traditionally,  the 

well

well

-

-

known  functions

known  functions

were  limited  to  the 

elementary functions. 

EXAMPLE:

EXAMPLE:

two roots of a quadratic equation, which can be expressed 

in closed form in terms of addition and subtraction, multiplication and 
division, and square root extraction.

When  no  closed

When  no  closed

-

-

form  solutions  exist

form  solutions  exist

(e.  g.  in  case  of  5

th 

order  or 

higher  polynomial

equations),  equations  have  to  be  solved 

numerically

numerically

, typically by using some 

root

root

-

-

finding algorithm.

finding algorithm.

ASYMPTOTIC ANALYSIS

ASYMPTOTIC ANALYSIS

A

A

symptotic analysis

symptotic analysis

a method of classifying limiting behaviour, by 

concentrating  on  some  trend.  It  is  sometimes  expressed  in  the 
language of 

equivalence relations

equivalence relations

.

EXAMPLE

EXAMPLE

:  given  complex-valued  functions  and  of  a  natural 

number variable n, one can write

:

This  defines  an  equivalence  relation;  and  the  equivalence  class  of  
consists of all functions with similar behaviour to f, in the limit.

to express the concept that