/* From: "COMPUTATIONAL PHYSICS, 2nd Ed" by RH Landau, MJ Paez, and CC Bordeianu Copyright Wiley-VCH, 2007. Electronic Materials copyright: R Landau, Oregon State Univ, 2007; MJ Paez, Univ Antioquia, 2007; and CC Bordeianu, Univ Bucharest, 2007. 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 vars public static void main(String[] argv) throws IOException, FileNotFoundException { double m, y; int i; PrintWriter w = // Output data to Bugs.dat new PrintWriter(new FileOutputStream("Bugs.dat"), true); // mu loop for ( m = m_min; m <= m_max; m += step) { y = 0.5; // Arbitrary seed for (i=1; i <=200; i++ ) y = m*y*(1-y); // Wait 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."); } }