Numerical Integration in 1D (Lec 11)
Numerical Integration in 1D (Lec 11)
Prof. Suvranu De
Numerical Integration in 1D
Reading assignment:
Summary:
dN i ( x)
where Bi
dx
Only for a linear finite element
x2
x1
T
B EB Adx
1
x 2 x1
2
1 1 x2
1 1 x1 AEdx
x1
x2
AEdx x x
2
1
1
2
1 1
1 1
f fr
r
-1 1
1 r 1 r
g (r ) f (1) f (1)
2 2
1 1
I f (r ) dr g (r ) dr f (1) f (1)
1 1
•Requires the function f(x) to be evaluated at 2 points
(-1, 1)
• Constants and linear functions are exactly integrated
• Not good for quadratic and higher order polynomials
f
f(
r
-1 1
r (r 1) r (1 r )
g (r ) f (1) (1 r )(1 r ) f (0) f (1)
2 2
1 1 1 4 1
I f (r ) dr g (r ) dr f (1) f (0) f (1)
1 1 3 3 3
•Requires the function f(x) to be evaluated at 3 points
(-1,0, 1)
• Constants, linear functions and parabolas are exactly
integrated
• Not good for cubic and higher order polynomials
1
i 1
1
i 1
But we want
1
1
f (r ) dr W1 f (r1 ) a0W1 a0W1r1
Hence, we obtain the identity
i.e., W1 2; r1 0
1
For M=1 I f (r ) dr 2 f (0)
1
fr
f
gr
r
-1 1
Midpoint quadrature rule:
• Only one evaluation of fris required at the midpoint of the
interval.
• Scheme is accurate for constants and linear polynomials
(compare with Trapezoidal rule)
Example: M=2
1
I f (r ) dr W1 f (r1 ) W2 f (r2 )
1
2 2
a0 W1 W2 a1 W1r1 W2 r2 a2 W1r1 W2 r2 a3 W1r1 W2 r2
3 3
Hence, we obtain the 4 conditions to determine the 4 unknowns
(W1 ,W2 r1 and r2 )
Condition 1 : W1 W2 2
Condition 2 : W1r1 W2 r2 0
2 2
2
Condition 3 : W1r1 W2 r2
3
3 3
Condition 4 : W1r1 W2 r2 0
* * r
-1 1
1 1
f ( ) f ( )
3 3
2
Exact answer!
3
Comparison of Gauss quadrature and Newton-Cotes for the
integral 1
I cos(2x) dx
1
Newton-Cotes
Gauss quadrature
In FEM we ALWAYS use Gauss quadrature
Linear Element 2
1
r 1 r 1
Stiffness matrix
r 1
1 1 1 1
1
1 1 1
k B EBAdr
T
AEdr AEdr
r 1
4 1 1 1 1 4 1 1
Nodal load vector
1
f b i N i b dr
1
f b N b dr
T
1 1
B EBAdr AE B Bdr
T T
k
r 1 r 1
1
(r 1/2) 2
2r(r 1/2) (r 2
1/4)
AE 2r(r 1/2) 4r 2 2r(r 1/2)dr
-1 2
(r 2
1/4) 2r(r 1/2) (r 1/2)