search for: bes1

Displaying 5 results from an estimated 5 matches for "bes1".

Did you mean: bes
2010 Jan 26
1
newton method for single nonlinear equation
...")    z  <- pars[1]       ## Constant value        alp  <- 2.0165 ; rho <- 0.868;    c    <- sqrt(pi)/(gamma(alp)*(1-rho)^alp)       for (i in 1:n)    {  t1   <- exp(-pars[1]/(1-rho))                             t2   <- (pars[1]*(1-rho)/(2*sqrt(rho)))^(alp-0.5)         bes1 <- besselI(pars[1]*sqrt(rho)/(1-rho),alp-0.5)        bes2 <- besselI(pars[1]*sqrt(rho)/(1-rho),alp-1.5)       bes3 <- besselI(pars[1]*sqrt(rho)/(1-rho),alp+0.5)      ## Equation       f   <- c*t1*t2*bes1 - runi       ## derivative       fprime   <- c*t1*t2*( -bes1/(1-rho) + (alp-0....
2010 Feb 10
1
looping problem
...ave this code here: library(numDeriv)   fprime <- function(z) { alp  <- 2.0165;   rho  <- 0.868;   # simplified expressions   a      <- alp-0.5   c1     <- sqrt(pi)/(gamma(alp)*(1-rho)^alp)   c2     <- sqrt(rho)/(1-rho)   t1     <- exp(-z/(1-rho))   t2     <- (z/(2*c2))^a   bes1   <- besselI(z*c2,a)   t1bes1 <- t1*bes1   c1*t1bes1*t2 }   ## Newton iteration newton_gam <- function(z) { n   <- length(z)   r   <- runif(n)   tol <- 1E-6   cdf <- vector(length=n, mode="numeric")     for (i in 1:1000)   { # numerical intergration to find the cdf   ...
2010 Jan 26
1
Newton method
...")    z  <- pars[1]       ## Constant value        alp  <- 2.0165 ; rho <- 0.868;    c    <- sqrt(pi)/(gamma(alp)*(1-rho)^alp)       for (i in 1:n)    {  t1   <- exp(-pars[1]/(1-rho))                             t2   <- (pars[1]*(1-rho)/(2*sqrt(rho)))^(alp-0.5)         bes1 <- besselI(pars[1]*sqrt(rho)/(1-rho),alp-0.5)        bes2 <- besselI(pars[1]*sqrt(rho)/(1-rho),alp-1.5)       bes3 <- besselI(pars[1]*sqrt(rho)/(1-rho),alp+0.5)      ## Equation       f   <- c*t1*t2*bes1 - runi       ## derivative       fprime   <- c*t1*t2*( -bes1/(1-rho) + (alp-0....
2010 Feb 09
1
how to adjust the output
...at I can carry out the calculation.   integrand <- function(z) { alp  <- 2.0165   rho  <- 0.868   # simplified expressions   a      <- alp-0.5   c1     <- sqrt(pi)/(gamma(alp)*(1-rho)^alp)   c2     <- sqrt(rho)/(1-rho)   t1     <- exp(-z/(1-rho))   t2     <- (z/(2*c2))^a   bes1   <- besselI(z*c2,a)   t1bes1 <- t1*bes1    c1*t1bes1*t2 }   z1  <- 20 cdf <- integrate(integrand, lower = 0, upper = z1,abs.tol = FALSE) r   <- runif(1)   ## Newton iteration z2  <- z1 - (cdf - r)/integrand(z1)   Output   > z1  <- 20   > cdf <- integrate(integrand,...
2010 Feb 09
0
For and while in looping
...re is the code:   library(numDeriv)   fprime <- function(z) { alp  <- 2.0165;   rho  <- 0.868;   # simplified expressions   a      <- alp-0.5   c1     <- sqrt(pi)/(gamma(alp)*(1-rho)^alp)   c2     <- sqrt(rho)/(1-rho)   t1     <- exp(-z/(1-rho))   t2     <- (z/(2*c2))^a    bes1   <- besselI(z*c2,a)   t1bes1 <- t1*bes1    c1*t1bes1*t2 }   ## Newton iteration newton_gam <- function(z) { n   <- length(z)   r   <- runif(n)   tol <- 1E-6     for (i in 1:n)   { # numerical intergration to find the cdf     cdf[i]  <- integrate(fprime, lower = 0, upper = z...