You are on page 1of 3

Numerical Integration and Differentiation

- Integration

1- Trapezoidal Rule

b
Fa Fb
∫ f(x)dx = h [ + F1 + F2 + F3 + ]
a 2 2
1
= h [ [Fa + Fb ] + [F1 + F2 + F3 ] ]
2

X Xo = a X1 X2 X3 Xn = b
F(x) Fo F1 F2 F3 Fn

X1 = X o + h X 2 = X1 + h

b − a Xn - Xo
h= =
n n

2- Simpson Rule

b
h
∫ f(x)dx = [ F + 4F1 + 2F2 + 4F3 + 2F4 + ⋯ + Fn ]
a 3 o

h
= [ [Fo + Fn ] + 4[F1 + F3 ] + 2[F2 + F4 ] ]
3

‫منتظر كاظم‬
Numerical Integration and Differentiation

simpson trapizoidal
n x f(x) f(x)
0 0 1 1
1 0.25 0.939413 0.939413
2 0.5 0.778801 0.778801
3 0.75 0.569783 0.569783
4 1 0.367879 0.367879
5 1.25 0.209611 0.209611
6 1.5 0.105399 0.105399
7 1.75 0.046771 0.046771
8 2 0.018316 0.018316
sum 1.018316 1.765578 1.252079 0.882066 1.018316 3.017657 0.881704

‫منتظر كاظم‬
Numerical Integration and Differentiation

- Differentiation

f(x + h) - f(x)
F'(x) = 2 points forward differences
h

f(x) - f(x - h)
F'(x) = 2 points backward differences
h

1
F'x = [- 3 fx + 4 fx+h - fx+2h ] 3 points forward differences
2h

1
F'x = [f - 4 fx - h + 3 fx ] 3 points backward differences
2h x-2h

1
F'x = [f -f ] 3 points central differences
2h x+h x-h

Exact value = F'(x)

Absolute error ε = | Exact value - Numerical value |

‫منتظر كاظم‬

You might also like