MathMap Examples
The following are examples of MathMap expressions, together with
their effect on two images. The left one is an image of
Elisa
Bridges (US Playmate of the Month December 1994), the right one is
a grid with grid size 16. All these expression are included in the
plug-in.
The original images:

origVal(xy+xy:[sin(y*10),sin(x*10)]*3)

origVal(xy+xy:[5*sign(cos(9*y)),5*sign(cos(9*x))])

origVal(xy*xy:[cos(90/Y*y),1])

origVal(ra+ra:[sin(r*20)*3,0])

origVal(ra+ra:[0,(r/R-1)*45])

origValRA(r,a+a%8-4)

origValRA(r*r/R,a)

The result of this expression depends on the gradient and on the
value of t.
gradient((gray(origVal(xy))+t)%1)
The result of this expression depends on the setting of the
curve.
p=origValXY(x,y);
rgbaColor(curve(red(p)),curve(green(p)),curve(blue(p)),alpha(p))
As does this (there are actually two curves here and one slider).
alpha = user_slider("alpha",0,360);
dir = xy:[cos(alpha),sin(alpha)];
ndir = xy:[-dir[1],dir[0]];
p = xy / m2x2:[dir[0],-ndir[0],
dir[1],-ndir[1]];
pt = dir * p[0];\nvec = xy - pt;
dist = -p[1] / R;
pos = 0.5 + p[0] / R / 2;
lower = 1 / (user_curve("lower",pos) * 4 - 2);
upper = 1 / (user_curve("upper",pos) * 4 - 2);
f = lower + ((dist + 1) / 2) * (upper - lower);
origVal(pt + ndir * f * R)

origVal(xy+xy:[rand(-3,3),rand(-3,3)])

p=origVal(xy);
p=if inintv((a-9)%36,0,18) then p else -p+1 end;
if inintv(r%80,68,80) then p else -p+1 end

# Thanks to Herbert Poetzl
rd=0.9*min(X,Y);
if r>rd then
rgba:[0,0,0,1]
else
alpha=300; beta=120; gamma=t*360;
sa=sin(alpha);
sb=sin(beta);
ca=cos(alpha);
cb=cos(beta);
theta=a;
phi=acos(r/rd);
x0=cos(theta)*cos(phi);
y0=sin(theta)*cos(phi);
z0=sin(phi);
x1=ca*x0+sa*y0;
z1=-sa*-sb*x0+ca*-sb*y0+cb*z0;
if z1 >= 0 || 1 then
y1=cb*-sa*x0+cb*ca*y0+sb*z0
else
z1=z1-2*cb*z0;
y1=cb*-sa*x0+cb*ca*y0-sb*z0
end;
theta1=atan(-x1/y1)+(if y1>0 then 90 else 270 end);
phi1=asin(z1);
origVal(xy:[((theta1*2+gamma)%360-180)/180*X,-phi1/90*Y])
end

This is an example of combining MathMaps alpha operation with
layers. The background is the image of Elisa. The second layer is
the grid, which has been MathMapped with the following expression:
origVal(xy)*rgba:[1,1,1,0]+rgba:[0,0,0,sin((r-a*0.1)*10+t*360)*0.5+0.5]
abs(rgba:[sin(15*r)+sin(15*a),sin(17*r)+sin(17*a),sin(19*r)+sin(19*a),2])*0.5
grayColor(sin(x*y)*0.5+0.5)
This is a rather sick example of what is possible with
MathMap. This image took 7 seconds to render on my Pentium-S
166. The colors do of course depend on the gradient set.
p=ri:(xy/xy:[X,X]*1.5-xy:[0.5,0]);
c=ri:[0,0];
iter=0;
while abs(c)<2 && iter<31
do
c=c*c+p;
iter=iter+1
end;
gradient(iter/32)
You can find some more examples of MathMap generated images at
the very interesting an well-written
page
about visualizing complex functions by Hans Lundmark.