Numerical Sequences

Numerical Sequences

Let us begin by analyzing the sequence  (((e^k)(((k!))^2)(k^2))/((2k)!))

We can create a table that displays a list of consecutive values of the sequence:

Clear[k]

Table[((Exp[k](((k!))^2)(k^2))/((2k)!)), {k, 1, 30}]

N[%]

We can use the Limit command to find the limit of a convergent sequence:

Limit[((Exp[k](((k!))^2)(k^2))/((2k)!)), k->∞]

Here is a more familiar example:

Clear[n]

Limit[(((1+ (3/n)))^n),n->∞]

Or we can plot the first sequence:

ListPlot[Table[((Exp[k](((k!))^2)(k^2))/((2k)!)), {k, 1, 35}], PlotStyle->{Blue}]

Or the second sequence:

ListPlot[Table[(((1+ (3/n)))^n), {n, 1, 80}], PlotStyle->{Red}, AxesOrigin->{0,0}]

Note that AxisOrigin->{0,0} requires the graph to include the x and y-axes!

Recursively-Defined Sequences

Let us consider the recursive example:    a[1]=7, a[n+1]=((a[n])/2)+1 for n>1

Clear[a, i]

RecurrenceTable[{a[i+1]==((a[i])/2)+1,a[1]==7},a,{i,1,20}]

N[%]

ListPlot[RecurrenceTable[{a[i+1]==((a[i])/2)+1,a[1]==7},a,{i,1,25}], AxesOrigin->{0,0}, PlotStyle->{Green}]

To find the limit of this sequence, we define a recursive function and then use the Nest command.

Clear[f, x]

f[x_]:= (x/2)+1

Nest[f,7.0,1000]

Here the 7.0 represents the initial value of the sequence, a[0], and 100 represents the number of times we apply the recursive formula; in this case we obtain a[1000].

Next, let's consider another example of a recursive sequence:     a[1]=1, a[2]=2, a[n+2]=Sin[a[n]+a[n+1]] for n>0

Clear[a, n]

table =RecurrenceTable[{a[n+2]==Sin[a[n]+a[n+1]],a[1]==1, a[2]==2},a,{n,1,10}]

N[table]

ListPlot[table , AxesOrigin->{0,0}, PlotStyle->{Blue}, AxesLabel->{"n", "(Subscript[a, n])"}]

To connect the dots, use Joined->True:

ListPlot[table , AxesOrigin->{0,0}, AxesLabel->{"n", "(Subscript[a, n])"}, Joined->True,PlotStyle->{Blue}]

Next, let's consider the recursive sequence  c[1]=4, and  c[n+1]=((c[n])/(Log[c[n]])) for n>1.

Clear[c, n, g]

tableC=RecurrenceTable[{c[j+1]==((c[j])/(Log[c[j]])),c[1]==4},c,{j,1,7}]

N[tableC]

ListPlot[tableC, AxesOrigin->{0,0},Joined->True, PlotStyle->{Orange}]

g[x_]:= (x/(Log[x]))

Nest[g,4.0, 1000]

Consider the sequence d[n+1]=3*d[n]-0.05*((d[n-1])^2), d[1]=2

Clear[n, d]

tableD = RecurrenceTable[{d[n]== 3*d[n-1]- 0.05 *((( d[n-1]))^2), d[1]==2}, d, {n,1,80}]

ListPlot[tableD, AxesOrigin->{0,0},Joined->True, PlotStyle->{Blue}]

Clear[w, n, sequence1]

Consider the sequence w[n+1]=Cos w[n], w[1]=4

tableW = RecurrenceTable[{w[n+1]== Cos[w[n]], w[1]==4.0}, w, {n,1,35}]

ListPlot[tableW,  Joined->{True},PlotStyle->{Blue}]

f[x_]:= Cos[x]

Nest[f,1.0,1000]