Comparing growth

Ivan Cnop
icnop@vub.ac.be

Growth of polynomial functions

Comparing polynomials on large intervals.

A race to infinity

Compare  {8 (x^2),  .2 (x^3)} on different intervals

Plot[{8 (x^2),.2 (x^3)},{x, -3, 6},PlotRange -> All,PlotStyle -> {Hue[0], Hue[0.4]}]

Plot[{8 (x^2),.2  (x^3)},{x, 3, 40}
	,PlotRange -> All,
	PlotStyle -> {Hue[0], Hue[0.4 ]}]

Plot[{8 (x^2),.2  (x^3)},{x, 3, 100}
	,PlotRange -> All,
	PlotStyle -> {Hue[0], Hue[0.4 ]}]

In the end, the higher power takes over. 
    The problem is that we do not know how far we have to plot to see this phenomenon.
Let us make an animation that can run as far as we want:

Do[Plot[{8 x^2,.2  x^3},{x, 5 j, 10 j}
	,PlotRange -> All
			,PlotStyle -> {Hue[0], Hue[0.4 ]}
		,Axes -> None]
,{j, 20}]

We will be able to select functions for which we still have to wait longer to see this happen. 
We have to scroll further to the right on the screen to see what we want.
So we will try to do the opposite later on: bring arbitrarily large values of the variable on the screen.

Experiment with different functions.

Try to find functions that overtake each other for larger values of x

Quotients

Making quotients explains why exponents decide growth of powers. 
Next compare :

(Subscript[f, 1])[x_] :=  4 (x^2) - 3 x  -  10

(Subscript[f, 2])[x_] :=   .4 (x^2) +  x  +  10

Plot[{ (Subscript[f, 1])[x],(Subscript[f, 2])[x] },{x, 3, 100}
	,PlotRange -> All,
	PlotStyle -> {Hue[0], Hue[0.4 ]}]

Plot[{ (Subscript[f, 1])[x],(Subscript[f, 2])[x] },{x, 3, 1000}
	,PlotRange -> All,
	PlotStyle -> {Hue[0], Hue[0.4 ]}]

Plot[{ (Subscript[f, 1])[x]/(Subscript[f, 2])[x] },{x, 3, 1000}
	,PlotRange -> All,
	PlotStyle -> {Hue[0], Hue[0.4 ]}]

Comparing powers near the origin.

Compare  { (x^2), 20 (x^3)} on different intervals

Plot[{ (x^2),20 (x^3)},{x, 0, 1},PlotRange -> All,PlotStyle -> {Hue[0], Hue[0.4]}]

Plot[{ (x^2),20 (x^3)},{x, 0,  .01},PlotRange -> All,PlotStyle -> {Hue[0], Hue[0.4]}]

Plot[{(x^2),20 (x^3)},{x, 0,  .0001},PlotRange -> All,PlotStyle -> {Hue[0], Hue[0.4]}]

Well, close to the origin the higher exponent gets much flatter, makes better contact with the horizontal axis.

Experiment with different functions.

Try to find functions that show different contact behavior for even smaller values of x.

Shifting functions makes this happen at another point

Plot[{ (((x - 1))^2),20 (((x - 1))^3)},{x, -2, 4},PlotRange -> All,PlotStyle -> {Hue[0], Hue[0.4]}]

Plot[{ (((x - 1))^2),20 (((x - 1))^3)},{x,  .95, 1.05},PlotRange -> All,PlotStyle -> {Hue[0], Hue[0.4]}]

Plot[{ (((x - 1))^2),20 (((x - 1))^3)},{x,  .9999, 1.0001},PlotRange -> All,PlotStyle -> {Hue[0], Hue[0.4]}]

Discuss what you see in these these graphs.

Experiment with different functions.

Try  the functions (((x - 1))^2),20 (((x - 1))^4) and many more.

Roots and powers.

\(Compare\ \ {x\^2, 20\ x\^ .5}\)

Plot[{(x^2),20 \(x\^ .5\)},{x, -3, 6},PlotRange -> All,PlotStyle -> {Hue[0], Hue[0.4]}]

