ASSIGNMENT 14 - TAYLOR SERIES
IS 605 FUNDAMENTALS OF COMPUTATIONAL MATHEMATICS
This week, we’ll work out some Taylor Series expansions of popular functions.
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.
Derivatives:
\[f(x) = ∑_{n=0}^∞\frac{f^{(n)}(a)}{n!}(x−a)^n\]
\[f(a) + f^{(1)}(a)(x-a) + \frac{f^(2)}{2!}(a)(x-a) + ...\]
\[f(x) = \frac{1}{(1-x)}\]
library(pracma)
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
Derivatives:
\[f(a) = e^a ; f(0) = 1\]
\[f′(a)= e^a ; f′(0)= 1\]
\[f′′(a)= e^a ; f′′(0) = 1\]
\[f′′′(a)= e^a ; f′′′(0) = 1\]
\[f^{(4)}(a) = e^a ; f^{(4)}(0) = 1\]
equation = function(x) {exp(x)}
p = taylor(equation, x0 = 0, n = 4)
p
## [1] 0.04166657 0.16666673 0.50000000 1.00000000 1.00000000
Derivatives:
\[f(a)=ln(1+a) ; =f(0)=0\]
\[f′(a)=\frac{1}{1+a}; =f′(0)=1\]
\[f′′(a)=\frac{−1}{(1+a)^2}; =f′′(0)=−1\]
\[f′′′(a))=\frac{2}{(1+a)^3}; =f′′′(0)=2\]
\[f^{(4)}(a)=\frac{−6}{(1+a)^4}; =f^{(4)}(0)=−6\]
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