Problem 1.

\[f(x) =\frac {1} {(1-x)} \] \[f'(x) = \frac {1}{(1-x)^2} \]

\[f''(x) = \frac {2}{(1-x)^3} \]

\[f'''(x) = \frac {6}{(1-x)^4} \]

\[ = f(x) + \frac {f'(x)} {1!} (x -c)^1 + \frac {f''(x)} {2!} (x-c)^2 + \frac {f'''(x)} {3!} (x -c)^3\]

\[ = 1 + x + x^2 + x^3 + x^4 + ...\]

\[ \sum _{n=0}^{\infty} x^n \]

library(pracma)
c = -5
f <- function(x) {1/(1-x)} 
A1 <- taylor(f, x0=c, 5)
A1
## [1]    1.000293   25.007447  250.076532 1250.401437 3126.111100 3126.512977
plot(A1)

Problem 2.

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

\[f(0)=1\] \[f'(0)/1!*(x)* 1 =1*x=x\]

\[f'(0)=x\]

\[ f''(0)/2!*(x) 2 =1/2*(x) 2 =x^2 /2\]

\[ f''(0) = x^2/2 \]

\[ f ''' (0)/3!*(x) 3 =1/6*(x)^ 3 =x^3/6 \]

\[ f'''=x^3/6\]

So the Taylor series for f(x)=e x
\[ f(x)= 1 + x + \frac {x^2}{2} + \frac {x^3}{6} + \frac {x^4} {24} + .. \]

\[ \sum _{n=0}^{\infty} \frac{x^n}{n!} \]

c = -5
f <- function(x) {exp(x)} 
A2 <- taylor(f, x0=c, 5)
A2
## [1]  0.008334245  0.208636869  2.090299109 10.480131597 26.309539362
## [6] 26.485006242
plot(A2)

Problem 3.

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

\[f'(x) = \frac {1}{1+x} \]

\[f''(x) = \frac {-1}{(1+x)^2} \]

\[f'''(x) = \frac {2}{(1+x)^3} \]

\[f(x) + \frac {f'(x)} {1!} x^1 + \frac {f''(x)} {2!} x^2 \]

\[ f(x) = f(0) +f'(0)(x - c) + \frac {f''(c)}{2!} (x-c)^2 + \frac {f'''(c)}{3!} (x- c)^3 + \]

\(So the Taylor series for f(x)=ln(1+x) is:\)

\[ f(x) = x - \frac {1} {2} x^2 + \frac {1}{3} x^3 - \frac {1}{4} x^4 + ... \]

\[ \sum _{n=1}^{\infty} (-1)^{n+1} * \frac{x^n}{n} \]

c = 0
f <- function(x) {log(1+x)} 
A3 <- taylor(f, x0=c, 5)
A3
## [1]  0.2000413 -0.2500044  0.3333339 -0.5000000  1.0000000  0.0000000
plot(A3)