library(pracma)
ASSIGNMENT 14 - TAYLOR SERIES
This week, we’ll work out some Taylor Series expansions of popular functions
f(x)=1/(1−x)
f′(x)=1/(1−x)2
f″(x)=f′(f′(x))=f′(1/(1−x)2)=2/(1−x)3x)3
f‴(x)=f′(f″(x))=6/(1−x)4
f⁗(x)=f′(f‴(x))=6∗4/(1−x)5
The series is bounded by x[−1,1]
tylr_ser <- function(x) {1/(1-x)}
# Find the Taylor series of q1(x) centered at x=0 up to 6th degree
(taylor(tylr_ser, 0, 6))
## [1] 1.001710 1.000293 1.000029 1.000003 1.000000 1.000000 1.000000
tylr_expo <- function(x) {exp(x)}
(taylor(tylr_expo, 0, 4))
## [1] 0.04166657 0.16666673 0.50000000 1.00000000 1.00000000
tylr_ln <- function(x) {log(1+x)}
(taylor(tylr_ln, 0, 4))
## [1] -0.2500044 0.3333339 -0.5000000 1.0000000 0.0000000
tylr_frac <- function(x){x^1/2}
(taylor(tylr_frac, 0, 4))
## [1] 0.5 0.0