Math. Notes

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

a

IEC 9 13 numerical methods to solve problems that can't be solved otherwise


using
.

LEC 1 Mathematical modelling numerical methods &


problem
. ,
soling

Example Bungee sep of varables


Jumper using
:

want v(t)
Analy tical Method :

V Li
e

g
=
-

↑F F =
ma a =

A
=
d my-e"
&
Let a e
m der
=

F =

cht
Fr :

Case

Fu Is = a"-rn fixdx=Etantte
=
-

mg
-

Mee
Jane
& 9 81 M/52

flat
=
.

dr =

= -Let 12 t =
0 ,
v =
0


.

Itunk" It +
1 =
+ d if d -c =

f
·
Diffrential Equation

I tanb =

Cut f =
0

Numerical Method = tank (Catal

: g-GI Em :
:

Enter
v =

tank) It e
ti +
n
-
ti
rct) :
tank (Natt
a g-Ca e

-
=

v Vi (g -GV) (t ti)
I
-
=

+
n -
+1

Vi

+1 i

Vict
-
=

ti t = + n

new value = old value + Slopex Step size Euler's method

Vi +
1
=

Vi +
xxt

.
a Calculate v for first 125 At = 28
M = 68 .
1 kg 2 . Terminal velocity

C =

0 25
.

kg/m & F =
P

rubbweene
2
g =
9 81 Mys
my
=
< dV
n
.

e

v
=

E = 51 6938 .

Ni

Vi +
1
=
gar
-

IF =

my
-

CV =
ma a
A
in
e

g-C
- so ,

(ti
=

w Vi +
1
=
Vi + + 1
-

ti)

jur If 68 Ca
Euler's Method

m
1kg 0
25kgsm At 2 secs
= =

, . . =
Vi =
0

V= =
(0) +
(9 . 81) (2) =
19 62.

= 9.
81.
V3 =
19 62.
+
(8 397)(2) .
=
36 4).

e
V =
36 41 .
+
(4 942)(2) .
=
46 29 .
d =
9 81 -0
.
.

2a
.

V =
46 29
+
(1 . 942)(2) =

50 174
.

=
.

DIFFRENTIAL EQUATIONS REVIEW

SERERABLE
Y' =
f(x) gcy) ·

function of function
a a
multiplied by a of
y

Solving Steps

1 * =

f(x)q(y)

2
=

fix) -
de

3
gydy= /fix) dx

4 Solve for
.
y
LEC 9 15
.

Analytical Solution

, t
e)
= -
kA A =
4 + r3

*
V =

Exes
k =
0 .
08 mm/mm

A Area
-
=

*3
Numerical Solution
f = -
k4x ( )

I
t
fat
A 25 *
1
0

()
= . min

Wi +
1
=
vi +
(at) ar = - k4x
12/3
Va
=

65 45 -
6 283(0 25) .
= 63 87 .
o =
-
k4x(2 5 .

*
. .

V2 =
63 88.
-
6 182(0 25)
.
.
= 62 33 .
=
6 .
283 3V" =
-
k4x() t +

>

d
-
(B
+ (0) 2 5mm
=

= - 2 . 49 .

=
-0 .
129k +
C

"(0) =
65 45 .
=

c
as

5
.

A Entrain Fart-mgocio- matt V ( 129t +

65 45)


=
-
0 .
.

E =

g -
I
v
Fa my
=

Analytical Solution Numerical Solution At =


2

d
e
g
=

Vi
-

At

/gar
k +

fat
1
=

v
g c
=
-
=

19 62
V1 9 81 2 =
0
=
.
+ .
.

du = dV 6 496 2 32 613
V 19 62
=
+
-
.
.
= .

Edr= t
V3 =
32 .
613 +
4 302 .
- 2
=
41 218 .

Ing- ) =
t +
2 VC0) = 0

↓ (n(g) c c 13 5
= = -
- -
.

st x)
In
(g )
+
= -
-

- + +
c)
e
=

