home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / apps / math / euler / progs / apple.e next >
Text File  |  1991-10-27  |  1KB  |  54 lines

  1. .. Show the apple set and investigate it, starts automatically or with
  2. .. >test();
  3.  
  4. function apple1 (z,z0)
  5. ## one iteration
  6.     w=z0+z*z;
  7.     return w
  8. endfunction
  9.  
  10. function apple (z)
  11. ## compute 10 iterations
  12.     w=z;
  13.     loop 1 to 10; w=apple1(w,z); end:
  14.     return w
  15. endfunction
  16.  
  17. function showapple (a)
  18. ## show the apple set in 3D
  19.     {x,y}=field(linspace(a[1],a[2],50),linspace(a[3],a[4],50));
  20.     z=x+1i*y; w=apple(z);
  21.     view(5,3,-0.75,0.7); twosides(0);
  22.     wa=abs(w); wa=max(wa,1);
  23.     l=log(wa); l=2*l/max(max(l)');
  24.     framedsolid(x,y,-l,1);
  25.     return wa;
  26. endfunction
  27.  
  28. function showcontour(w)
  29. ## show the iterations
  30.     global x;
  31.     setplot(x);
  32.     shrinkwindow(); xplot(); hold on; wl=log(w);
  33.     contour(wl,linspace(1,max(max(wl)'),10));
  34.     title("Klicken Sie einen Punkt an! (Ende -> <Hier>)");
  35.     r=0;
  36.     repeat;
  37.         m=mouse(); z=m[1]+1i*m[2];
  38.         if m[2]>x[4]; break; endif;
  39.         {r,R}=iterate("apple1",z,20,z);
  40.         color(2); plot(re(R),im(R)); color(1);
  41.     end;
  42.     hold off;
  43.     return r
  44. endfunction
  45.  
  46. function test()
  47.     "Bitte einen Moment warten!",
  48.     x=[-2,0.5,-1.25,1.25];
  49.     w=showapple(x); title("Bitte Taste drücken!"); wait(180);
  50.     showcontour(w);
  51.     return w;
  52. endfunction
  53.  
  54. test();