search for: 7511255444649425d0

Displaying 1 result from an estimated 1 matches for "7511255444649425d0".

2012 Feb 29
2
Converting a function from Splus to R
...in R? The function can be found in page 230 from http://www.stat.wisc.edu/~mchung/teaching/stat471/stat_computing.pdf Function is as follows: gauher <- function(n) {# Gauss-Hermite: returns x,w so that #\int_-\infty^\infty exp(-x^2) f(x) dx \doteq \sum w_i f(x_i) EPS <- 3.e-14 PIM4 <- .7511255444649425D0 MAXIT <- 10 m <- trunc((n+1)/2) x <- w <- rep(-1,n) for (i in 1:m) { if (i==1) { z <- sqrt(2*n+1)-1.85575*(2*n+1)^(-.16667) } else if(i==2) { z <- z-1.14*n^.426/z } else if (i==3) { z <- 1.86*z-.86*x[1] } else if (i==4) { z <- 1.91*z-.91*x[2] } else { z <- 2.*z-x[i-2] } f...