-
g
(eact )
x
g)(
+

v
=

(Ing
"e-
jent g)(
-
)
-

v = -

+
(e
-

v =

1) -
1 9
.

- =

Q ,
Qo
Q, 3 Qusint
3 450s ,t
=

- -
~
A = 1250m2
- =
.
-
450
> W
y 0
=
-

↓ >

-> Q0 450mY
=

- day
LE> 4 9 . 20

- +

ERROR

Accuracy - how
closely the computed value
agrees
with the true value

Precision how closely values other measured values


agree with
->

ERROR TRUE VALUE APPROX


magnitude
= -

does not take into account order of


.

True Fractional ERROR


Relative Error
Et =

TRUE VALUE treprent = E


x 10

we cannot calculate Error if we don't know the true value

for an iterative method ,

&ELATIVE
Sa Reprox
Previous approx
-
=
ERROR

present approx

Es the iteration
stopping value we stop once
EaLEs
=

Es 102 -u of
significate
sthenumber
0 5

where
x
=

STOPPING CRITERION

eX .
2 =
1 +
x +

2 + ... +
maclaurin series expansion of ex

approximate e. 5 Terms approx


.
et La 1approx-

= =
x 100 %
. 6487
1
True value 1 6487 I 1 %
=

39 3
.

approx : approx : -1
1 33 2 %
-

2 5 9 02 % 2a
=
.

100 %
.
.

- x

approx ·

3 1. 625 1 44 % 7 69 %
If we wanted sol. correct to
1 .
.

2
sig figs W

&

Es =
0 .
5x10-2 %

Es =
0 . 5 % ->
stop when Ea<0 .
5 %
Round-off Errors computer's handle numbers
inability to large
->
, exac t

Truncation Errors ->


caused by approximations

Series Expansion
Taylor

conver t difficult functions into an approximated polynomials



2X-

enx =

Co +21x +
crx +

cyx+ ... +
an infinite series of a
polynomial

may only apply


f(x)
on a

1 Prcx) a polynomial of order m

certain Interval

Cy x Cmx
Pm(X) Co +
+ ... +

x
+
=
,

fix . )
=

Pic x
P1(x) =

P(Xo) +

f(x)(x -

x0)

f(x) fico)(x xo)

I
P1(x) 41(x) =
+ -

i P(Xo) =
f(x)
-
-

No I

P2(x) =

f(x0) +
f(x)(x x0) ,
- +

z(x - x. )

fix :Inx if Xo =
1

enxo + (x-x )
P1(x)
!
=

P1(x) =
x -
1

f(x) =
4nx) at x =
No

f(x) (x-x0) Cz(x-xr)


Exox-x
Co +2 ,
-..
= +

Paxs
=

Co
2<t0)+
=

f(x) Co C , (0)
+ ...
=
+

-
2202 + 6 C > (0) +
=
2C .
POLYNOMIAL of a
C, TAYLOR
f(x)
= +

62s(0) + =
C2
f"(xr) =
22 +

f(x0)
Prix) f(x) <x-xoL
Exocx-x
=

6 C3
+ +

f"(xo) =

c =

f(x0)
I
ex .
Maclavin series expansion of 1Ex

fix) = f(o) +
fico)cx) +

fOLx+ ...

Taylor Series Expansion of f(x) :


cos(X) No cosC)= ?

f(x) =
cos(X.) -simXo(x-) -

co (*-
.

+ *- + -
"

Error Calculation

Terms approx Et Ea

1 0 .
707 41 4 % .

2

Maclaun Series of f(x) =

ex

f(x) = e4 +
exx-x0) +

2 x -x +

Exxo
=
1 +
x +

E +

+ ...

TU 9 21
-

Problems A

- 4t
e 1
y zy y(0)
=
+
= z -

y ext At 1
2
2y
=
0
=
-
- -

1
yo
=

y: + 1
=

yi
+

y =
0 .
1

1) 1 (2-2(1) -
1)0 1 =
0 9
y10
.
=
+
.
.

(2 2)0 9) - i4(0 .

1))0 1
=
0 . 853
y(0 2) a
= . .

0
-
+
.
.

3)
=

0 853 +
(2 -
2(0 853) - =
x(0 .

2))0 . 1
=
0 . 837
y(0
.
.
.
Problem
Exx )
2

fixx= I -
x ·

f(x) =

Inx f(z) =

Xo = 1 Py(x) = (x -
x. )+ ·
*
x -
x - ) +
Ex-x!

Ex- fix-xo
*
+ x
.
" +

(n2 =
0 . 693

P2x) en1 1(x 1) 1 <x-1"-6cx 1)


1x
= +

2
- -
-
- +

3 ! ↓

ORDER f(x) ERROR f(x) =


lax
ERROR
O
W 100 %
fixs E
/ Roxx
= =

44 2 % ==
=

100
1 1 x2 1
.

f"(x)
-
=
= -

2
A

27%
2 0 . 5 fixx) = 2x3 =

E
*
833 %
f4(x) =
-
6 = -

3 0 20 2
.
+
.

0 583 15 9 %
C .
.
LE) 9 22
.

f(x) =
Pm ,
a(X)

f(x) Pm acx) + Rm CX) to the


equal tayher
=

, ,
expansion

Plus the remander

Rm acx)
te
*
(x-al
-

left
,
whatever by truncation
+
...
out

f(x)
R
↑ Rim ,
alx f(a) =
Pcal

4m , a(x)
(f(x) Pmax)) Rma(x)

:
=
-

2

Determine max R(x) value between an interval [a, b]