Do[Plot[{(x^2),20 \(x\^ .5\)},{x, 5 j, 10 j}
	,PlotRange -> All
			,PlotStyle -> {Hue[0], Hue[0.4 ]}
		,Axes -> None]
,{j, 20}]

Running faster to infinity.

A previous notebook shows how to squeeze the full half line into a computer screen

Select a rescaling function on an interval [-a,a] such as the   s   above

a = 10; numbers = 12

s(u_) = (30/((a - u)));

Other choices are possible and will do and may have influence on the graph, but not on the limit value. 
Next we perform the inversion and use the values at whole values of variables:

u[t_] = u /. Solve[s[u] == t, u];
sLabels = 
        Transpose[{First[u[t] /. t -> Range[1, numbers]], 
            Range[1, numbers]}];
sMarks = 
        Transpose[
{First[
              u[t] /. t -> Range[numbers + 1, 100]], 
            Table[" ", {j, 
                Length[Range[numbers + 1, 
                    100]]}
]}];
sTicks = Union[sLabels, sMarks];

This is the programming we can include to "compactify" the positive real half line.

Plot[((x^2) - 1)/((x^2) + 1) /. x -> s[u],{u, -10, 10}
	,PlotRange -> {-1, 1}
,Ticks -> {sTicks, Automatic},AxesOrigin -> {0, 0}]

Plot[{ (Subscript[f, 1])[x]/(Subscript[f, 2])[x] }/.x -> s[u],{u, -10, 10}
	,PlotRange -> All]

Plot[Sin[x],{x, -50, 50}
	,PlotRange -> {-1, 1}
,Ticks -> Automatic]

But rememeber that we have to stretch this graph by a factor  50  to have the right aspect ratio .
Now we use the compression of the graph to extend it over the full positive half line:

Plot[(Sin[x]) /. x -> s[u],{u, 0, 10}
	,PlotRange -> {-1, 1}
,Ticks -> {sTicks, Automatic},Axes -> {Automatic, None}]

Imagine a bulldozer coming in from    +∞  on the real axis and shoving all the humps until they fit in a finite interval on our computer screen. 
This is exactly what we have been doing to the graph.

Exponential functions and powers.

Do[Plot[{100 (x^2),(2^x)},{x, j, 10 +  j}
	,PlotRange -> All
			,PlotStyle -> {Hue[0.4], Hue[0.7]}
	,AxesOrigin -> {j, 0}]
,{j, 10}]

Do[Plot[{1000 (x^2),(E^x)},{x, j, 10 +  j}
	,PlotRange -> All
			,PlotStyle -> {Hue[0.4], Hue[0.7]}
	,AxesOrigin -> {j, 0}]
,{j, 10}]

The sandwich theorem

A classic.

Limit[Sin[x]/x, x -> 0]

Plot[Sin[x]/x,{x, -10, 15}
	,PlotRange -> {-1.5, 1.5}
	,PlotStyle -> {Hue[0]}]

Plot[{Sin[x]/x, Sin[x], 1/x},{x, -10, 15}
	,PlotRange -> {-2, 2}
	,PlotStyle -> {Hue[0], Hue[0.3], Hue[0.6]}]

Show[%,AspectRatio -> Automatic]

Proof of the limit sin(x)/x theorem.

Plot[{x,Sin[x],Tan[x]},{x, -1, 2}
	,PlotRange -> {-1.5, 2}
	,PlotStyle -> {GrayLevel[0], Hue[0.3], Hue[0.6]}
	,AspectRatio -> Automatic]

Plot[ArcTan[x],{x, -10, 10}
	,PlotRange -> {-1.5, 2}
	,AspectRatio -> Automatic]

Plot[{x/Sin[x],1,1/Cos[x]},{x, -1, 2}
	,PlotRange -> {-1.5, 2}
	,PlotStyle -> {Hue[0], GrayLevel[0], Hue[0.6]}
	,AspectRatio -> Automatic]

Do[Plot[Sin[j x]/x,{x, -5, 10}
	,PlotRange -> {-1, 5}
			,PlotStyle -> Hue[0.1 (j - 1)]
,AspectRatio -> Automatic]
,{j, 6}]

A bonus.

