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 an R- Markdown document.

  1. \[f(x)=\frac{1}{1-x}\]

We can find the derivatives of f(x): \[f'(c)=\frac{1}{(1-x)^2}, f''(c)=\frac{2}{(1-x)^3},f'''(c)=\frac{6}{(1-c)^4},f''''(c)=]frac{24}{(1-c)^5}\]

We look for the pattern of the nth term in the taylor series centered at c=0. The first term is skipped since we’re just looking for a pattern. \[\sum_{n=0}^\infty\frac{f^n(c)}{n!}(x-c)^n=\frac{1}{(1-c)^21!}(x-c)^1+\frac{2}{(1-c)^32!}(x-c)^2+\] \[+\frac{6}{(1-c)^43!}(x-c)^3+\frac{24}{(1-c)^54!}(x-c)^4\]

this simplifies to: \[=\sum_{n=0}^\infty\frac{1}{(1-c)^{n+1}}(x-c)^n\]

When centering this series on c = 0, you get: \[=\sum_{n=0}^\infty\frac{1}{(1)^{n+1}}(x)^n=1+x+x^2+x^3...\]

Using the ratio test, the range is determined: \[\lim_{n\to\infty}\frac{|x^{n+1}|}{|x^n|}=x\]

The limit converges on x if |x|<1.The range is [-1,1]

The coefficients are confirmed using R. Each degree has a weight of 1.

library(pracma)
f <- function(x) {1/(1-x)}
taylor(f, 0, 4)
## [1] 1.000029 1.000003 1.000000 1.000000 1.000000
  1. \[f(x)=e^x\]

We can find the derivatives of f(x): \[f'(c)=e^c,f''(c)=e^c,f'''(c)=e^c,f''''(c)=e^c\]

We look for the pattern of the nth term in the taylor series centered at c=0. The first term is skipped since we’re just looking for a pattern.

\[\sum_{n=0}^\infty\frac{f^n(c)}{n!}(x-c)^n=\frac{e^c}{1!}(x-c)^1+\frac{e^c}{2!}(x-c)^2+\frac{e^c}{3!}(x-c)^3+...\]

this can be simplified to: \[\sum_{n=0}^\infty\frac{e^c}{n!}(x-c)^n\]

When centering this series on c = 0, you get:

\[\sum_{n=0}^\infty\frac{1}{n!}(x)^n=1+x+\frac{x^2}{2}+\frac{x^3}{6}+...\]

Using the ratio test, the range is determined: \[\lim_{n\to\infty}\frac{|x^{n+1}|n!}{|x^n|(n+1)!}=\frac{|x|}{(n+1)}=0\]

The limit converges on 0 for all values of x.

The coefficients for the series is confirmed below.

f <- function(x) {exp(x)}
taylor(f, 0, 4)
## [1] 0.04166657 0.16666673 0.50000000 1.00000000 1.00000000
  1. \[f(x)=ln(1+x)\]

We can find the derivatives of f(x): \[f'(c)=\frac{1}{1+c},f''(c)=-\frac{1}{(1+c)^2},f'''(c)=\frac{2}{(1+c)^3},f''''(c)=-\frac{6}{(1+c)^4}\]

We look for the pattern of the nth term in the taylor series centered at c=0. The first term is skipped since we’re just looking for a pattern.

\[\sum_{n=0}^\infty\frac{f^n(c)}{n!}(x-c)^n=\frac{1}{(1+c)n!}(x-c)^1-\frac{1}{(1+c)^2n!}(x-c)^2+\] \[+\frac{2}{(1+c)^3n!}(x-c)^3-\frac{6}{(1+c)^4n!}(x-c)^4...\]

this can be simplified to: \[\sum_{n=0}^\infty\frac{(x-c)^n(-1)^{n+1}}{(1+c)^nn}=\] \[=0+x-\frac{x^2}{2}+\frac{x^3}{3}-\frac{x^4}{4}+...\] \[=\sum_{n=0}^\infty(-1)^{n+1}\frac{x^n}{n}\]

the ratio test: \[\lim_{n\to\infty}\frac{(-1)^{n+2}|x^{n+1}|n}{(n+1)(-1)^{n+1}|x^n|}=-\frac{|x|n}{(n+1)}=|x|\]

The limit converges when |x|<1. The range is [-1,1]

The coefficients of the series is confirmed using R:

f <- function(x) {log(1+x)}
taylor(f, 0, 4)
## [1] -0.2500044  0.3333339 -0.5000000  1.0000000  0.0000000
  1. \[f(x)=x^{1/2}\]

We can find the derivatives of f(x): \[f'(c)=\frac{1}{2c^{1/2}},f''(c)=-\frac{1}{4c^{3/2}},f'''(c)=\frac{3}{8c^{5/2}},f''''(c)=-\frac{15}{16c^{7/2}}\]

finding a pattern is complicated for this series so this is where R can come in handy. \[\sum_{n=0}^\infty\frac{f^n(c)}{n!}(x-c)^n=\frac{1}{2c^{1/2}n!}(x-c)^1-\frac{1}{4c^{3/2}n!}(x-c)^2+\] \[+\frac{3}{8c^{5/2}n!}(x-c)^3-\frac{15}{16c^{7/2}n!}(x-c)^4+...\]

Unlike the other functions, this series cannot be centered at c=0 so c will be centered at c=1. The function centered at 0 does not have a solution. \[\sum_{n=0}^\infty\frac{f^n(1)}{n!}(x-1)^n=1+\frac{x-1}{2}-\frac{(x-1)^2}{8}+\frac{3(x-1)^3}{48}-\frac{15(x-1)^4}{384}+...\]

f <- function(x) {x^(1/2)}
taylor(f, 1, 4)
## [1] -0.03906285  0.21875150 -0.54687738  1.09375167  0.27343706