HW14 For each function, only consider its valid ranges as indicated in the notes when you are computing the Taylor Series expansion. Please submit your assignment as a R-Markdown document.

1) Function 1

\({f(x)= \frac{1}{(1-x)} = 1+x+x^2+x^3+...}\)

library(pracma)
f <- function(x) 1/(1+x)
p <- taylor(f, 1, 4)
p
## [1]  0.03124943 -0.18749774  0.49999667 -0.81249782  0.96874946

2) Function 2

\({f(x)= e^x = 1+x+\frac{x^2}{2!}+\frac{x^3}{3!}...}\)

library(pracma)
f <- function(x) exp(x)
p <- taylor(f, 0, 4)
p
## [1] 0.04166657 0.16666673 0.50000000 1.00000000 1.00000000

3) Function 3

\({f(x)= ln(1+x) = (x-1)-\frac{(x-1)^2}{2}+\frac{(x-1)^3}{3}...}\)

library(pracma)
f <- function(x) log(x)
p <- taylor(f, 1, 4)
p
## [1] -0.2500044  1.3333515 -3.0000281  4.0000192 -2.0833383