Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Name : Aman Gola

Roll No. : 2132161


Date : 26th April, 2022
Practical 5A : Plotting of Recursive sequences and their
Convergence.

Q1. x1 = 1 , xn+1 = 3 xn + 1

Rseq = RecurrenceTable[{x[n + 1]  3 x[n] + 1, x[1]  1}, x, {n, 20}]


ListPlot[Rseq, PlotStyle  {Red, PointSize[Large]}]
In[ ]:=

Print["From the graph it can be concluded


that the given recursive sequence is not convergent."]

{1, 4, 13, 40, 121, 364, 1093, 3280, 9841, 29 524, 88 573, 265 720, 797 161,
2 391 484, 7 174 453, 21 523 360, 64 570 081, 193 710 244, 581 130 733, 1 743 392 200}
Out[]=

1.5 × 108

1.0 × 108

Out[]=

5.0 × 107

5 10 15 20

From the graph it can be concluded


that the given recursive sequence is not convergent.

Q2. x1 = 2 , xn+1 = xn + 2
2 2132161Aman Goal-P05.nb

Rseq = RecurrenceTable[{x[n + 1]  x[n] + 2, x[1]  2}, x, {n, 20}]


ListPlot[Rseq, PlotStyle  {Red, PointSize[Large]}]
In[ ]:=

Print["From the graph it can be concluded that the given recursive sequence is not convergent"]

Out[]= {2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40}

40

30

Out[]= 20

10

5 10 15 20

From the graph it can be concluded that the given recursive sequence is not convergent

Q3. x1 = 2 , xn+1 = 1
2
 xn + 2
xn
 .

Rseq = NRecurrenceTablex[n + 1]  x[n] + , x[1]  2, x, {n, 20}


1 2
x[n]
In[ ]:=
2
ListPlot[Rseq, PlotStyle  {Red, PointSize[Large]}]
Print"From the graph it can be concluded that the given recursive sequence is convergent to 2 "

{2., 1.5, 1.41667, 1.41422, 1.41421, 1.41421, 1.41421, 1.41421, 1.41421, 1.41421,
1.41421, 1.41421, 1.41421, 1.41421, 1.41421, 1.41421, 1.41421, 1.41421, 1.41421, 1.41421}
Out[]=

1.41422

1.41422

1.41422

Out[]= 1.41422

1.41421

1.41421

5 10 15 20

From the graph it can be concluded that the given recursive sequence is convergent to 2

Q4. x1 = 3 , x2 = 5 , xn+2 = xn + xn+1


2132161Aman Goal-P05.nb 3

Q4. x1 = 3 , x2 = 5 , xn+2 = xn + xn+1

Rseq = N[RecurrenceTable[{x[n + 2]  x[n] + x[n + 1], x[1]  3, x[2]  5}, x, {n, 20}]]
ListPlot[Rseq, PlotStyle  {Red, PointSize[Large]}]
In[ ]:=

Print["From the graph it can be concluded that the given recursive sequence is not convergent"]

Out[]= {3., 5., 8., 13., 21., 34., 55., 89., 144., 233., 377., 610., 987., 1597., 2584., 4181., 6765., 10 946., 17 711., 28 657.}

15 000

10 000
Out[]=

5000

5 10 15 20

From the graph it can be concluded that the given recursive sequence is not convergent

Q5. x1 = 1 , x2 = 1 , xn+2 = xn + xn+1

Rseq = N[RecurrenceTable[{x[n + 2]  x[n] + x[n + 1], x[1]  1, x[2]  1}, x, {n, 20}]]
ListPlot[Rseq, PlotStyle  {Red, PointSize[Large]}]
In[ ]:=

Print["From the graph it can be concluded that the given recursive sequence is not convergent"]

Out[]= {1., 1., 2., 3., 5., 8., 13., 21., 34., 55., 89., 144., 233., 377., 610., 987., 1597., 2584., 4181., 6765.}

4000

3000

Out[]= 2000

1000

5 10 15 20

From the graph it can be concluded that the given recursive sequence is not convergent

Q6. x1 = 1 , x2 = 2 , xn =
xn+1 + xn
xn+1 - xn
4 2132161Aman Goal-P05.nb

x[n + 1] + x[n]
Rseq = NRecurrenceTablex[n + 2]  , x[1]  1, x[2]  2, x, {n, 20}
x[n + 1] - x[n]
In[ ]:=

ListPlot[Rseq, PlotStyle  {Red, PointSize[Large]}]


ListLinePlot[Rseq, PlotStyle  {Red, PointSize[Large]}]
Print["From the graph it can be concluded that the given recursive sequence is not convergent"]

{1., 2., 3., 5., 4., -9., 0.384615, -0.918033, 0.409487, -0.38308, -0.0333186, -1.19052,
1.05758, -0.0591331, -0.894095, 1.14164, 0.121601, -1.23842, 0.821178, -0.202585}
Out[]=

Out[]=
5 10 15 20

-2

-4

Out[]=
5 10 15 20

-2

-4

From the graph it can be concluded that the given recursive sequence is not convergent

Q7. x1 = 1 , xn+1 = 2 + xn
2132161Aman Goal-P05.nb 5

In[ ]:= Rseq = NRecurrenceTablex[n + 1]  2 + x[n] , x[1]  1, x, {n, 20}


ListPlot[Rseq, PlotStyle  {Red, PointSize[Large]}]
ListLinePlot[Rseq, PlotStyle  {Red, PointSize[Large]}]
Print["From the graph it can be concluded that the given recursive sequence is convergent to 2"]

{1., 1.73205, 1.93185, 1.98289, 1.99572, 1.99893,


1.99973, 1.99993, 1.99998, 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., 2.}
Out[]=

2.00

1.99

1.98
Out[]=

1.97

1.96

5 10 15 20

2.00

1.99

1.98
Out[]=

1.97

1.96

5 10 15 20

From the graph it can be concluded that the given recursive sequence is convergent to 2

Practical 05 B : Study the convergence of sequences


through plotting.
1
Q1.
n
6 2132161Aman Goal-P05.nb

seq = Table , {n, 100};


1
In[ ]:=

ListPlot[seq]
n

Print["From the graph it can be concluded that the sequence is convergent."]

0.12

0.10

0.08

Out[]= 0.06

0.04

0.02

20 40 60 80 100

From the graph it can be concluded that the sequence is convergent.

Q2. 1 + (- 1)n

seq = Table[1 + (-1)n , {n, 10}]


ListLinePlot[seq]
In[ ]:=

Print["From the graph it can be concluded that the sequence is not convergent"]

Out[]= {0, 2, 0, 2, 0, 2, 0, 2, 0, 2}

2.0

1.5

Out[]= 1.0

0.5

2 4 6 8 10

From the graph it can be concluded that the sequence is not convergent

(-1)n
Q3.
n
2132161Aman Goal-P05.nb 7

(-1)n
In[ ]:= seq = Table , {n, 10}

ListPlot[seq]
n

Print["From the graph it can be concluded that graph is convergent towards 0"]

-1, ,- , ,- , ,- , ,- , 
1 1 1 1 1 1 1 1 1
Out[]=
2 3 4 5 6 7 8 9 10

0.5

2 4 6 8 10

Out[]=

-0.5

-1.0

From the graph it can be concluded that graph is convergent towards 0

n(n+1)
1
Q4.
8 2132161Aman Goal-P05.nb

seq = Table , {n, 10}


1
n (n + 1)
In[ ]:=

ListPlot[seq]
Print["The graph shows that it is convergent towards 0"]

 , 
1 1 1 1 1 1 1 1 1 1
Out[]= , , , , , , , ,
2 6 12 20 30 42 56 72 90 110

0.5

0.4

0.3

Out[]=

0.2

0.1

2 4 6 8 10

The graph shows that it is convergent towards 0

n +2
1
Q5. 2
2132161Aman Goal-P05.nb 9

seq = Table , {n, 10}


1
n2 + 2
In[ ]:=

ListPlot[seq]
Print["The graph shows that it is convergent towards 0"]

 , 
1 1 1 1 1 1 1 1 1 1
Out[]= , , , , , , , ,
3 6 11 18 27 38 51 66 83 102

0.35

0.30

0.25

0.20

Out[]=
0.15

0.10

0.05

2 4 6 8 10

The graph shows that it is convergent towards 0

n+1
2n
Q6.

seq = Table , {n, 50};


2n
n+1
In[ ]:=

ListPlot[seq]
Print["The graph shows that it is convergent towards 2"]

1.9

1.8

Out[]=

1.7

1.6

10 20 30 40 50

The graph shows that it is convergent towards 2

Q7. - n2
- n2
10 2132161Aman Goal-P05.nb

Q7.

seq = Table-n2 , {n, 10};


ListPlot[seq]
In[ ]:=

Print["The graph shows that it is not convergent"]

2 4 6 8 10

-20

-40

Out[]=

-60

-80

-100

The graph shows that it is not convergent

sin(n)
Q8.
n

Sin[n]
In[ ]:= seq = Table , {n, 75};

ListLinePlot[seq]
n

Print["The graph shows that it is convergent towards 0"]

0.10

0.05

Out[]=
10 20 30 40 50 60 70

-0.05

-0.10

The graph shows that it is convergent towards 0

n+1
n2
Q9.
2132161Aman Goal-P05.nb 11

seq = Table , {n, 100};


n2
n+1
In[ ]:=

ListPlot[seq]
Print["The graph shows that it is not convergent"]

100

80

60

Out[]=

40

20

20 40 60 80 100

The graph shows that it is not convergent

Q10. - 2n
seq = Table[-2n , {n, 20}];
ListPlot[seq]
In[ ]:=

Print["The graph shows that it is not convergent"]

5 10 15 20

-50 000

-100 000

-150 000
Out[]=

-200 000

-250 000

-300 000

The graph shows that it is not convergent

1
Q11.
3n
12 2132161Aman Goal-P05.nb

seq = Table , {n, 50};


1
In[ ]:=
3n
ListPlot[seq]
Print["The graph shows that it is convergent towards 0"]

0.00012

0.00010

0.00008

Out[]=
0.00006

0.00004

0.00002

10 20 30 40 50

The graph shows that it is convergent towards 0

1 + n1 
n
Q12.

seq = Table 1 + , {n, 100};


n
1
In[ ]:=
n
ListPlot[seq]
Print["The graph shows that it is convergent towards  = 2.71828"]

2.70

2.65

Out[]=

2.60

20 40 60 80 100

The graph shows that it is convergent towards  = 2.71828

1
log10 n+1
Q13.
2132161Aman Goal-P05.nb 13

seq = Table , {n, 100};


1
Log10[n + 1]
In[ ]:=

ListPlot[seq]
Print["The graph shows that it is not convergent"]

1.2

1.0

0.8

Out[]= 0.6

0.4

0.2

20 40 60 80 100

The graph shows that it is not convergent

n!
2n
Q14.

seq = Table , {n, 50};


2n
Factorial[n]
In[ ]:=

ListLinePlot[seq]
Print["The graph shows that it is convergent towards 0"]

0.0035

0.0030

0.0025

0.0020
Out[]=
0.0015

0.0010

0.0005

10 20 30 40 50

The graph shows that it is convergent towards 0

n -1
n +1
Q15.
14 2132161Aman Goal-P05.nb

n -1
seq = Table , {n, 50};
n +1
In[ ]:=

ListPlot[seq]
Print["The graph shows that it is convergent to 1"]

0.6

0.4
Out[]=

0.2

10 20 30 40 50

The graph shows that it is convergent to 1

Q16. (- 1)n
seq = Table[(-1)n , {n, 10}];
ListLinePlot[seq]
In[ ]:=

Print["The graph shows that it is not convergent"]

1.0

0.5

Out[]=
2 4 6 8 10

-0.5

-1.0

The graph shows that it is not convergent

You might also like