Common Maclaurin Series






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




\[1 + X + X^2 + X^3 + X^4 ... = \sum_{n=0}^\infty \ x^n\]



Interval of Convergence

(-1, 1)


The interval is bounded (only works) where x is between -1 and 1.


This function calculates the first 30 terms. Lets call it for \(x=.18\) and compare it with the actual result.


one_over_one_minus_x<-function(x) {
 Sn=0

 for (i in 0:30) {
  Sn<-Sn+x^i
 }

 return(Sn)
}

x<-.18

one_over_one_minus_x(x)

1/(1-x)
## [1] 1.219512
## [1] 1.219512




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




\[e^x \ = \ 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!} \ = \ \sum_{n=0}^\infty \ \frac{x^n}{n!}\]



Interval of Convergence

\((-\infty , \infty)\)


The interval is unbounded. The domain is all real numbers.


This function calculates the first 30 terms. Lets call it for \(x=8\) and compare it with the actual result.


e_to_the_x<-function(x) {

 Sn=0

for (i in 0:30) {
  num<-x^i
  den<-factorial(i)
  Sn<-Sn+(num/den)
}

 return(Sn)
}

x<-8

e_to_the_x(x)

exp(1)^x
## [1] 2980.958
## [1] 2980.958




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




note:

\[log(x) \ = \ \sum_{n=1}^\infty \ \frac{x^n (-1)^{n-1}}{n}\]

Interval of Convergence

\((-1 , 1]\)



The interval is bounded between -1 and 1 (1 works but -1 does not).




This function calculates the first 30 terms. Lets call it for \(x=-0.298653\) and compare it with the actual result.


natural_log<-function(x) {

 Sn=0

for (n in 1:30) {
  num<-x^n*(-1)^(n-1)
  den<-n
  Sn<-Sn+(num/den)
}

 return(Sn)
}

# x<--0.998653   this requires many many iterations
x<--0.298653
natural_log(x)

log(1+x)
## [1] -0.3547525
## [1] -0.3547525