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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

134 chapter 6}public static double f ( double x) {return ( Math . exp(−x)) ;} // f(x)public static double gaussint ( int no , double min , double max) {int n;double quadra = 0. , w[] = new double [2001] , x[] = new double [2001];gauss (no , 0 , min, max, x , w) ; / / Returns pts & wtsfor ( n=0; n < no ; n++ ) quadra += f (x[n ]) ∗w[ n ] ; // Calculate integralreturn ( quadra ) ;}public static void gauss ( int npts , int job , double a, double b,double x[] , double w[]) {int m = 0, i = 0, j = 0;double t = 0. , t1 = 0. , pp = 0. , p1 = 0. , p2 = 0. , p3 = 0. ;double xi , eps = 3.E−14; / / Accuracy : ADJUST !m = ( npts + 1) /2;for ( i =1; i = eps ) {p1 = 1. ; p2 = 0. ;for ( j =1; j

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

Saved successfully!

Ooh no, something went wrong!