Eric Weeks - personal pages - misc

# One-liner trigonometric plot

A very simple plot created by stringing together a few things. See the bottom of the page for links to other simple algorithms like this one.

weeks@physics.emory.edu This was created with the following command:

seq 0 1000 0.3 | gawk '{print \$1,sin(\$1),(sin(\$1/10)+1)/2,(cos(\$1/10)+1)/2, (sin(\$1/2)+1)/2}' | psdraw -C -c 0.15 > trig.ps

The basic idea is that I'm plotting the trigonometric function sine(x) so quickly that you can't see the waves; instead, you see overlapping sine functions. I'm plotting small colored circles for each point.

This is not technically a one-liner, perhaps, as I'm using two additional programs. The program "seq" is used to print the numbers 0 to 1000 in increments of 0.3. The program psdraw takes the numbers and makes a postscript file, using the 3rd-5th columns of the input to set the RGB colors. The gawk script in the middle generates the data; I choose the various trig functions for the colors somewhat arbitrarily.

Another version of this picture: This was made with the command:

seq 0 1000 0.6 | gawk '{print \$1,sin(\$1),(sin(\$1/40)+1)/2,(cos(\$1/40)+1)/2, (sin(\$1/4)+1)/2}' | psdraw -C -c 0.3 > trig2.ps • Odds and Ends: These are various tiny ideas that are simple to do which make interesting pictures, or are otherwise interesting (to me). Click one of the pictures below to see others.      Simple trigonometric plot | Double-trigonometric contour plot | Lissajous figures | Simple diffusion limited aggregation | Spiral triangles | Polar flowers