SymPy 기호수학 - 4. Legendre 다항식¶
sympy 라이브러리를 불러오고, 사용할 기호 변수를 선언한다. 출력을 LaTex 수식으로 나타내고, 맷플롯립 모듈을 불러온다.
from sympy import *
x, y, z, t = symbols('x y z t')
f, g, h = symbols('f, g, h', cls=Function)
init_printing()
%matplotlib inline
Legendre 방정식¶
Legendre 방정식은 다음과 같다.
(1−x2)y″−2xy′+n(n+1)y=0
n 은 정수이다.
Legendre 방정식은 편미분 방정식을 구형 좌표계로 표현할 때 나타난다.
Legendre 방정식의 해는 거듭제곱급수 해법을 사용하여 구한다.
Legendre 방정식의 해를 Pn(x) 로 나타내고, Legendre 다항식 (Legendre polynomial)이라 부른다.
P0(x)=1
P1(x)=x
P2(x)=12(3x2−1)
P3(x)=12(5x3−3x)
P4(x)=18(35x4−30x2+3)
⋮
Pn(1)=1 되도록 계수를 결정한다.
일반적인 표현으로 나타내면
Pn(x)=M∑m=0(−1)m(2n−2m)!2nm!(n−m)!(n−2m)!xn−2m
M={n2n=0,2,4,⋯n−12n=1,3,5,⋯
P0(x),P1(x),P2(x),P3(x),P4(x) 를 확인해 본다.
legendre(n,x) 는 n차 Legendre 다항식을 구해준다.
legendre( 0, x )
legendre( 1, x )
legendre( 2, x )
legendre( 3, x )
legendre( 4, x )
P0(x),P1(x),P2(x),P3(x),P4(x) 를 그래프로 그려보면
plot( legendre(0,x), legendre(1,x), legendre(2,x), legendre(3,x), legendre(4,x),
xlim=(-1.1,1.1), ylim=(-1.1,1.1) )
버금 Legendre 방정식 (associated Legendre equation)¶
버금 Legendre 방정식은 다음과 같다.
(1−x2)y″−2xy′+[n(n+1)−m21−x2]y=0
n,m 은 정수이다.
버금 Legendre 방정식은 양자역학에서 나타난다.
버금 Legendre 방정식의 해는 Pmn(x) 로 나타내고, 버금 Legendre 함수라고 한다.
assoc_legendre(n,m,x) 는 (n,m)차 버금 Legendre 함수를 구해준다.
assoc_legendre(0,0, x )
assoc_legendre(1,0, x )
assoc_legendre(1,1, x )
댓글 없음:
댓글 쓰기