# 일반수학및실습2-10.8절

## 2118 days 전, jhlee2chn 작성

예.

var('x') f(x)=exp(x) f(x).taylor(x, 0, 5) # 함수.taylor(x, a, n)
 1/120*x^5 + 1/24*x^4 + 1/6*x^3 + 1/2*x^2 + x + 1 1/120*x^5 + 1/24*x^4 + 1/6*x^3 + 1/2*x^2 + x + 1

예제 1.

g(x)=sin(x) g(x).taylor(x, 0, 7)
 -1/5040*x^7 + 1/120*x^5 - 1/6*x^3 + x -1/5040*x^7 + 1/120*x^5 - 1/6*x^3 + x
h(x)=sqrt(1+x^4) P_12(x)=h(x).taylor(x, 0, 12) print P_12(x) integral(P_12(x), (x, 0, 0.4))
 1/16*x^12 - 1/8*x^8 + 1/2*x^4 + 1 0.401020391375 1/16*x^12 - 1/8*x^8 + 1/2*x^4 + 1 0.401020391375

예제 3.

h(x)=cosh(x) h(x).taylor(x, 0, 10)
 1/3628800*x^10 + 1/40320*x^8 + 1/720*x^6 + 1/24*x^4 + 1/2*x^2 + 1 1/3628800*x^10 + 1/40320*x^8 + 1/720*x^6 + 1/24*x^4 + 1/2*x^2 + 1

예.

h(x)=log(x) P2(x)=h(x).taylor(x, 1, 5) # 2계 테일러 다항식 print "P2(x)=", P2(x) print P2(0.9) print h(0.9) print print P2(1.5) print h(1.5) plot(h(x), (x, 0.5, 3))+plot(P2(x), (x, 0.5, 3), color='red') # 그림 동시에 그리기
 P2(x)= 1/5*(x - 1)^5 - 1/4*(x - 1)^4 + 1/3*(x - 1)^3 - 1/2*(x - 1)^2 + x - 1 -0.105360333333333 -0.105360515657826 0.407291666666667 0.405465108108164  P2(x)= 1/5*(x - 1)^5 - 1/4*(x - 1)^4 + 1/3*(x - 1)^3 - 1/2*(x - 1)^2 + x - 1 -0.105360333333333 -0.105360515657826 0.407291666666667 0.405465108108164 

http://wiki.sagemath.org/interact/calculus#Taylor_Series

var('x') x0 = 0 f = sin(x)*e^(-x) p = plot(f,-1,5, thickness=2) dot = point((x0,f(x0)),pointsize=80,rgbcolor=(1,0,0)) @interact def _(order=(1..12)): ft = f.taylor(x,x0,order) pt = plot(ft,-1, 5, color='green', thickness=2) html('$f(x)\;=\;%s$'%latex(f)) html('$\hat{f}(x;%s)\;=\;%s+\mathcal{O}(x^{%s})$'%(x0,latex(ft),order+1)) show(dot + p + pt, ymin = -.5, ymax = 1)

## Click to the left again to hide and once more to show the dynamic interactive window