R/PsiF.R

Defines functions PsiF

### Function PsiF
PsiF <- function(t,w,tol = 1e-9, maxItem=1e2) {
  value <- 0
  convergence <- 0
  for (k in 0:maxItem) {
    value.returned <- value
    item <- gamma(w)/gamma(w+k)*(w*t)^k/gamma(k+1)
    value <- value + item
    if (is.infinite(value)) {
      convergence <- 0
      break
    }
    if (abs(item/value) < tol) {
      value.returned <- value
      convergence <- 1
      break
    }
  }
  return(c(value.returned, k, convergence))
}

Try the fuel package in your browser

Any scripts or data that you put into this service are public.

fuel documentation built on July 2, 2020, 12:23 a.m.