This week, we’ll work out some Taylor Series expansions of popular functions.
\[f(x) = \frac{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. Please submit your assignment as a R-Markdown document.
The formula for Taylor Polynomial is:
\[P(x) = \Sigma_{n=0}^{\infty}\frac{f^{(n)}(c)}{n!}(x-c)^n\]
Let’s expand this function \(f(x)\) into the polynomials. We’ll obtain the first few coefficients.
\(f'(x) = \frac{1}{(1-x)^2}\) , \(f''(x) = \frac{2}{(1-x)^3}\) and \(f'''(x) = \frac{6}{(1-x)^4}\)
\(P(x) = f(c) + \frac{f'(c)}{1!}(x-c)^1 + \frac{f''(c)}{2!}(x-c)^2 + \frac{f'''(c)}{3!}(x-c)^3 + ...\)
\(P(x) = \frac{1}{(1-x)} + \frac{\frac{1}{(1-x)^2}}{1!}(x-c)^1 + \frac{\frac{2}{(1-x)^3}}{2!}(x-c)^2 + \frac{\frac{6}{(1-x)^4}}{3!}(x-c)^3+...\)
Now, with c=0, the Taylor Polynomial expansion into a Maclaurin polynomial.
\[P(x) = \frac{1}{(1-x)} + \frac{\frac{1}{(1-x)^2}}{1!}x^1 + \frac{\frac{2}{(1-x)^3}}{2!}x^2 + \frac{\frac{6}{(1-x)^4}}{3!}x^3+...\]
Now, find the coefficients for the polynomials.
\(f(0) = \frac{1}{1-0} = 1\)
\(f'(0) = \frac{1}{1^2} = 1\), The coefficient for the 1st degree polynomial is \(\frac{1}{1!} = 1\)
\(f''(0) = \frac{2}{1^3} = 2\), The coefficient for the 2nd degree polynomial is \(\frac{2}{2!} = 1\)
\(f'''(0) = \frac{6}{1^4} = 6\), The coefficient for the 3rd degree polynomial is \(\frac{6}{3!} = 1\)
Hence, \(P(x) = 1 + x + x^2 + x^3 + ... = \Sigma_{n=0}^{\infty} x^n\)
Let’s peform the Maclaurin Polynomial Expansion, which is a type of Taylor Series (where c is centered at 0).
Taking the differentiation of \(f(x), \space f'(x) = e^x, \space f''(x) = e^x, \space f'''(x) = e^x....\)
\(P(x) = f(x) + \frac{f'(x)}{1!}x^1 + \frac{f''(x)}{2!}x^2 + \frac{f'''(x)}{3!}x^3 + ...\)
Plugging in values: \(P(x) = e^x + \frac{e^x}{1!}x^1 + \frac{e^x}{2!}x^2 + \frac{e^x}{3!}x^3 +...\)
Now, find the coefficients of polynomials
\(P(0) = e^0 = 1\)
\(f'(0) = e^0 = 1\) The coefficient for the 1st degree polynomial is: \(\frac{1}{1!} = 1\)
\(f''(0) = e^0 = 1\) The coefficient for the 2nd degree polynomial is: \(\frac{1}{2!} = \frac{1}{2}\)
\(f'(0) = e^0 = 1\) The coefficient for the 3rd degree polynomial is: \(\frac{1}{3!} = \frac{1}{6}\)
Hence, \(P(x) = 1 + x + \frac{1}{2!}x^2 + \frac{1}{3!}x^3 + ... = \Sigma_{n=0}^{\infty}\frac{1}{n!}x^n\)
Derivatives of function \(f'(x) = \frac{1}{1+x}, \space f''(x) = \frac{-1}{(1+x)^2}, \space, f'''(x) = \frac{2}{(x+1)^3}, \space f''''(x) = \frac{-6}{(x+1)^4}...\)
P(x) = f(x) + x^1 + x^2 + x^3 + …
Now, find the coefficients of polynomials
\(P(0) = ln(1+0) = 0\)
\(f'(0) = \frac{1}{1} = 1\) The coefficient for the 1st degree polynomial is: \(\frac{1}{1!} = 1\)
\(f''(0) = \frac{-1}{1} = -1\) The coefficient for the 2nd degree polynomial is: \(\frac{-1}{2!} = \frac{-1}{2}\)
\(f'''(0) = \frac{2}{1} = 2\) The coefficient for the 3rd degree polynomial is: \(\frac{2}{3!} = \frac{2}{6} = \frac{1}{3}\)
\(f^4(0) = \frac{-6}{1} = -6\) The coefficient for the 4th degree polynomial is: \(f^4(0) = \frac{-6}{1} = -6\)
Hence, \(P(x) = x - \frac{1}{2}x^2 + \frac{1}{3}x^3 - \frac{1}{4}x^4 +... = \Sigma_{n=0}^{\infty}(-1)^{n+1}\frac{1}{n}x^n\)