Find a formula for the nth term of the Taylor series of \(f(x)\), centered at \(c\), by finding the coefficients of the first few powers of x and looking for a pattern. (The formulas for several of these are found in Key Idea 32; show work verifying these formula.)
\[f(x)=\frac{x}{(x+1)}\]
\(f(x) = \frac{x}{(x+1)}\)
\(f^{'}(x) = \frac{1}{(x+1)^2}\) , \(f^{'}(1) = 1\)
\(f^{''}(x) = -\frac{2}{(x+1)^3}\) , \(f^{''}(1) = - 2\)
\(f^{'''}(x) = \frac{6}{(x+1)^4}\) , \(f^{'''}(1) = 6\)
\(f^{''''}(x) \space or \space \frac{d}{dx} (\frac{6}{(x+1)^4}) = - \frac{24}{(x+1)^5}\) , \(f^{''''}(1) = -24\)
\(f^{'''''}(x) \space = - \frac{120}{(x+1)^6}\) , \(f^{'''''}(1) = 120\)
\(......\)
Formula for Taylor Polynomial = \(0+\frac{1}{1!}x+\frac{-2}{2!}x^2+\frac{6}{3!}x^3+\frac{-24}{4!}x^4+\frac{120}{5!}x^5+\)
library(pracma)
f <- function(x) x/(1+x)
taylor(f,0,5)
## [1] 1.000295 -1.000030 1.000003 -1.000000 1.000000 0.000000
\[f(x) = log(1+x)\]
\(f(x)=ln(1+x); c=0\)
\(f'(x) = \frac{1}{x+1} = \frac{\ln(1 + 0)}{0!}(x - 0)^0 = \ln(1) = 0\)
\(f''(x) = -\frac{1}{(x+1)^2} = \frac{\frac{1}{0+1}}{1!}(x - 0)^1 = x\)
\(f'''(x) = \frac{2}{(x+1)^3} = \frac{-\frac{1}{(0+1)^2}}{2!}(x - 0)^2 = -\frac{1}{2}x^2\)
\(f''''(x) = -\frac{6}{(x+1)^4} = \frac{\frac{1}{(0+1)^3}}{3!}(x - 0)^3 = \frac{1}{6}x^3\)
Taylor Polynomial series = \(0 + x - \frac{1}{2}x^2 + \frac{1}{6}x^3 - \frac{1}{24}x^4 + ...\)
fn <- function(x) log(1+x)
p <- taylor(fn, 0, 4)
p
## [1] -0.2500044 0.3333339 -0.5000000 1.0000000 0.0000000