Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
NUMERICAL METHODS
Numerical Integration
f (x0)
f (x1)
f (x2)
O
x 0 x1
x2
or
f ( x0 )
x1 x0 '
.
f ( x0 )
(4)
3
f ( xi )
xi 1 xi '
.
f ( xi )
Example 3.4
3
Solve f ( x) x 3 x 1 0.
Solution
i ) Differentiate f ( x) to obtain f ' ( x) 3x 2 3.
ii ) Choose x0 0 as a starting point.
iii ) Make a table based on Newton - Raphson' s formula :
xi
f (xi)
f (xi)
-1
-3
-0.333333
-0.037037
-2.666667
-0.347222
-0.000196
-2.638310
-0.347296
-0.000000
xi
f (xi)
f (xi)
0.99
-2.999701
-0.0597
IMPORTANT!!!
f (x0)
f (x1)
f (x2)
f (x3)
O
x0 x1 x2 x3
x
9
10
0 f ( x1 ) f ( x1 ) f ( x0 )
x2 x1
x1 x0
or
x1 x0
.
x2 x1 f ( x1 )
f ( x1 ) f ( x0 )
Using the same formula, we compute x3, x4, ... and so on.
11
xi xi 1
xi 1 xi f ( xi )
f ( xi ) f ( xi 1 )
12
Example 3.5
Solve f ( x) x 3 3 x 1 0.
Solution
i ) Choose initial values x0 0 and x1 1.
ii ) Make a table based on the formula of Secant method
i
xi
f (xi)
-1
-3
-0.5
0.375
-0.333333
-0.037037
-0.348315
0.002685
-0.347302
0.000016
-0.347296
-0.000000
-0.347296
-0.000000
13
14
Example 3.6
Given the data points and what
is the unique polynomial that passes through the
data points?
Solution
Since we are given three different points, then
we can only find unique value for three
coefficients: C0, C1 and C2. Then, our
interpolation polynomial is quadratic:
y = C0 + C1x + C2x2.
17
4
1 2
y 2 x x .
3
3
19
Example 3.7
Given the data points and Apply
Lagrange Method to find interpolation polynomial
passing through these points.
Solution
Let ( x0 , y0 ) (0,2), ( x1 , y1 ) (1,3) dan ( x2 , y2 ) (3,3).
Then, Lagrange interpolation polynomial is given by
y L0 ( x) y0 L1 ( x) y1 L2 ( x) y2
21
where
( x x1 )( x x2 )
( x 1)( x 3)
L0 ( x)
( x0 x1 )( x0 x2 ) (0 1)(0 3)
1
1 2 4
( x 1)( x 3) x x 1.
3
3
3
( x x0 )( x x2 ) ( x 0)( x 3)
L1 ( x)
( x1 x0 )( x1 x2 ) (1 0)(1 3)
1
1 2 3
x( x 3) x x.
2
2
2
22
L2 ( x)
( x x0 )( x x1 )
( x 0)( x 1)
( x2 x0 )( x2 x1 ) (3 0)(3 1)
1
1
1
x( x 1) x 2 x.
6
6
6
Substituting Li ( x) to the Lagrange' s equation, we obtain
1
1
x x 1 (2) x 2 x (3) x 2 x (3)
3
2
6
3
2
6
4
1
2 x x2.
3
3
23