ASSIGNMENT 14 - TAYLOR SERIES

library(pracma)
  1. 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]\)

q1 <- function(x){
  1/(1-x)
}
taylor(q1, 0, 6)
## [1] 1.001710 1.000293 1.000029 1.000003 1.000000 1.000000 1.000000
  1. \(f(x)=ex\)

Regardless of how many derivates of \(ex\) it’ll always be $ex $

\(f(x)=ex\) \(f(c)=ex\) \(f'(c)=ex\) \(f''(c)=ec\)

q2<- function(x){
  exp(x)
}
taylor(q2, 0, 4)
## [1] 0.04166657 0.16666673 0.50000000 1.00000000 1.00000000
  1. \(f(x)=ln(1+x)\)
q3 <- function(x){
  log(1+x)
}
taylor(q3, 0, 4)
## [1] -0.2500044  0.3333339 -0.5000000  1.0000000  0.0000000