#include "cpgplot.h" #include #include #include void main() { int nmax=10000; float x[nmax], y[nmax]; double pi, x1, x2, y1, y2, xc, dx, dy, xnew, ynew; int npar, nstep, seed; unsigned int i, istep; double a1, a, theta; double h; char STR[8]; int L; printf("Input: Number of particles:\n"); scanf("%u", &npar); printf("Input: Number of steps:\n"); scanf("%u", &nstep); printf("Input: seed\n"); scanf("%u", &seed); printf("Input: h\n"); scanf("%lf", &h); pi= M_PI; /* 初期条件の設定 */ x1=0.0; x2=2.0; y1=0.0; y2=1.0; xc=1.0; if(cpgbeg(0, "?", 1, 1) != 1) exit(EXIT_FAILURE); cpgask(1); /* cpgqinf('HARDCOPY', &STR, L); */ cpgpage(); cpgvstd(); cpgwnad(0.0, 2.0, 0.0, 1.0); /* seed=1; */ srand(seed); for(i=0; i x2) xnew=2*x2-dx-x[i]; if(ynew > y2) ynew=2*y2-dy-y[i]; x[i]=xnew; y[i]=ynew; } cpgsci(3); cpgslw(5); cpgpt(npar, x, y, -1); cpgslw(1); sprintf(STR, "%u", istep); cpgmtxt("T", 2.0, 0.0, 0.0, STR); cpgebuf(); } cpgend(); return; }