Mathematical Experiment 4



exp4.mws
  1. Construct this ``marking of a ruler'':

  2. Construct the Sierpinski Triangle

  3. Construct the ``Snowflake'':

  4. These are the basic steps:

    Here is the main part understood by the computer:
    snow:=proc(n,lx,ly,rx,ry) local mlx, mly, mrx, mry, kx, ky; mlx:=(2*lx+rx)/3;
    mly:=(2*ly+ry)/3;
    mrx:=(lx+2*rx)/3;
    mry:=(ly+2*ry)/3;
    kx:=(mlx+mrx)/2+3^(1/2)*(mly-mry)/2;
    ky:=(mly+mry)/2+3^(1/2)*(mrx-mlx)/2;
    if n=0 then [[lx,ly],[rx,ry]] else [op(snow(n-1,lx,ly,mlx,mly)),op(snow(n-1,mlx,mly,kx,ky)),
    op(snow(n-1,kx,ky,mrx,mry)),op(snow(n-1,mrx,mry,rx,ry))] fi end;
  1.  Construct the ``W-curve'' following these lines:
w.mws
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);

 


exp4.tex