In General, Taylor Series expansion is:
\[f\left( x \right) \quad =\quad \sum _{ n=0 }^{ \infty }{ \frac { { f }^{ (n) }(a) }{ n! } { (x-a) }^{ n } }\] Let’s write Taylor series of a function f(x) centered at 0:
\[ \begin{split} f(x) &= \sum_{n=0}^{\infty} \frac{f^{(n)}(0)}{n!}x^n \\ &= f(0) + \frac{f'(0)}{1!}x + \frac{f(0)}{2!}x^2 + \frac{f'(0)}{3!}x^3...+\frac{f^{(n)}(0)}{n!}x^n \end{split} \]
So in General: \[\boxed{f(x) = f(0) + \frac{f'(0)}{1!}x + \frac{f(0)}{2!}x^2 + \frac{f'(0)}{3!}x^3...+\frac{f^{(n)}(0)}{n!}x^n}\]
Now, let rip through our functions and apply:
This function is not defined at x=1.
Function | Evaluation at 0 |
---|---|
\(f(x) = \frac{1}{(1-x)}\) | \(f(0) = 1\) |
\(f'(x) = -\frac{1}{(1-x)^2}\) | \(f'(0) = -1\) |
\(f''(x) = \frac{2}{(1-x)^3}\) | \(f''(0) = 2\) |
\(f'''(x) = -\frac{6}{(1-x)^4}\) | \(f'''(0) = -6\) |
\(f''''(x) = \frac{24}{(1-x)^5}\) | \(f''''(0) = 24\) |
Pluging the numbers in, we obrain:
\[ \begin{split} \frac{1}{(1-x)} &= 1 + \frac{1}{1!} x^1 + \frac{2}{2!} x^2 + \frac{6}{3!}x^3 + \frac{24}{4!}x^4 + ...\\ &= 1 + x +x^2 + x^3 + ... + x^n \\ &= \boxed{\sum_{n=0}^{\infty} x^n } \text { for |x| < 1 } \end{split} \]
Check the first 4 terms in R (given in backward):
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
Function | Evaluation at 0 |
---|---|
\(f(x) = e^x\) | \(f(0) = 1\) |
\(f'(x) = e^x\) | \(f'(0) = 1\) |
\(f''(x) = e^x\) | \(f''(0) = 1\) |
\(f'''(x) = e^x\) | \(f'''(0) = 1\) |
\(f''''(x) = e^x\) | \(f'''(0) = 1\) |
\[ \begin{split} e^x &= 1 + \frac{1}{1!} x^1 + \frac{1}{2!} x^2 + \frac{1}{3!}x^3 + \frac{1}{4!}x^4...\\ &= 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!}+ \frac{x^4}{4!}... \\ &= \boxed{\sum_{n=0}^{\infty} \frac{x^n}{n!} } \end{split} \]
Check the first 4 terms in R (given in backward):
equation <- function(x) {exp(x)}
p <- taylor(equation, x0 = 0, n = 4)
p
## [1] 0.04166657 0.16666673 0.50000000 1.00000000 1.00000000
Function | Evaluation at 0 |
---|---|
\(f(x) = ln(1+x)\) | \(f(0) = 0\) |
\(f'(x) = \frac{1}{(1+x)}\) | \(f'(0) = 1\) |
\(f''(x) = -\frac{1}{(1+x)^2}\) | \(f''(0) = -1\) |
\(f'''(x) = \frac{2}{(1+x)^3}\) | \(f'''(0) = 2\) |
\(f''''(x) = -\frac{6}{(1+x)^4}\) | \(f''''(0) = -6\) |
Pluging the numbers in, we should obtain:
\[ \begin{split} ln(1+x) &= 0 + \frac{1}{1!} x^1 - \frac{1}{2!} x^2 + \frac{2}{3!}x^3 - \frac{6}{4!}x^4...\\ &= x - \frac{1}{2} x^2 + \frac{1}{3}x^3 - \frac{1}{4}x^4... \\ &= x - \frac{1}{2} x^2 + \frac{1}{3}x^3 - \frac{1}{4}x^4... (-1)^{n+1}\frac{1}{n}x^n \\ &= \boxed{ \sum_{n=0}^{\infty} (-1)^{n+1}\frac{1}{n}x^n } \end{split} \]
Check the first 4 terms in R (given in backward):
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