/* Simulation of the discrete logistic map. x[i+1] = h*x[i](1.0 - x[i]) Last Modified: August 23, 1999 by Bill Goodwine */ #include #include main(int argc, char *argv[]) { int i,steps; double x,h; char str[255]; FILE *fp; if(argc != 4) { printf("Usage: %s h xinit steps\n",*argv); exit(1); } h = atof(argv[1]); x = atof(argv[2]); steps = atoi(argv[3]); fp = fopen("cobweb.d","w"); fprintf(fp,"%f\t%f\n%f\t%f\n\n\n",0.0,0.0,1.0,1.0); fprintf(fp,"%f\t%f\n",x,0.0); for(i=0;i<=steps;i++) { fprintf(fp,"%f\t%f\n%f\t%f\n",x,x*h*(1-x),x*h*(1-x),x*h*(1-x)); x = x*h*(1-x); } fclose(fp); strcpy(&str[0],"gnuplot <