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.

172 chapter 8✞/∗ JamaFit : JAMA matrix libe least−squares parabola fit of y(x) = b0 + b1 x + b2 x^2JAMA must be in same directory as program , or included in CLASSPATH ∗/☎✝import Jama . ∗ ;import java . io .∗ ;public class JamaFit {} }public static void main ( String [] argv ) throws IOException , FileNotFoundException {PrintWriter w = new PrintWriter (new FileOutputStream ("jamafit .dat"), true );double [] x = {1. , 1.05 , 1.15 , 1.32 , 1.51 , 1.68 , 1.92}; / / Datadouble [] y = {0.52 , 0.73 , 1.08 , 1.44 , 1.39 , 1.46 , 1.58};double [] sig = {0.1 , 0.1 , 0.2 , 0.3 , 0.2 , 0.1 , 0.1};double sig2 , s , sx , sxx , sy , sxxx , sxxxx , sxy , sxxy , rhl , xx , yy ;double [][] Sx = new double [3][3]; // Create 3x3 arraydouble [][] Sy = new double [3][1]; // Create 3x1 arrayint Nd = 7 , i ; / / Number of data pointss = sx = sxx = sy = sxxx = sxxxx = sxy = sxy = sxxy = 0;for ( i =0; i

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

Saved successfully!

Ooh no, something went wrong!