0% found this document useful (0 votes)
41 views

Numerical Differentiation and Integration

Uploaded by

Jad Dannaoui
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)
41 views

Numerical Differentiation and Integration

Uploaded by

Jad Dannaoui
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
You are on page 1/ 17

Zero-Order

1st-Order
- this higher terms are called truncation error
- or Zero-order
+

f(xi) ha ^ ( 4 (*1) – f(x+2) – 3 f(x:))


+ 0(k) le (i)= = f(xxx) + 4 f(xixl)
– 3 f(xi) 70(h) →(6)
2h

approx.
dcri

* Backward Finite
Difference

a) one-term
f(xi-1) I f(x:) b)
2 terms
f(xi--) = f(xi) – f(xi) h c) 3
terms
f(x1=) < $(xi) – f'(xi) k + f(xi) d)
higher terms
f(x:-1) = f(xi) - f(xi).h + $"
-
So using only 2
terms,
f(xi) - f(x,-1) f(xi) -
+ orn) → (0)
ħ & So using 3 terms and the procedure
outlined before, 3 f(xi) – 4 f(Xina) + f(xi-2)
+ Olha) | » (D) 2h
5.4
* Central Finite
Difference :
Recall
that fof.D
B-F-D f (x:xs) = f(xi)+F(;) h+ f(x: \+014) +0:1) f(n) = f(xi) – f(x:) h +
f(xi) - (h)
(C.1) – (C2)
gives f (xixl) - f(x-1) = 2h. f'(xi) + 0(h)
(0.2)
f (x1+1) – f(x;-)
+ och) |
(e)
- zh

Notice that the trunction error is of and degree order, however


in FFDA BFD it was a first
degree orden, och).
This means that central
difference is more accurate
representatron of a
derivative.
True
derivative
deri
o
appro
x.

X1+1

Similarily using 3 terms, the ist derivalue would be


more accurate and can be written as

-f(xitz) + 8 f(ti+1) -8 f(xi-1) +


f(xi-2)
1 time) +0(44)
+14)
-
12 h
TOY W

f(a)= -0.1x4 0-1573 -0.52% -0-25% +1.2 at x =


0.5 using a step, h=0.5 Solutions. Note that, f'(x) Can be
calculated to find the actual derivative value
f(x)= -0.4 63 - 0.45 x? - ? -0-25 → ..) $'(0.5)=
-0-9125)
&= 150 Tito
Xi-1 = 0.5-h=0, f (x-1)= 1.2
Xi = 0.5, . f (xi) = 0.925
Viti = 0.5th: 1 , . f (
11+3)= 0.2
2true*100

vo
Xtrue
From Eq.
(a)
f(titl) - f()
0-2-0-925-145 , & =
58.9%
f(xi) =
FFD
-
h
0.5
:-/45 , & = 58.6

f(xi) - f(xi)
From Eq.
(16)
0.925 –
12
- 0.5
= -0.55, Et = 39.7%.
BED
0.2 - 1.2
f(x+1) - f(x-1)
2h
From Eq.
(e),
CFD
1.0,
< =
9.6%
Min. Error

using a step of h-0-25 , - Zing = 0-25, f(xid)= 1-1035 ; Kits =


0.75, f (xicl) = 6-6 36 f'(ti) FFP3 - 1.155, Ĉt=26.5). f'(Xi) 869 =
-0.414 , & = 21.11. f'(xi) CFD = -0.934 , & = 2.4%
- Much better since the
1 step is lower * See the answer on the slide if we use high
accuracy diff. (h=0-25)
kit2 = Xi+zh: 0.5+240-25 = 1-0, -f(x+2) = 0.2
- 3 f G.)
-0.2 + 4 + 0.636 - 34 0.925
--0-86

ffd7
f'(xi)=
-
2
h
2 A 0-25
G = 5-82).
f (xi-z) = f(0.5-240-25) =
f(0)- 1-2
3 f(xi) - 4 $(x,-1) +
f(xs-2) BED; $(i)=
3 #0-925- 4*-10,35
+ 12
2h
20-25
-0.87 &=
3.77').

CFDA f'(xi) -
- f (x1+2) +8 f(xi+1)
-8f(x1=1)+ f(xi-2)
72 h

-0-2 + 8 + 0-636 - 8# 1-1035 + 1-2


