12.07.2015 Views

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

484 chapter 18✞// EqString . java : Leapfrog solution of wave equation , gnuplot outputimport java . io .∗ ;☎public class EqString {final static double rho = 0.01 , ten = 40. , max = 100.;public static void main ( String [] argv ) throws IOException , FileNotFoundException {int i, k;double x[][] = new double [101][3] , ratio , c , c1 ;PrintWriter w = new PrintWriter (new FileOutputStream ("EqString .dat") , true );c = Math . sqrt (ten/rho) ; // Propagation speedc1 = c ; // CFL criteriaratio = c∗c/(c1∗c1 ) ;for ( i=0; i < 81; i++ ) x[i ][0] = 0.00125∗ i; // Initial condsfor ( i =81; i < 101; i++ ) x[ i ][0] = 0.1−0.005∗(i−80) ;for ( i =0; i < 101; i++ ) w. println ("" + x[i ][0] + "" ); // First time stepw. println ("" );for ( i =1; i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!