R Markdown

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.

Qn1

\[ f(x) = 1/(1-x) \] \[ f(x) = \sum_{n=0}^{\infty} \frac{f^n a}{n!}(x-a)n \] \[ = f(a) + f^1(a)(x-a) + \frac{f^2 a}{2!}(a)(x-a) + ... \]

#install.packages('pracma')
library(pracma)
## Warning: package 'pracma' was built under R version 3.5.3
equation <- function(x) {1/(1-x)}
p <- taylor(equation, x0 = 0, n = 4)
p
## [1] 1.000029 1.000003 1.000000 1.000000 1.000000

Qn2

\[ f(x)=e^x \]

equation <- function(x) {exp(x)}
p <- taylor(equation, x0 = 0, n = 4)
p
## [1] 0.04166657 0.16666673 0.50000000 1.00000000 1.00000000

Qn3

\[ f(x)=ln(1+x) \]

equation <- function(x) {log(1+x)}
p <- taylor(equation, x0 = 0, n = 4)
p
## [1] -0.2500044  0.3333339 -0.5000000  1.0000000  0.0000000