/*********************** Compute the Logistic Map ************************/ //Include libraries #include #include main() { int i, n; double x_n, x_n1, mu; FILE*fw = fopen( "logistic_map.dat", "w" ); printf( "Enter the value of mu: \t"); scanf( "%lf", &mu ); printf( "Enter the value of n: \t"); scanf( "%d", &n ); printf( "Enter the value of x0 between 0 and 1: \t"); scanf( "%lf", &x_n ); fprintf( fw, "%d\t%lf\n", 0, x_n ); //~~~~~~~~~~~~~~~~~~~~~~~~~~Logistic Map~~~~~~~~~~~~~~~~~~~~~~~~~~ for( i = 1; i <= n; i++ ) { x_n1 = mu * x_n * ( 1 - x_n ); x_n = x_n1; fprintf( fw, "%d\t%0.6lf\n", i, x_n ); } fclose(fw); }