Basic Principles

The basic operating principle of MathMap is very simple. To create an image of a given size, MathMap simply iterates through all the elements (pixels) of the image to be created and "asks" your expression how the pixel in question should look like, i.e. what color it should have.

Let's make an expression that produces a white image:

grayColor(1)

grayColor is a function producing a gray level color. What it needs to know is the gray level you want to produce. In this case, the gray level we want is 1 which is for white. 0 is black, and 0.5 is halfway between. If you provide a value greater than 1, 1 will be used instead (there is no color whiter than white!). Similarly, 0 will be used if a value less than 0 is presented to the function.

Such values given to functions are called arguments. As we have just seen, grayColor takes exactly one argument. Arguments are always given to a function after its name, enclosed in parenthesis. As we will shortly see, if a function takes more than one argument, these arguments are separated by commata.

Producing gray levels is fun, but we'd like to play around with "real" colors, too. So, let's produce a red image:

rgbColor(1,0,0)

As you can see, rgbColor takes three arguments and produces a color. It's first argument is the amount of red in the color. The second argument is the color's green component, and the third argument specifies the blue component. Again, useful values range from 0 to 1. Values too large or too small are clipped to 1 or 0, respectively. Try to change the values and see how it affects the output color.

Next topic: The Cartesian Coordinate System