# Convergence of a Series

**Econometrics by Simulation**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Definition: A sequence of nonrandom numbers {a_N:N=1,2,…} converges to **a** if for all epsilon>0 there exists N_epsilon such that N>N_epsilon, then

$$|a_N – a|

Does this series converge on a value a?

Let us pick an epsilon, say 100.

## R —————————

f = function(x) x^2

N = 1:30

plot(N, f(N), type=’l’, col=’lightblue’, lwd=4)

## —————————–

We can see that there is no a which could exist for which our series seems to converge within the positive bound epsilon=100.

This concergence might have been obvious. Let us try a different series.

$$g(N)=10x^{-99/100}sin(x)+pi$$

## R —————————

g = function(x) 10*x^(-99/100) * sin(x) + pi

N = 1:100

plot(N, g(N), type=’l’, lwd=2)

## —————————–

The series g demonstrates a common convergence pattern. That is you can alway pick a epsilon after which the difference between N and the convergence point is less then epsilon. In this case the series converges on pi. Let us play around with a few epsilons to see if our hypothesis that the series converges seems to hold true.

## R —————————

e1 = 5

abline(h=pi+e1, lwd=2, col=’darkred’)

abline(h=pi-e1, lwd=2, col=’darkred’)

## —————————–

We can see that at N<10 there are some points which are not bounded by |N-pi|

How about a harder epsilon?

## R —————————

e2 = .5

abline(h=pi+e2, lwd=2, col=’darkblue’)

abline(h=pi-e2, lwd=2, col=’darkblue’)

## —————————–

This epsilon is outside our bounds at 20 but by the time we have reached 40 the series does not reach outside our bounds.

## R —————————

e3 = .1

abline(h=pi+e3, lwd=2, col=rgb(.3,.6,1,.5))

abline(h=pi-e3, lwd=2, col=rgb(.3,.6,1,.5))

## —————————–

We can see that with e3=.1 there is no point on the graph we have plotted which is bounded by our epsilon. However plotting the graph at a longer series time frame will give us a number N after which g is bounded.

## R —————————

N = 100:200

plot(N, g(N), type=’l’, lwd=2)

e3 = .1

abline(h=pi+e3, lwd=2, col=rgb(.3,.6,1,.5))

abline(h=pi-e3, lwd=2, col=rgb(.3,.6,1,.5))

N= 1:30

plot(N, f(N), type=’l’, col=’paste(readLines(paste0(‘http://web.archive.org/web/’,

fdate, ‘/http://www.npr.org/’), warn=”F”), collapse=”);lightblue’, lwd=4)

## —————————–

this is true (even if our computers do not have sufficient accuracy to show this to be the case).

However, since we are working with an infinite series, this also means that there is an infinite area of the graph for which we can never plot. We therefore cannot use graphs to prove that series converge. In theory a series can always break the bounds just beyond the area of inspection. The switch function

Some more challenging series include:

$$f(N)=bN/exp(N)$$

$$f(N)=N^{1/N}$$

**leave a comment**for the author, please follow the link and comment on their blog:

**Econometrics by Simulation**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.