# taylor-series

## 422 days ago by voloch

#easy way of getting taylor series at 0 (i.e Maclaurin series) (1/(2-cos(x))).series(x,7)
 1 + (-1/2)*x^2 + 7/24*x^4 + (-121/720)*x^6 + Order(x^7) 1 + (-1/2)*x^2 + 7/24*x^4 + (-121/720)*x^6 + Order(x^7)
log(1+x).series(x,7)
 1*x + (-1/2)*x^2 + 1/3*x^3 + (-1/4)*x^4 + 1/5*x^5 + (-1/6)*x^6 + Order(x^7) 1*x + (-1/2)*x^2 + 1/3*x^3 + (-1/4)*x^4 + 1/5*x^5 + (-1/6)*x^6 + Order(x^7)
#Taylor polynomial centered at an arbitrary point. Note it comes out written backwards f = x*exp(x) f.taylor(x,1,5)
 1/20*(x - 1)^5*e + 5/24*(x - 1)^4*e + 2/3*(x - 1)^3*e + 3/2*(x - 1)^2*e + 2*(x - 1)*e + e 1/20*(x - 1)^5*e + 5/24*(x - 1)^4*e + 2/3*(x - 1)^3*e + 3/2*(x - 1)^2*e + 2*(x - 1)*e + e
f=exp(x) a = plot(f,(x,-1,1),color='black') b = plot(f.taylor(x,0,1),(x,-1,1),color='red') c = plot(f.taylor(x,0,2),(x,-1,1),color='blue') d = plot(f.taylor(x,0,3),(x,-1,1),color='green') show(a+b+c+d)
f=sin(x) print f.taylor(x,0,5) a = plot(f,(x,-3,3),color='black') b = plot(f.taylor(x,0,1),(x,-3,3),color='red') c = plot(f.taylor(x,0,3),(x,-3,3),color='blue') d = plot(f.taylor(x,0,5),(x,-3,3),color='green') e = plot(f.taylor(x,0,7),(x,-3,3),color='yellow') show(a+b+c+d+e)
 1/120*x^5 - 1/6*x^3 + x 1/120*x^5 - 1/6*x^3 + x