#include #include #include #include #include "ps.h" void plotd1(void); int main(void) { init(); viewport(0.2, 0.2, 0.8, 0.8); xyworld(-0.2, -0.2, 1.2, 1.2); line(0.5, 0.0, 0.5, 0.02, 0.0, 2.0, 1); line(1.0, 0.0, 1.0, 0.02, 0.0, 2.0, 1); line(0.0, 0.5, 0.02, 0.5, 0.0, 2.0, 1); line(0.0, 1.0, 0.02, 1.0, 0.0, 2.0, 1); arrow(-0.1, 0.0, 1.2, 0.0, 0.02, 0.0, 2.0); arrow(0.0, -0.1, 0.0, 1.2, 0.02, 0.0, 2.0); textx(1.2,-0.02,1,"x"); textx(0.5,-0.02,3,"0.5"); textx(1.0,-0.02,3,"1.0"); texty(-0.02,1.2,1,"y"); texty(0.0,0.5,3,"0.5"); texty(0.0,1.0,3,"1.0"); textx(-0.06,-0.02,1,"O"); plotd1(); fin(); return 0; } void plotd1(void) { int n,m,ix,iy,it;double dt,dx,dy,ds,x0,y0,x1,y1; linewidth(1.0); setgray(0.6); linety(1); m=10; for (ix=0;ix<=m;ix++){ for (iy=0; iy<=m;iy++){ x0=0.0+1.0*(double)ix/(double)m; y0=0.0+1.0*(double)iy/(double)m; dt=0.05; dx=1.0; dy=3.0*x0*y0; ds=sqrt(dx*dx+dy*dy); if(ds!=0.0) { x1=x0+dx/ds*0.05; y1=y0+dy/ds*0.05; arrow(x0,y0,x1,y1,0.01,0.6,1.0); } } } stroke(); newpath(); setgray(0.4); linewidth(1.2); linety(1); n=40; m=1; for(ix=0;ix<=0;ix++){ for(iy=0;iy<=0;iy++){ x0=0.0; y0=0.1; dt=0.0128; plot(x0,y0,3); for(it=1;it<=2*n;it++){ x1= x0+1.0*dt;y1= y0+3.0*x0*y0*dt; plot(x1,y1,2); x0=x1;y0=y1; } } } stroke(); return; }