/* From: "A SURVEY OF COMPUTATIONAL PHYSICS" by RH Landau, MJ Paez, and CC BORDEIANU Copyright Princeton University Press, Princeton, 2008. Electronic Materials copyright: R Landau, Oregon State Univ, 2008; MJ Paez, Univ Antioquia, 2008; and CC BORDEIANU, Univ Bucharest, 2008. Support by National Science Foundation */ // Bugs.java: Bifurcation diagram for logistic map import java.io.*; public class Bugs { static double m_min =0.0, m_max =4., step =0.01 ; // Class variables public static void main(String[] argv) throws IOException, FileNotFoundException { double m, y; int i; // Output data to Bugs.dat PrintWriter w = new PrintWriter(new FileOutputStream("Bugs.dat"), true); for ( m = m_min; m <= m_max; m += step) { // mu loop y = 0.5; // Arbitrary seed for (i=1; i <=200; i++ ) y = m*y*(1-y); // Transients for (i=201; i <=401; i++ ) { y = m*y*(1-y); w.println( ""+ m+" "+ y);} } System.out.println("sorted data stored in Bugs.dat."); } }