/* 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 */ // harmos.java: Solution t-dependent Schroedinger equation for // Gaussian wavepacket in a harmonic oscillator potential import java.io.*; public class harmos { public static void main(String[] argv) throws IOException, FileNotFoundException { PrintWriter w = new PrintWriter(new FileOutputStream("Harmos.dat"), true); double psr[][] = new double[751][2]; double psi[][] = new double[751][2]; double p2[] = new double[751]; double v[] = new double[751]; double dx=0.02, k0, dt, x, pi; int i ,n, max = 750; pi = 3.14159265358979323846; k0 = 3.0*pi; dt = dx*dx/4.0; x = -7.5; // Initial conditions for ( i=0; i old psi[i][0] = psi[i][1]; psr[i][0] = psr[i][1]; } } System.out.println("data saved in Harmos.dat"); } }