\(From\ the\ tangent\ graph\ , \ \ we\ learn\ that\ the\ tangent\ function\ \ is\ a\ good\ candidate\ for\ a\ rescaling\ function\ \ \ s\ \ \ on\ the\ interval\ [\(-\(π\/2\)\), π\/2] . \ \ 
We\ can\ prove\ this\ also\ by\ noting\ the\ cosine\ tends\ to\ \ 0\ \ near\ \ π\/2\ \((\ 
        in\ a\ nearly\ linear\ way)\), 
Moreover\ we\ know\ its\ inverse, \ the\ arc\ tangent, \ 
    since\ it\ has\ \ a\ standard\ key\ on\ all\ \(\(calculators\)\(.\)\)\)

How steep is a graph?

Zoom in on roots of functions.

This can help to determine the location of a root.

Plot[x^3 - Sin[x] - 1,{x,-1.5,2}
	,PlotRange -> {-2, 5}
			,PlotStyle -> Hue[0.1]
,AspectRatio -> Automatic]

Show[%,PlotRange -> {{1, 2}, {-0.5, 0.5}}]

Show[%,PlotRange -> {{1  .2, 1.4}, {-0.  1, 0.  1}}]

For polynomials up to degree four we can find the exact values:

Solve[x^3 - x - 1 == 0, x] // N

epsilon-delta reasoning.

Look at what  delta  corresponds to different choices of  epsilon .

eps=0.1;
Do[
	Plot[{1/x, .5 2^j - eps, .5 2^j + eps},{x, 2^-j, 4 2^-j}
	,PlotStyle -> {Hue[ .6], Hue[0], Hue[0]}
		,PlotRange -> {{0, 3}, {0, 3}}
	,AspectRatio -> Automatic
		,AxesOrigin -> {0, 0}
		]
,{j, 0, 2}]

The best view is obtained by a cyclic animation

Do[
	Plot[
		{1/x,a,a - eps,a + eps},{x, 1/(a + eps), 1/(a - eps)}
	,PlotStyle -> {Hue[ .6], Hue[0  .6], Hue[0], Hue[0]}
	,AspectRatio -> Automatic
				,PlotRange -> {{ .2, 2}, {0, 3}}
		,AxesOrigin -> {0, 0}
		]
,{a, 0.5, 2.5, 0.2}]

Behavior of powers near the origin.

Plot different powers of  x  on the interval [0,1]

Clear[graf]

graf[f_,color_,left_,right_]:=
	Plot[Evaluate[f[x]],{x,left,right},
		PlotStyle->Hue[color],
		DisplayFunction->Identity
		]

