guest@lirux:~$ man maths
NAME
maths - what the plotter is actually drawing
SYNOPSIS
A real formula z = f(x, y) becomes a surface above the floor of the box. A
complex formula w = f(z) becomes a surface too, with a trick: the height
shows how big w is, the brightness shows where it points.
REAL SURFACES
A function of two variables gives a height for every point (x, y) of the
plane: its graph is a surface. The plotter samples it on a square grid
(GRID N points per side, across RANGE) and joins the samples
into a mesh.
Besides x and y you can use the polar coordinates
r, the distance from the centre, and th, the angle: that is why
sin(r)/r gives the round sombrero. t is the time in seconds, and
makes the surface move.
COMPLEX NUMBERS
A complex number z = x + iy has a real part x and an imaginary
part y, with i the number whose square is -1. Complex numbers
live on a plane, and here that plane is the floor of the box: its axes are labelled RE and
IM.
A complex function w = f(z) takes a point of the plane to another complex
number. Drawing it honestly would need four dimensions, two for z and two for
w, so the plotter keeps two of them as the floor and squeezes the other two
into height and brightness.
HEIGHT: MODULUS
By default the height is the modulus |w|, the distance of w
from zero. VIEW RE and VIEW IM show the real or the imaginary
part instead, and VIEW LOG shows ln|w|, which tames the very tall
peaks.
BRIGHTNESS: ARGUMENT
The argument of w is the angle it makes with the positive real axis. In the
SOLID and MESH styles the brightness of each face grows with that angle, going once round
from dark to bright: this is domain colouring, done with shades of a single phosphor
instead of a rainbow. The sharp edge between the brightest and the darkest faces marks the
points where w is a positive real number.
ZEROS AND POLES
Where w is zero the surface touches the floor, and all the brightness levels
meet around that point: z^3-1 has three zeros, the cube roots of one. Where
w grows without limit there is a pole, a spike that goes up forever:
1/(z^2+1) has two, at i and -i. The plotter clips
such spikes automatically; ZRANGE sets the limits by hand.
BRANCH CUTS
Some functions have more than one sensible value: the logarithm and the square root of a
complex number are defined only up to a full turn. The plotter uses their principal value,
and pays for it with a cut, a line where the surface jumps. Try log(z) with
VIEW IM (the SPIRAL demo): the imaginary part is the angle of z,
a spiral staircase that breaks along the negative real axis.
THE GAMMA FUNCTION
gamma(z) extends the factorial to real and complex numbers:
gamma(n+1) = n!. It has poles at 0, -1, -2 and so on, a row of spikes in the
GAMMA demo. The plotter computes it with the Lanczos approximation and the reflection
formula.
HOW IT IS DRAWN
Each face of the mesh is projected in perspective, hidden surfaces are removed with a z-buffer, and the shading from a fixed light is reduced to five phosphor levels with ordered dithering, as an 8-bit machine would have done.
SEE ALSO
- Functions of several variables, polar coordinates
- real surfaces, r and th
- Complex numbers, complex analysis
- the numbers behind z, i, modulus and argument
- Domain colouring
- height and brightness for a complex function
- Zeros and poles, branch points and cuts, complex logarithm
- the landmarks of a complex surface
- Gamma function, Lanczos approximation
- the factorial, extended
- Z-buffering, ordered dithering
- how the surface reaches the screen
- plot(1), history(7)
- the plotter itself and the story behind it
guest@lirux:~$