NB. The script v3harm.ijs
NB. A script for creating some simple wave images
NB. Cliff Reiter, May 2002
require 'fvj2\raster5'

$pal=:hue 5r6*(i.%<:)256

lin256=:3 : 0
min=.<./,y.
max=.>./,y.
<.(255.999%max-min)*y.-min
)

sin=:1&o.
cos=:2&o.

s1=: sin@[
s2=: sin@]
s3=: sin@(+&.*:)
p3s=: s1 * s2 * s3
s3s=: s1 + s2 + s3
c1=: cos@[
c2=: cos@]
c3=: cos@(+&.*:)
p3c=: c1 * c2 * c3
s3c=: c1 + c2 + c3

$x=:_5p1+10p1*(i.%])256 NB. sample points

NB. creates sum of three sines file in J directory
(pal;|. lin256 x s3s"0 _"_ 0 x) writebmp8 's3s.bmp'

NB. creates sum of three cosines file in J directory
(pal;|. lin256 x s3c"0 _"_ 0 x) writebmp8 's3c.bmp'