g=Table[graf[#^n&,1/n,0,1],{n,1,12}]

Show[Release[g], DisplayFunction->$DisplayFunction
		,PlotRange->{{0,1},{0,1}}
		,AspectRatio->Automatic]

Near the origin large powers are making better contact to the horizontal axis.

Show[%,PlotRange -> {{0,  .1}, {0,  .1}}]

Uniform convergence of powers for small  x .

Consider the graphs of powers near the origin.
      We suspect convergence of these powers to the x-axis and try to visualise this

<<Graphics`Animation`

ShowAnimation[g
		,PlotRange->{{0,1},{0,1}}
		,AspectRatio->Automatic]

We have convergence to 0 at every point , except at 1 where all values are 1 .
Moreover, if we restrict ourselves to an interval   [0,b]  with   b<1  , the convergence on the interval is no slower than the convergence at   b  . 
We call this phenomenon uniform convergence on an interval.

Beware: outside the  [-1,1]  interval powers behave diffeerent!

left=-1;
right=2;

g=Table[graf[ #^n&,1/n,left,right],{n,1,12}]

Show[Release[g], DisplayFunction->$DisplayFunction
		,PlotRange->{{left,right},{-1,3}}
		,AspectRatio->Automatic]

The apparant rapid growth of  x^n  is negligible if we compare with the Exponential function

right=52;

g=Table[graf[#^n&,1/n,left,right],{n,1,12}]

Show[{Release[g],graf[Exp,1,left,right]}
		,DisplayFunction->$DisplayFunction
		,PlotRange->All
		]

Powers barely show on this plot

Moving to the right in an animation

Table[Show[{Release[g],graf[Exp,1,left,10 n]}
		,DisplayFunction->$DisplayFunction
		,PlotRange->{{left,10 n},{0,Exp[10 n]}}
		,Ticks->{{0,10 n},{0,Exp[10 n]}} 
		]
	,{n,1,7}]

A proof.

Proof that the exponential eventually grows faster than any power

Plot[{(E^x), x},{x, 0, 2},PlotRange -> {{0, 2}, {0, 5}},AspectRatio -> Automatic]

The exponential is always above the bissector. Replace  x  by  t/n

{(E^x), x} /. x -> t/n

\(%\^n\)

The values of   t   and   n   are arbitrary

\(% /. {\((u_\^\(t_\/n_\))\)\^n_ -> u\^t, \((t_/n_)\)\^n_ -> 
          t\^n/n\^n}\)

If  n  >  k ,  
    we have  (t^n) = (t^k) 
        (t^(n - k  ))
\(and\ the\ last\ factor\ is\ larger\ than\ \ \ \ n\^n\ \ \ if\ \ t\ \ is\ sufficiently\ large . 
We\ conclude\ that\)

(E^t) >  (t^k)

t  is sufficiently large

Exercise.

discuss the behavior of  the logarithms  ln x  and   x ln x

Remark: in standardForm  Mathematica uses Log[x] to write logarithms.

Infinite limits revisited

We use the values of the Tan function to compress the real line.
To visualise this compressed real line, we can put ticks on an interval in a non-linear fashion:

Symmetric rescaling of the coordinate plane.

Clear[a, numbers, s, u, sLabels, sMarks, sTicks]

a = π/2;
numbers = 12;
s[t_] = Tan[t];
u[t_] = ArcTan[t];
sLabels = 
        Transpose[{u[t] /. t -> Range[1, numbers], 
            Range[1, numbers]}];
sMarks = 
        Transpose[
{u[t] /. t -> Range[numbers + 1, 100], 
            Table[" ", {j, 
                Length[Range[numbers + 1, 
                    100]]}
]}];
sTicks = Union[sLabels, sMarks];

This is the programming we can include to "compactify" the whole horizontal real axis AND the whole vertical real axis in a symmetric way.

Plot[u[Sin[x]] /. x -> s[t],{t, -π/2, π/2}
	,PlotRange -> {-a, a}
,Ticks -> {sTicks, sTicks}
,AspectRatio -> Automatic
,AxesOrigin -> {0, 0}]

Compare growth by taking quotients.

Plot[u[(E^x)/(x^10)] /. x -> s[t],{t,  .1, 1.5}
	,PlotRange -> {-a, a}
,Ticks -> {sTicks, sTicks}
,AspectRatio -> Automatic
,AxesOrigin -> {0, 0}]

Compare growth by drawing several functions at once.

Compare multiples of the same power

Table[Plot[u[m (x^5)] /. x -> s[t],{t, -1.5, 1.5}
	,PlotRange -> {-a, a}
,Ticks -> {sTicks, sTicks},AspectRatio -> Automatic,AxesOrigin -> {0, 0}],{m, 5}]

Show[Release[%]]

These graphs now present the same behavior at ∞ (the upper right hand corner) and at  -∞ (the lower left hand corner)  as we have around the origin.

Compare different powers and polynomials

Table[Plot[u[(x^n)] /. x -> s[t],{t, -1.5, 1.5}
	,PlotRange -> {-a, a}
,Ticks -> {sTicks, sTicks},AspectRatio -> Automatic,AxesOrigin -> {0, 0}],{n, 6}]

Show[Release[%]]

Show[{%,Plot[u[ .5 (x^6) - 4 (x^2)] /. x -> s[t],{t, -1.5, 1.5}
	,PlotRange -> {-a, a}
,Ticks -> {sTicks, sTicks},AspectRatio -> Automatic,AxesOrigin -> {0, 0},PlotStyle -> Hue[0]]}]

And we magnify the top right hand corner to see behavior for very large values:

Show[%, PlotRange -> {{1.2, π/2}, {1.2, π/2}}, 
      Axes -> None]

Such graphics are useful for explaining  " big-O " behavior