166 SCW, 11.1: Examples of Sequences

Example1(a):
a
n
=1-
1
n

In[]:=
a[n_]:=1-1/n
In[]:=
t1[n_]:=Table[a[i],{i,1,n}]
t1[20]
Out[]=
0,
1
2
,
2
3
,
3
4
,
4
5
,
5
6
,
6
7
,
7
8
,
8
9
,
9
10
,
10
11
,
11
12
,
12
13
,
13
14
,
14
15
,
15
16
,
16
17
,
17
18
,
18
19
,
19
20

Manipulate[Show[ListPlot[t1[m],PlotRange->{{0,20.1},{-0.1,2}}],Plot[1,{x,1,20},PlotStyle->Red,PlotRange->{{0,20.1},{-0.1,2}}]],{m,1,20,1},ControlPlacement->Top]
Out[]=
​
m
ShowListPlot[t1[20],PlotRange{{0,20.1},{-0.1,2}}],
0
5
10
15
20
0.0
0.5
1.0
1.5
2.0


Example1(b):
b
n
=1+
n
(-1)
n
:

In[]:=
b[n_]:=1+((-1)^n)*(1/n)
In[]:=
t1b[n_]:=Table[b[i],{i,1,n}]
t1b[20]
Out[]=
0,
3
2
,
2
3
,
5
4
,
4
5
,
7
6
,
6
7
,
9
8
,
8
9
,
11
10
,
10
11
,
13
12
,
12
13
,
15
14
,
14
15
,
17
16
,
16
17
,
19
18
,
18
19
,
21
20

Manipulate[Show[ListPlot[t1b[m],PlotRange->{{0,20.1},{-0.1,2}}],Plot[1,{x,1,20},PlotStyle->Red,PlotRange->{{0,20.1},{-0.1,2}}]],{m,1,20,1},ControlPlacement->Top]
Out[]=
​
m
ShowListPlot[t1b[20],PlotRange{{0,20.1},{-0.1,2}}],
0
5
10
15
20
0.0
0.5
1.0
1.5
2.0


Example1(c):
c
n
=
n
(-1)
:

In[]:=
c[n_]:=(-1)^n
In[]:=
t1c[n_]:=Table[c[i],{i,1,n}]
t1c[20]
Out[]=
{-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1}
Manipulate[Show[ListPlot[t1c[m],PlotRange->{{0,20.1},{-2,2}}],Plot[{1,-1},{x,1,20},PlotStyle->{Red,Green},PlotRange->{{0,20.1},{-2,2}}]],{m,1,20,1},ControlPlacement->Top]
Out[]=
​
m
ShowListPlot[t1c[20],PlotRange{{0,20.1},{-2,2}}],
5
10
15
20
-2
-1
0
1
2


Example1(d):
d
n
=.99:

In[]:=
d[n_]:=.99
In[]:=
t1d[n_]:=Table[d[i],{i,1,n}]
t1d[20]
Out[]=
{0.99,0.99,0.99,0.99,0.99,0.99,0.99,0.99,0.99,0.99,0.99,0.99,0.99,0.99,0.99,0.99,0.99,0.99,0.99,0.99}
Manipulate[Show[ListPlot[t1d[m],PlotRange->{{0,20.1},{-0.1,2}}],Plot[0.99,{x,1,20},PlotStyle->Red,PlotRange->{{0,20.1},{-0.1,2}}]],{m,1,20,1},ControlPlacement->Top]
Out[]=
​
m
ShowListPlot[t1d[20],PlotRange{{0,20.1},{-0.1,2}}],
0
5
10
15
20
0.0
0.5
1.0
1.5
2.0
