This is Words and Buttons Online — a collection of interactive #tutorials, #demos, and #quizzes about #mathematics, #algorithms and #programming.

Arctangent scale. It's like the logarithmic scale but infinite

And now, when the whole world has learned the concept of logarithmic scale and exponential growth, it's time to learn something even better.

Normally, we can't show numbers like 1, 1000, and 1 000 000 on the same plot. Because if we want to see 1 as small as one pixel high, we would have to put a million pixels on the same screen too. We can technically do that but the plot would become too tiresome to scroll.

With exponential growth, numbers tend to go from 1 to a million considerably fast but we can still show these numbers together if we place them on a logarithmic scale. The logarithm is the antidote for the exponential function. Where y = ax, there x = loga(y). Decimal logarithms of 1, 1000, and 1 000 000 (which are the same as 100, 103, and 106) are only 0, 3, and 6. We can show all of them on the same plot easily.

But what if the process is not exponential? What is it's something else, something completely unrecognizable? What if the numbers we want to see vary from 1 to 101 000 000? This is the same scrolling problem then.

For something other than the exponential function, we need some other scale. Let's base this scale on arctangent and see if it's any good.

Tangent and arctangent

The tangent function is continuous from -½Π to +½Π.

It goes toward -∞ when it approaches -½Π from the right, and it smoothly growth towards +∞ as it approaches +½Π.

It behaves as y = x in 0.

Of course, it is also periodic but this is not currently important.

For our purposes, it acts as a translator from the range (-½Π, +½Π) into the infinite space (-∞, +∞) of real numbers.

Tangent function

The arctangent function is the inverse of the tangent. It translates any real number from (-∞, +∞) back into the range(-½Π, +½Π).

Arctangent function

With arctangent used as a scale, we can show any function on a screen. And not just a fragment of it but the whole function.

The plot example

This is a function plotter that can do both linear and arctangent scales. Everything is clickable-draggable, there is even a shortcut for the scale on Shift + mouse wheel.

Feel free to try your own functions. The plotter accepts lines of JavaScript code each evaluated to f(x).

The scale:


F(x):

x:      y:      multiplier:

Of course, we can not fool the mathematics. E. g. this plot has only 409600 pixels which means that we can't possibly display more than 1.2 MB of information on it. The information needed to display every point of a function plot from -∞ to ∞ is certainly infinite. So we have to live with the error of representation. Still, the arctangent scale lets you choose where do you want this error to manifest and when.

This makes it a useful tool for exploring functions, their limits, systems of equations etc.

P. S.

The code for this page, plotter included, is available on GitHub.