Fitting infinite graphics on a computer screen

Ivan Cnop
icnop@vub.ac.be

Sequences

Plotting sequences

A sequence of numbers can be given by its values on positive integers:

a[n_]:=(n + 50)/(2  n - 9)

Limit[ a[n] , n -> +∞]

ListPlot[Table[a[n], {n, 20}]]

ListPlot[Table[a[n], {n, 200}]]

How far do we have to go to be  within a small margin of error  near the limit value?
A better idea is to bring infinity closer by putting the values over points in the interval  [1,2].

ListPlot[Table[{2 - 1/n, a[n]}, {n, 1, 200}], 
      PlotRange -> {{1, 2}, {0, 5}}]

The visual convergence improves if we speed up the scanning of values as we go along these:

ListPlot[Table[{2 - 1/n, a[n]}, {n, 1, 4000}], 
      PlotRange -> {{1, 2}, {0, 5}}]

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

Check manually where the limit goes by zooming in:

Show[%, PlotRange -> {0.45, 0.55}]

Conclusion

By bringing closer the point at infinity, we can guess much better what the limit of a sequence may be. 
The limit is to be found over the right-hand endpoint, and the limit value can be added to complete the plot.
This procedure is called  "Bohr compactification" of the natural number system.

Assignment

Repeat the above for other sequences.

Making the real positive half line compact by compressing.

Bringing large values of the variable on screen.

We want to compare the following functions near  +∞   by taking their quotient.

(Subscript[f, 1])[x_]:=x + 50

(Subscript[f, 2])[x_]:=2  x - 10

Limit[ (Subscript[f, 1])[x]/(Subscript[f, 2])[x] ,x -> +∞]

Is this what we see in the following plot?

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

Plot[ (Subscript[f, 1])[x]/(Subscript[f, 2])[x] ,{x, 0, 100}
	,PlotRange -> All]

Plotting is not very helpful at first sight.

Plot[ (Subscript[f, 1])[x]/(Subscript[f, 2])[x] ,{x, 0, 1000}]

Even if we magnify we cannot guess the value of the limit from this graph:

Plot[ (Subscript[f, 1])[x]/(Subscript[f, 2])[x] ,{x, 0, 1000},PlotRange -> {0, 2}]

Recall that selecting the graph and pressing the right key shows coordinates of the mouse position.

Rescaling the variable

Select a monotonic function   s   (for scaling) on a finite interval that grows arbitrarily large near an endpoint value. 
For example, the function

s(u_) = (100/((10 - u)));

does this near  the value  10   since  (10 - u)   gets close to zero near 10. Next, \(\(replace\ the\ independent\ variable\ \ \ x\ \ \ by\ \ s \((u)\)\ and\ plot\ a\ function\ on\ the\ interval\ \ \ [0, 
            10]\)\(\ \ \)\(:\)\)

Remark: for later purposes it is advisable to have additional properties for  s  such as  differentiability.

We want to compare the following functions by taking a quotient.

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

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

This rightmost value is now close to the limit at   +∞  . 
It is worthwile discussing what has happened to the graph.

Remark: for later purposes it is advisable to have additional properties for  s  such as  differentiability.

The wrong approach

s[ .5 Range[1, 19]]

sTicks = 
      Transpose[{ .5 Range[1, 19], s[ .5 Range[1, 19]]}]

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

The x coordinates at tick marks tend to clutter.

The following will place the rescaled entire coordinates on the interval [0,10]:

u[t_] = u /. Solve[s[u] == t, u]

u[t] /. t -> Range[1, 20]

sLabels = 
      Transpose[{First[u[t] /. t -> Range[1, 20]], Range[1, 20]}]

Plot[{ (Subscript[f, 1])[x]/(Subscript[f, 2])[x] }/.x -> s[u],{u, 0, 10}
,Ticks -> {sLabels, Automatic}]

To get insight about the way the halfline is compressed, we add more tick marks. 
To avoid clutter, we do not add numbers to the next tick marks

u[t_] = u /. Solve[s[u] == t, u]

% /. t -> Range[21, 100];

sMarks = 
        Transpose[{First[%], 
            Table[" ", {j, Length[First[%]]}]}];

Use everything together

sTicks = Union[sLabels, sMarks]

Plot[{ (Subscript[f, 1])[x]/(Subscript[f, 2])[x] }/.x -> s[u],{u, 0, 10}
,Ticks -> {sTicks, Automatic}]

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

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

And here is a function with no limit at  +∞

Plot[Sin[x] /. x -> s[u],{u, -80, 10}
	,PlotRange -> {-1, 1}
,Ticks -> {sTicks, Automatic},AxesOrigin -> {-80, 0}]

Getting it all together

Group programming lines for ticks

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, 5, 10}
	,PlotRange -> {-1, 1}
,Ticks -> {sTicks, Automatic},AxesOrigin -> {5, 0}]

Another try:

The following will slow the convergence to the actual limit.

a = 10; numbers = 10

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

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];

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

Limits at   -∞

Taking a rescaling function that tends to   -∞   at the left endpoint of the finite interval will do