Below is the syntax highlighted version of Verhulst.java
from §9.1 Scientific Computation.
/****************************************************************************** * Compilation: javac Verhulst.java * Execution: java Verhulst R * * % java Verhulst 3.0 * ******************************************************************************/ import java.text.DecimalFormat; public class Verhulst { public static void main(String[] args) { DecimalFormat f = new DecimalFormat("0.0000000000"); double R = Double.parseDouble(args[0]); int N = 100; double a, b, c, d, e; a = b = c = d = e = 0.5; for (int i = 1; i <= N; i++) { a = (R+1)*a - R*(a*a); b = (R+1)*b - (R*b)*b; c = ((R+1) - R*c) * c; d = R*d + (1 - R*d)*d; e = e + R*(e - e*e); if (i % 10 != 0) continue; StdOut.print(i + ": "); StdOut.println(f.format(a) + " " + f.format(b) + " " + f.format(c) + " " + f.format(d) + " " + f.format(e)); } } }