Lec 11 12 Integration Differetions
Lec 11 12 Integration Differetions
Lec 11-12
Assistant Professor
Akram Abdul Mawjood Dawood
April 2025
Cubic Splines
A straight line
x− x i x− x i− 1
f ''( x )= f '' ( xi− 1 ) + f ''( xi ) connecting the first
i i x i− 1− x i i xi − x i− 1 knot f’’(xi-1) and the
second knot f’’(xi)
Unknowns:
i = 0, 1,…, n
Cubic Splines
6
+
x i − x i− 1
[ f ( x i− 1 )− f ( x i ) ]
Solution:
➢ Natural Spline:
f '' ( x 0 )= f '' (3 )= 0, f '' ( x 3 )= f '' (9 )= 0
Cubic Splines - Example
➢ For 𝟏𝒔𝒕 interior point (x1 = 4.5)
x 3.0 4.5 7.0 9.0
f(x) 2.5 1.0 2.5 0.5
- x i − x i− 1= x 1− x 0= 4. 5− 3. 0= 1. 5
- x i+1− xi− 1= x 2− x 0= 7− 3. 0= 4
- x i+1− xi = x 2− x 1= 7− 4. 5= 2. 5
Apply the following equation:
( x i− x i− 1 ) f '' ( x i− 1 )+2( x i+1 − x i− 1 ) f ''( x i )+( x i+1− x i ) f ''( xi+1 )
6 6
¿
xi+1 − x i [ f ( xi+1 )− f ( x i ) ] +
x i− xi− 1 [ f ( xi− 1 )− f ( xi ) ]
Cubic Splines - Example
+
[ f i ( xi − 1 ) f i'' ( x i− 1 ) (x i − x i− 1 )
x−x
i
−
i− 1 6
x − x
] [
( i ) x−x
+
f i( xi )
i i− 1
−
f ''( x i ) (x i − x i− 1 )
6
i
]
(x− x i− 1 )
f 1 ( x)= 0 ( xi − 3 ) +
1. 67909
3
6(1. 5)
3 2 . 5 0(1.5 )
( x− 3) +
1.5
−
6 [ 1. 5 ]
1 1. 67909(1. 5)
(4. 5− x )+ −
6
( x− 3) [ ]
f 1 ( x )= 0 .186566 ( x− 3 )3 +1 .6667 (4 . 5− x )+0 . 24689( x− 3 )
Cubic Splines - Example
The 2nd interval (i =2), apply for the equation:
f 2 ( x )=
1 . 67909
6 (2 .5 )
3 − 1 .53308
(7− x) +
6(2 .5 )
3 1
( x− 4 .5 ) + [ −
2 .5 6
− 1. 67909(2 . 5)
]
(7− x )
+[ 2. 5 − 1 . 53308(2 . 5)
−
2. 5 6 ]
( x− 4 . 5)
12
The Trapezoidal Rule
13
The Trapezoidal Rule
One way to approximate a definite integral is to use
n trapezoids, as shown in Figure 1.
Figure.2 15
The Trapezoidal Rule
The area of the ith trapezoid is
16
The Trapezoidal Rule
Letting you can take the limits as to
obtain
17
The Trapezoidal Rule
18
Example 1 – Approximation with the Trapezoidal Rule
Figure. 3
19
Example 1 – Solution
When n = 4, ∆x = π/4, and you obtain
20
Example 1 – Solution cont’d
21
Simpson’s Rule
22
Simpson’s Rule
One way to view the trapezoidal approximation of a definite
integral is to say that on each subinterval you approximate f
by a first-degree polynomial.
24
Simpson’s Rule
To develop Simpson’s Rule for approximating a definite
integral, you again partition the interval [a, b] into
n subintervals, each of width ∆x = (b – a)/n.
26
Figure .3
Simpson’s Rule
Now, using p as an approximation of f on this subinterval,
you have, by Theorem 4.18,
28
Example 2 – Approximation with Simpson’s Rule
29
Example 2 – Solution cont’d
30
Numerical Methods
Differentiation Integration
v v
dv
dt
t t
a y
b
a=
dv y=
a
vdt
dt
t
31
Numerical Differentiation
32
Numerical Differentiation
33
Numerical Differentiation
A Taylor series or Lagrange interpolation of points
can be used to find the derivatives. The Taylor
series expansion is defined as:
f ( xi ) = f ( x0 ) + x
df
+
(x )
2
d2 f
+
(x ) d 3 f
3
+
dx x =x0 2! dx 2 x =x0
3! dx 3
x =x0
x = xi − x0
f ( xi ) = f ( x0 ) + ( xi − x0 ) f ( x0 ) +
( xi − x0 )
2
f ( x0 ) +
( xi − x0 )
3
f ( x0 ) +
2! 3!
34
First Derivative at a Point
f ( x )
35
Numerical Differentiation
f ( xi +1 ) = f ( xi ) + ( xi +1 − x ) f ( x ) +
( xi +1 − xi )
2
f ( xi ) + 1
i i
2!
f ( xi ) = f ( xi ) 2
f ( xi-1 ) = f ( xi ) + ( xi −1 − x ) f ( x ) +
( xi −1 − xi )
2
f ( xi ) + 3
i i
2!
36
Numerical Differentiation
f ( xi +1 ) = f ( xi ) + (x ) f ( xi ) +
(x )
2
f ( x ) +
(x )
3
f ( xi ) + 1
i
2! 3!
f ( xi ) = f ( xi ) 2
f ( xi-1 ) = f ( xi ) − (x ) f ( xi ) +
(x )
2
f ( x ) −
(x )
3
f ( xi ) 3
i
2! 3!
37
Forward Differentiation
f ( xi ) = − f ( xi ) − f ( xi ) +
x 2! 3!
38
Forward Differentiation
Error =
(x ) f (x ) + (x ) 2
f (xi ) +
i
2! 3!
39
Backward Differentiation
Error =
(x ) f (x ) + (x ) 2
f (xi ) +
i
2! 3!
40
Central Differentiation
Error =
(x ) 2
f (xi ) +
3!
41
Differential Error
42
Numerical Differentiation
1-43 43
Backward Difference & Centered Difference
44
Backward Difference & Centered Difference
45
Numerical Differentiation
46
Numerical Differentiation
47
FDA,BDA & CDA
48
Any Question
49