f(cl =

Pu ,
a
(4)
proof
by a P2 a(x) ,

fical Pi n (a)
fal f(ascx-a)
=

Pr a(x) ficalcx-a)"
, =

+ +

,
11

f"cal =

Pr a(a)
,
2 !

Piacx) fas fas <x-al


:
:
+

fa) =

Pra(al
P2" ,
a(x) =

f"cal

D2 a(x)
=
0

1
,

Rm 14),
:
/ franx) -

Paal *

Rim acx)
,
=
1 final -

Piax)/ P2 a(a)
,
=

f(x) + 0 + 0

:
P2 ,
a(a)
=
fica) + 0

RY n(x) ,
=
/fex) -

Dax) P2 ,
a(a)
=
f"(n)

Racx)=/fcx) -
01
pat = 0 -> a constant
Run (x)
=
If a ce

IR*a (xs) = M M is the maximum value of


for (*)

fRinncx) /Mdx
-> 19R"(x) dx) = /IR x) dx

I /Rnacx) dx) =
/Mdx
23 -
Fal =
0

1RMa(xl) = Mx + > - >


Racas :

/Racx)) <falx -
a) 0 =
Ma
Ma
+ >

CI -

IR* cast =
Ma +
>
C = -Ma ->
max val of 6

/IRmacx1l</MEa
↳ cho -> a = 0

IR* x) =
ME +
s

:
M will
usually either be at

IRmaSxL) ME
a or b ,
=

TAYLOR'S REMAINDER THEOREM


f(x) = cosx No = f() =

fixconor-ancaa co? -Yo"+


xx-xo+ a xx-x. e

Remainder

Because remainder is an infinite series ,


no number but can bound .

/Race in the I
M= max value of

F(x) =
Pcx) +
Raxs
n

f(x) =I

I where
There must be some point

Eis
n+ 1

1 cas1 .
=

=Y


f(x) =
0
=

?
a
=

x
=

0 .
1

f(x) =
P2(x)

P2(X) =
1 +

Ex- *
- 5
↳ =
5x10
P2(0 1)
+

.
= 1 .
04875

Racesl=(Emal) 2 -
10 ,
0 .
1)

=) 10 .

17
f"(x) =(x
42
(R2(x>)
-

=
+
1)

6 25x185
finax (X) at x = 0 -
.

since
*I
:
Euler's

V(t) Vct=)(ti ti) R1


vitz-t e
Vi
-
+
+

+
=

R ,
=

Va
rict :
+
ti +
- t
:

Forward
difference
approximation · A
V
-
plus an error
-
error

therefore

the
is

,
proportional

smaller
smaller

the
the
to

error
step
k

will
size

be
* t

Derivation of Backward Difference Approximation

f(x : )
fix.) fi
-

k
=

+
error &
xi +
1
-
x:

f(x) =
f(xi) - f(x - 1) +
- BDA

begin with TaylorexpX =

Xc-1 a =
X:

f(xi - 1) =
f(x) f(x)(xi-xi) +

fix -
-
x- )

fix)
A fair f?
:
(xi-1- xi) same as FDA

x < 3, xi +
1
DA ficxi) f(x f(x = -1)
:
Centered =

=
+
) -
-
CDA

f(xix
m
+ x2 x)
f(xi 1) f(x f(x)(xi x (x ↳ -
+

1
+ -

i
+ = +

f(x
fixi
-
: - 1)
=

f(x) -
f(x)xi -
+
x- +

-
1
+

xi) - 3
xi + xi)
-

fi) I
2 2

(f (3 )
↓ -
k

f(x) f(x= f(x)(x : 1)


+

1)
=

0 +
+
1 -

xi - + 0 + ,

-
MVT
by A "c cTal

faifixieties of" sh
fIC3)
fixit
:

+
2

erro a
xi +
b -
xi - 1
LEC 10 4 .

Forward Difference Approximation

fam-fix)
h
fix = , envorom order of h

·
divide h , divede Error
by h

Backward Difference Approximation

fix: faxis-f(x)
L
+
Ei o(h)

Centre Difference Approximation

fax :
ficx. =

fat -
Be OCh

· drude ↳ divide er ror

f(x)
*
ex .
f(x) = -0 . 1x -0 . 15x3-0 5x . - 0 25+
.
1 .
2 at x =
0 . 5

xi 1
x= 0 5 x = -1 0
f'(0
=
=
1 True value 5)
=

9125
. +
, = -0 .
.

f(x : 1) =
1 2
f(xi 1) f(0 25)
.
-

1 1035
=
=
.
.
-

f(x : ) 0 925
f(x)
=

f(0
.

. 5) =
0 . 925

f(xi + 1) =

0 . 2
f(x: 1) =

f(0 >5) .
=
0 636
+ .

0 925
-
f'(0 5)
=

