|
Construct
the ``W-curve'': (Reference:
J.S. Rohl, Recursion via Pascal,
construction
with Turbo Basic) 
Z:=proc(n) 2^(n+1) end;
U:=proc(x,y,n) if n=0 then [[x,y+1]] else
[op(U(x,y,n-1)),op(R(x,y+Z(n)-3,0)),op(U(x+1,y+Z(n)-3,0)),
op(R(x+1,y+Z(n)-2,n-1)),op(U(x+Z(n)-2,y+Z(n)-2,0)),
op(L(x+Z(n)-2,y+Z(n)-1,n-1)),op(U(x+1,y+Z(n)-1,0)),
op(L(x+1,y+Z(n),0)),op(U(x,y+Z(n),n-1))];
fi;
end;
Dn:=proc(x,y,n) if n=0 then [[x,y-1]] else
[op(Dn(x,y,n-1)),op(L(x,y-Z(n)+3,0)),
op(Dn(x-1,y-Z(n)+3,0)),op(L(x-1,y-Z(n)+2,n-1)),
op(Dn(x-Z(n)+2,y-Z(n)+2,0)),op(R(x-Z(n)+2,y-Z(n)+1,n-1)),
op(Dn(x-1,y-Z(n)+1,0)),op(R(x-1,y-Z(n),0)),op(Dn(x,y-Z(n),n-1))];
fi;
end;
R:=proc(x,y,n) if n=0 then [[x+1,y]] else
[op(R(x,y,n-1)),op(Dn(x+Z(n)-3,y,0)),
op(R(x+Z(n)-3,y-1,0)),op(Dn(x+Z(n)-2,y-1,n-1)),op(R(x+Z(n)-2,y-Z(n)+2,0)),
op(U(x+Z(n)-1,y-Z(n)+2,n-1)),op(R(x+Z(n)-1,y-1,0)),op(U(x+Z(n),y-1,0)),
op(R(x+Z(n),y,n-1))];
fi;
end;
L:=proc(x,y,n) if n=0 then [[x-1,y]] else
[op(L(x,y,n-1)),op(U(x-Z(n)+3,y,0)),
op(L(x-Z(n)+3,y+1,0)),op(U(x-Z(n)+2,y+1,n-1)),op(L(x-Z(n)+2,y+Z(n)-2,0)),
op(Dn(x-Z(n)+1,y+Z(n)-2,n-1)),op(L(x-Z(n)+1,y+1,0)),op(Dn(x-Z(n),y+1,0)),
op(L(x-Z(n),y,n-1))];
fi;
end;
P:=proc(n) 2^(n+2) end;
W:=proc(x,y,n) [[x,y],op(U(x,y,n)),op(R(x,y+P(n)-3,0)),op(U(x+1,y+P(n)-3,0)),
op(R(x+1,y+P(n)-2,n)),op(Dn(x+P(n)-2,y+P(n)-2,0)),
op(R(x+P(n)-2,y+P(n)-3,0)),op(Dn(x+P(n)-1,y+P(n)-3,n)),
op(L(x+P(n)-1,y,0)),op(Dn(x+P(n)-2,y,0)),op(L(x+P(n)-2,y-1,n)),
op(U(x+1,y-1,0)),op(L(x+1,y,0))]
end;
plot(W(0,0,4),color=black,axes=none); |