Off[General::spell]; |
Off[General::spell1]; |
iters = 6 |
(* number of iterations - no higher than 10, unless you are very patient *) |
{a,b}=N[{4/9,2/3}]; {c,d}=N[{5/9,1/3}]; |
(* These are the turning points *) |
{dx[1],dy[1]}={a,b}; {dx[2],dy[2]}={c-a,d-b}; {dx[3],dy[3]}={1-c,1-d}; |
ptlst = {{0,0},{a,b},{c,d},{1,1}}; |
Do[{newptlst = {},Do[{{x1,y1}=ptlst[[j]], {x2,y2}=ptlst[[j+1]], |
delx = x2-x1, dely = y2-y1, |
{nx1,ny1} = {x1,y1} + {delx*dx[1],dely*dy[1]}, |
{nx2,ny2} = {nx1,ny1} + {delx*dx[2],dely*dy[2]}, |
newptlst = Flatten[{newptlst,{x1,y1},{nx1,ny1},{nx2,ny2}}]}, |
{j,1,Length[ptlst]-1}],ptlst = Partition[Flatten[{newptlst,{1,1}}],2]}, |
{i,1,iters}]; |
Show[Graphics[Line[ptlst]],PlotRange->All,AspectRatio->1/2.5]; |