Forward . = 1 .
45
h =
0 - 25

h = 0 5
.
0 . 5

f(0 5) : -2925= -1 155

a5
.

-0
.
.

/
25
x 100 % 58 % 0
Ex
.
=
=

Et 26 5%
2
=

Backward f 'co 5) .
:

a = -0 .
5
f'(0 . 5) = 0 . 925-1 1025
-
.

=
- 0 .
714

=1-05-05)
0 . 25

x 100% =

39 7
Ex
-

Eq = 21 7 .
% ~Ed

f'(0 5) -
-1. 1035
Centre 934
=

0
.

= -

b
.

not
f(c0 -
5) : = -
1 0 . 5

Ex = 2 . 4 %N Ex

21 /
+
1)x 100% %
-

= :

9 6 .
Total Numerical Errors ->
Includes roundoff er ror

At-faxi- F
CDF
fix- :

hi

f(x - +
1) =
xi +
1) +
2: + 1 roundoff error

rounded value

f(x= 1) -
=
Ax1) : -
+
ei +
1 round off error

fix- eits----ei-1h"
3!
2 ho

-x xin
einen As
-

2h
-
men -
Approx .
roundoff er ror truncation error

(i+1 has value of decrual


assume :
:-1 a maximum
->
points of computer

Roundoff
Max
error
-

- Max f =

M
Tot Error
.

Ech]
Total

↓ Error = +
he -> error a h kP error

" x ht error
error

k · need to find an optimal value for h to halance

·
Eck) 0

A
=

Echi= +

Ech)
Me hopt=
= -

function
+

->
M must be maximum value of entire

OPTIMAL H VALVE
=- Mt
BERIVING CENTERED DERIVATIVE APPROXIMATION for SECOND DERIVATIVE

Forward

f(x, +
1) =
f(xi) +
f(x)(xi
-
+ 1 -xi) +

fxi)(xi + 1
-
xi) +

+xi)(xi
! 3
-
+ 1 -x) +
En I +

u
h

Backward
Xi -1 -
X=

f(xi) f(xi)(x=
f(xi 1) xi C
-
=
-
-
-
- -
1
-
3
h

F +
W
q(b) -

f(xix) f(x-- + =
2 f(x) + 0 +
ficmh -
o +

fish". que
q(ni -

O ⑧

*
- I (f"(3! =

f
+

<32)] a
b

f(x , + , +
f(x = -) =

2f(x) +
f"cxih - n
MVT
=-
2 f"(3 There exists a C where

f"(xi)
2x) fx+ fx f
=

g(aq(b)
-
+ +

q()
-
=

f4f 3
*
+
f ( =
3
-

APPROX
TRUNCATION ERROR

f"cx fixe
x-1-2f(x )
Aysh"
= :
-

Li

differenc of first derivatives

fir . F i
Atf(x .
: -
h
+ ERROR

E
x 1

f(x) =

cos(x)
f "(0 . 8) =
? f"c0 . 8) : -cos(0 8) .

= - 0 . 6967067093

Xi -1 0 79 xi 8 xi 0 81
=

.
=
0 .
= .

k
-8-0
.

1f"(0
0
=

00) = -0 690000 000580409


Et
= .
,
=
0 .

b =
0 .
01
-[10 29)
f"cx - 118 .

=-0 .
6969000 Ex =
0 .
00019329)
0 . 012 e
smallest er ror
h = 0 . 001

1991
f"0 - 200 -
000706709
.

. 00
=
= -
0 .
696/26300 =
0 .

0 . 0072
E E

f(x i fi 1) 2f(xi)
fix =
-
1
+
+
-
+

Roundoff
A +
Total
=
ERROR Error

Ech) = *
M
E:
=
1 -

+
M
=

Kopt
*
2x10-9
Gopt
: 48 . 0 . =
0 . 01244
ERROR

TRUE VALUE =
APPROX+ ERROR

in an iterative process we
may
E ->
TRUE ERROR
want to know when to stop
Et TRUE VAL-APPROX
=

Kal <Es
Et - TRUE PERCENT RELATIVE ERROR

TRUE VAL APPROX


STOPPING CRITERION E ,

t
-

S =
-
t x 100 % =

TRUE VAL "


5x18
-

Es =
0 .
%
-
STOPRING
Eat APPROXIMATE PERCENT RELATIVE ERROR
CRITERION E ,

APProx :
-
approx : -1
En %
=

x 100
approx :

TAYLOR SERIES

Any function be approximated


smooth can as a
polynomial

f(x)
Prcx)=Efx-xo

Pr(x) f(x)

!
=

f(x)(x
facx -x
+

x0
xd
+
-

- ... +
-

TRUNCATION ERRORS

·
occur
by voing an approximation instead of an
analytical procedure

You might also like