ASSIGNMENT 14 - TAYLOR SERIES IS 605 FUNDAMENTALS OF COMPUTATIONAL MATHEMATICS - 2014 This week, we’ll work out some Taylor Series expansions of popular functions. f(x) = 1/(1-????x) f(x) = e^x f(x) = ln(1 + x) For each function, only consider its valid ranges as indicated in the notes when you are computing the Taylor Series expansion.
rm(list=ls())
library(pracma)
f(x)=1/(1-x)
equation_1<- function(x) {1/(1-x)}
f<- taylor(equation_1, x0 = 0, n = 4)
f
## [1] 1.000029 1.000003 1.000000 1.000000 1.000000
f(x)=e^x
equation_2<- function(x) {exp(x)}
f<- taylor(equation_2, x0 = 0, n = 4)
f
## [1] 0.04166657 0.16666673 0.50000000 1.00000000 1.00000000
f(x)=ln(1+x)
equation_3 <- function(x) {log(1+x)}
f<- taylor(equation_3, x0 = 0, n = 4)
f
## [1] -0.2500044 0.3333339 -0.5000000 1.0000000 0.0000000