?-0-9125 12 * 0-25
, Et = 0.07.
5.6-2
- Trapezoidal

Numerical Integration -
Simpson's
- Simpson 38 From Celentus, we know that the definite integral
for the function f(x) over an
interval [a b ] Can be represented by the area
under the Curue.
over en

Most of the methods are built on the fact that the area under
the Curve is the
value of integration. But Celculating the area
differs from one to another. a) Trapezoidal Rule:
YA

Xo
รั ก

*K-1 xk f(tk)+
f(Aku).ax
An
interval
A=
Az ox.
+(80)+4
f(*)+F(x) oz.
f(43)+Ffw..
2 7
2
CO2
..

Where

2n

So As bzw | 8640) + 2 f(6)+ 2 f(x) = - =


f(and

A baca fça) fav) 46...-- + f(xid]


Example use the trapezoidal rule to approximate the integral
s dx where na 5 ox= 6-2.
21.02 , f(2)=
where
n=5

Vx+1
Soluti
on

f(x) 0.707 0.605 0-517 0:4430-382 0-333 SP(x) dx


= (1:5 )(0.767 +260-6.5+ 260514 + ... +0,32] =
0493
1

Exampl
e
Sinx
da
,
n= 6
x
+
T

Solution

ox. TO, T16


Sin 30
.5.
13

X To T16 T13 Tiz 2013 516 f(x) o 0-136


10-20670-2120-165 0-08680
"Sf(x) dx = (1-0) [0+ 24 (0.13640-2067. -6868) + 0)

0-42285

0.8 864)
Exampl
e
(f(x) = 0.2 + 25x4 - 200x2+675 x _ 900
x
400 x
3
, n=2 inh
one- interval

| True
integration /
=
1.6405

So bezce ( soud +
Freunde
= 0.870 (02 + 6-2323] =
0.1128
* Simpson's Rule
*
Aside from using the Trapezoidel rule with finer
segmentation, another way to obtain a more accurate estemate of
an integral is to use higher order polynomials to connect the point.
Jeans 15. od petnae) 4 46) + 2 Ž 4W) + f(n)
3n
2,4,6
SL

Exam
ple
na 2

f(x) = 0.2+ 252– 200 x’+675 z' - 900


x4 + 4002
soln
f(x) = f(a)=0-2
f(x) = f(0:4) =
2.456 f(x) =
f(0-8)= 0.232
2 interval

- Iss A) dx = 10-8-0) [0.2 + 4x 2.456 + 0-231).


1364
3*2
1

Recall
that
I true =
1.6405
16.7%.
1.6405 1-3671
*100 = 1-6405

Exempl
e:
t
I sint

- dx
,nab
7+

XS

sofa.: ox: baq.7.0.146 , f(x) =

o 1716 1713 1/2 27/


3 5716 7 46) :1364 0 2067) 6:2,226.46530-08680 1: (f(x) dx
= (T-0) (0+ 40 (0-1364 + o-2122 + ,0868) +20102067+ -1653)
+0] =0.4338
"
T

The true value is not easy to find but can be estimated using
thousands of interuch to approach o. 433985

5.9
Examp
le
DIOL

and find the


error.
da, n=4, then compare it with the
exact value 14:40-1 , f(x). Veral

S = (1+4(15+ V7) +2215 +3] 2 8661 Gaet soch. "Vazei


dx, gut un 22el, dus 2 de oy va du = {le%%]*2 = 667
X=0 M1
224 -- = 9
• Ę = 18667 - 8-661|4100 =
0.0646").
8-667

6) Simpson's &
Rule
n intervals should be divisible by 3, so 3, 6,
9, so on... because this rule approximates a
cubic function.

Exampl
e:
f(x)= 0.2+ 25 % - 200 x?+675 x'_ goo "
+ 400 gs
h. 08-0, 0.2667
To 0.87, n=3
sob

to
f(0) = 0.2
f(0.2667)- 1.432
+(0.533) =
3-487 f1018) =
0.232
T
o
10:2607|0.333
08
x X2 X3

7.432
0-26670-533

3.4871 0.232
f(x) 10-2

I, 0-81 (0.2+ 3+ 1432 +34 3.989+


0-282] = 1.519

.
Recalling the true
value = 1.6405
&t=
7.4%
(less than
Simpsons /
Rule
)

You might also like