Section 11.1: Sequences

Review

Questions

Evaluate (∫_1^∞)(1/(x^π))d x and (∫_1^∞)(1/(x^0.1))d x.

For which exponents p does (∫_1^∞)(1/(x^p))d x converge?

Plot[{x^{-Pi},x^{-.1}},{x,1,3},Filling->Axis,PlotLegends->{"1/x^Pi","1/x^.1"}]

Questions

Evaluate (∫_0^1)(1/(x^π))d x and (∫_0^1)(1/(x^0.1))d x.

For which exponents p does (∫_0^1)(1/(x^p))d x converge?

Plot[{x^{-Pi},x^{-.1}},{x,.3,1},Filling->Axis,PlotLegends->{"1/x^Pi","1/x^.1"}]

Approximations

Questions

Use the trapezoid rule to approximate (∫_0^1)cos((Sqrt[x]))d x

f[x_]:=Cos[Sqrt[x]]
Plot[f[x],{x,0,1}]
exact=NIntegrate[f[x],{x,0,1}]

using n=1

LRR=f[0.0];
RRR=f[1.0];
trap=(LRR+RRR)/2
error=trap-exact

using n=2

npts=2
deltaX=(1-0)/npts;
LRR=deltaX*Sum[f[0.0+(i-1)*deltaX],{i,1,npts}];
RRR=deltaX*Sum[f[0.0+i*deltaX],{i,1,npts}];;
trap=(LRR+RRR)/2
error=trap-exact

using n=3

npts=3
deltaX=(1-0)/npts;
LRR=deltaX*Sum[f[0.0+(i-1)*deltaX],{i,1,npts}];
RRR=deltaX*Sum[f[0.0+i*deltaX],{i,1,npts}];;
trap=(LRR+RRR)/2
error=trap-exact

Trap[npts_]:=Module[{deltaX=(1-0)/npts,LRR,RRR,trap,error},
LRR=deltaX*Sum[f[0.0+(i-1)*deltaX],{i,1,npts}];
RRR=deltaX*Sum[f[0.0+i*deltaX],{i,1,npts}];
trap=(LRR+RRR)/2;
error=trap-exact;
Print[{trap,error}];
trap
]
Trap[3]

using n=4

Trap[4]

What do we expect to happen as we use larger and larger values of n in the trapezoid rule?

npts=10;
traps=Table[{n,Trap[n]},{n,1,npts}]
allplots=ListPlot[{traps},PlotMarkers->{{▲,10}},PlotLegends->{"traps"}];
eplot=ListLinePlot[{{0,exact},{npts,exact}},PlotLegends->{"exact"}];
Show[allplots,eplot,PlotRange->All]

Questions

A standard way to approximate the square root of a value is as follows. This method was known to the Babylonians, a few thousand years ago.... To approximate (Sqrt[a])

Make a rough estimate for the value of (Sqrt[a]). Call it the first approximation (Subscript[x, 1]).

The second approximation is (Subscript[x, 2])=0.5((Subscript[x, 1])+(a/(Subscript[x, 1]))).

The third approximation is (Subscript[x, 3])=0.5((Subscript[x, 2])+(a/(Subscript[x, 2]))).

In general, the (n^th) approximation is (Subscript[x, n])=0.5((Subscript[x, n-1])+(a/(Subscript[x, n-1]))).

Use this scheme to find the fourth approximation to (Sqrt[2]) using (Subscript[x, 1])=2.

sqrootImprove[a_,x_]:=0.5(x+a/x)
sqrootIterate[a_,x_,n_]:=If [n>1,sqrootIterate[a,sqrootIterate[a,x,n-1],n-1],sqrootImprove[a,x]]
sqrootImprove[2,2]
sqrootIterate[2,2,1]
sqrootIterate[2,2,2]
sqrootIterate[2,2,3]
sqrootIterate[2,2,4]
exact=Sqrt[2.0]

Do the approximations improve as n gets larger?

npts=10;
sqr=Table[{n,sqrootIterate[2,2,n]},{n,1,npts}];
allplots=ListPlot[{sqr},PlotMarkers->{{▲,10}},PlotLegends->{"approximations"}];
eplot=ListLinePlot[{{0,exact},{npts,exact}},PlotLegends->{"exact"}];
Show[allplots,eplot,PlotRange-> All]

This method is an example of “Newton’s method” (section3.8), which is a very general method for finding roots (zeros) of functions.

Sequences

Definition

A sequence is an infinite list of numbers written in a definite order
	(Subscript[a, 1]),(Subscript[a, 2]),(Subscript[a, 3]),…,(Subscript[a, k]),…

Examples

1,2,3,4,5,…

1,(1/2),(1/3),(1/4),(1/5),…

-1,2,-3,4,-5,6,-7,8,…

Forms

Besides writing a sequence as a list we will also write some sequences

as formulas: for example (Subscript[{(n/(2^n))}, n=1]^∞)

recursively: for example (Subscript[f, 1])=1, (Subscript[f, 2])=1, (Subscript[f, n])=(Subscript[f, n-1])+(Subscript[f, n-2])

Limits

Frequently, but not always, sequences {(Subscript[a, n])} are lists of approximations that converge to some desired exact values. 
	(lim_(n->∞))(Subscript[a, n])

Questions

Do any of the above sequences converge? If so, to what values?

(Subscript[x, 1])=2, (Subscript[x, n])=0.5((Subscript[x, n-1])+(a/(Subscript[x, n-1])))

1,(1/2),(1/3),(1/4),(1/5),…

-1,2,-3,4,-5,6,-7,8,…

1,-(1/4),(1/9),-(1/16),(1/25),-(1/36),…

(Subscript[{(n/(2^n))}, n=1]^∞)

(Subscript[f, 1])=1, (Subscript[f, 2])=1, (Subscript[f, n])=(Subscript[f, n-1])+(Subscript[f, n-2])

Techniques

Technique 1

If (Subscript[a, n])=f(n) where f is a real-valued function, then (lim_(n->∞))(Subscript[a, n])=(lim_(x->∞))f(x).

Questions

Find (lim_(n->∞))(n/((n^2)+1)) by evaluation the limit (lim_(x->∞))(x/((x^2)+1)).

For which of the above sequences can you use this technique?

Technique 2

If (lim_(n->∞))|(Subscript[a, n])|=0, then (lim_(n->∞))(Subscript[a, n])= 0.

Question

Does this technique apply to any of the above limits?

For which values of r does the sequence {(r^n)} converge?

Monotonic sequences

Questions

What should we mean by an increasing sequence?

What is an example of an increasing sequence?

What should we mean by a decreasing sequence?

What is an example of an decreasing sequence?

What is an example of a sequence that is neither increasing nor decreasing?

Definition

A sequence that is either increasing or decreasing is said to be monotonic.

Bounded sequences

What should we mean by a sequence that is bounded above?

What is an example of a sequence that is bounded above?

What should we mean by a sequence that is bounded below?

What is an example of a sequence that is bounded below?

Technique 3

A bounded, monotonic sequence converges.

You might think this way:  the sequence has to go somewhere -- it’s constantly increasing (say), and yet it can’t go past a certain point -- so it has to go somewhere between where it is at any moment and that upper bound. Furthermore, this is true even as long as the sequence is eventually monotonic. 

You might think this way: no finite chunk of a sequence at the beginning has any impact on convergence. Convergence is a property of the long tail, as the index sails off to infinity.

Questions

Consider the sequence  (Subscript[{(n/(2^n))}, n=1]^∞).

ListPlot[Table[{n,n/2^n},{n,1,10}]]

Is this sequence monotonic?

Is this sequence bounded?