이번에는 numerical integration의 마지막, Gauss quadrature에 대해서 알아보겠습니다.
1. Definition of Gauss quadrature
Gauss quadrature는 특정 weight(wiwi)와 함수값 (f(xi)f(xi))의 곱을 discrete하게 더했을 때 그 구간의 definite integral과 거의 approximate하게 만드는 방법입니다.
식으로 표현하면 다음과 같습니다.
∫baf(x)dx≈∑ni=0f(xi)⋅wi⋯⋯(∗)∫baf(x)dx≈∑ni=0f(xi)⋅wi⋯⋯(∗)
이 때, h (interval between the points),{wi},{xi}h (interval between the points),{wi},{xi}는 균일한 값을 가질 수도 있고, 아닐 수도 있습니다.
uniform하지 않은 간격과 weight를 가질 수 있다는 뜻.
Gauss quadrature는 여러가지 variation을 가지고 있습니다. Gauss quadrature를 어떤 integration technique의 한 class라고 볼 수도 있습니다.
Gauss quadrature 방법에는
Gauss-Legendre, Gauss-Chebyshev, Gauss-Hermite, Gauss-LaguereGauss-Legendre, Gauss-Chebyshev, Gauss-Hermite, Gauss-Laguere 등이 있습니다.
cf) 위의 방법의 발음은 각각 가우스-르장드르, 가우스-체비쇼프, 가우스-에르미트, 가우스-라게르 라고 합니다.
Gauss quadrature의 정의 :
Let q(x) is a polynomial of degree N such that Let q(x) is a polynomial of degree N such that
∫baq(x)ρ(x)xkdx=0 where k is any integer in [0,N−1] and ρ(x) is a weighting function.∫baq(x)ρ(x)xkdx=0 where k is any integer in [0,N−1] and ρ(x) is a weighting function.
Let {xi} be the N roots of q(x) construct the integration formula (*),Let {xi} be the N roots of q(x) construct the integration formula (*),
we guarantee that for some set of {wi} the (*) is exact if f(x) is a polynomial of degree <2N-1>we guarantee that for some set of {wi} the (*) is exact if f(x) is a polynomial of degree <2N-1>
2. Gauss quadrature
∫baq(x)ρ(x)xkdx=0∫baq(x)ρ(x)xkdx=0
여기서 q(x)q(x)는 변수입니다.
k는 [0,N-1]일 때 위 식을 만족하는 q(x)q(x)를 구하고 q(x)q(x)의 roots({xi}{xi})를 구한 다음에
∫baf(x)dx≜∑ni=0wif(xi)
(f(x)의 order가 2N보다 작다고 가정)
위 식에 대입해서 이를 만족하는 wi를 구하면 exact하게 적분값을 구할 수 있습니다.

example : 3-point Gauss Legendre quadrature
1) 3 grid points (i=0,1,2) 사용 (N=3)
2) ρ(x)=1 weighting function은 1이라고 가정
3) integrate on [-1,1] : [-1,1] 적분으로 만들기 위해 variable x를 변형함
∫baf(x)dx=(b−a)2∫1−1f(u)du, where x=12(b+a)+12(b−a)u
Step1) Find q(x)
N=3이므로 q(x)는 3차 polynomial입니다.
q(x)=c0+c1x+c2x2+c3x3
위의 정의에서 k for xk는 [0,2] 안에서 결정되어야 합니다.
{k=0:∫1−1(c0+c1x+c2x2+c3x3)⋅1⋅x0dx=0⋯(1)k=1:∫1−1(c0+c1x+c2x2+c3x3)⋅1⋅x1dx=0⋯(2)k=2:∫1−1(c0+c1x+c2x2+c3x3)⋅1⋅x2dx=0⋯(3)
2c0+23c2=0
23c1+25c3=0
23c0+25c2=0
이 세 개의 식을 연립하여 c0,c1,c2,c3를 구하고 싶지만 식은 3개인데 문자가 4개이므로 해는 무수히 많습니다.
따라서 위 연립방정식을 풀었을 때 q(x)=−ax+53ax3 다음과 같이 나옵니다. a는 0이 아닌 임의의 숫자가 들어갈 수 있지만, a=32일 때 q(x)=−32x+52x3
Step 2) Find roots of q(x)
q(x)의 roots를 구하기 위해서 q(x)=0을 풉니다.
q(x)의 roots는 {xi}=±√53,0
Step 3) Find wi
∫1−1f(x)dx=∑i=0wif(xi)=w0f(x0)+w1f(x1)+w2f(x2)=w0f(−√35)+w1f(0)+w2f(√35)
이 때 f(x)=1,x,x2,x2,x3,x4,x5까지 2N−1=5차 order까지 표현할 수 있습니다.
각각의 f(x)에서 적분값과 weight, roots의 함수값의 summation이 동일하도록 만듭니다.
∫1−11dx=2=w0f(−√35)+w1f(0)+w2f(√35)=w0+w1+w2(∵f(x)=1)
∫1−1xdx=0=w0⋅(−√35)+w1⋅0+w2⋅(√35)
∫1−1x2dx=23=w0⋅(−√35)2+w1⋅02+w2⋅(√35)2
이렇게 3개의 식으로 w0,w1,w2을 구하면 w0=59,w1=89,w2=59가 나옵니다.
이 weight를 나머지 f(x)=x3,x4,x5에 넣으면
x3,x5는 기함수이기 때문에 [−1,1] 적분에서 0으로 사라지고(좌변) weight를 집어넣을 때도 우변이 0으로 되므로 성립합니다.
f(x)=x4일 때
∫1−1x4dx=25=59⋅(−√35)4+89⋅04+59⋅(√35)4
f(x)=x6일 때는 ∫1−1x6dx=27≠2⋅59⋅27125
성립하지 않습니다.
따라서 3개의 points가 주어졌을 때 f(x)가 5차 polynomial일 때까지 exact하게 적분을 수행할 수 있습니다.

또한 위에서 구한 q(x)=−32x+52x3은 Legendre polynomial of degree 3입니다.
Legendre Polynomial Pn(x)=1n!2ndndxn(x2−1)n(n=0,1,2,…)
또한 weight를 구하는 공식도 이미 나와있습니다.
wi=2(1−x2i)(P′N(xi))
위의 방법은 Gauss-Legendre method이었고 그 외에 다른 방법이 있다는 것을 이미 언급했습니다.
만약 적분이
∫∞0e−xf(x)dx라면
Gauss-Laguere를 쓰는 게 더 좋습니다.
∫∞−∞e−x2f(x)dx : Gauss-Hermite
∫1−1f(x)√1−x2dx : Gauss-Chebyshev
내가 함수의 형태를 알고 있다면 그에 맞춰서 위 방법 중에 택하여, table에서 weight 및 roots값을 찾을 수 있다고 합니다.
'수치해석 Numerical Analysis' 카테고리의 다른 글
[수치해석] Numerical solution of ODE (2) Explicit Euler (0) | 2021.04.27 |
---|---|
[수치해석] Numerical solution of ODE (1) introduction (0) | 2021.04.07 |
[수치해석] Numerical integration (2) - Simpson's rule, Romberg integration, Adaptive quadrature (0) | 2021.04.04 |
[수치해석/MATLAB] Lagrangian polynomial 구현하는 코드 (0) | 2021.04.02 |
[수치해석] Numerical integration (1) - Mid point rule, Trapezoidal rule (0) | 2021.03.28 |