Questions tagged [gamma-function]

Anything related to the mathematical gamma function, also known as generalized factorial function.

Anything related to the mathematical gamma function, also known as generalized factorial function.

See Wikipedia page on gamma function.

72 questions
1
vote
0 answers

gamma_imp() function is not working with the latest version of boost library (version 1_78)

I am updating the boost library to latest version for our source code and came across this problem where the last parameter to gamma_imp() function (present in ) isn't available in boost anymore. The last…
ZoomIn
  • 1,237
  • 1
  • 17
  • 35
1
vote
1 answer

Gamma_inv returns error if random number is over 0.96

Gamma_inv returns an error if the random number passed to it is higher than roughly 0.96. This happens in both Excel and with VBA. I am running a Monte Carlo, and this only happens 10 or so times in over 40,000 runs. Here is how I am using it.…
Don Scavia
  • 11
  • 3
1
vote
1 answer

Estimate the parameters of an inverse gamma distribution given quantiles

I'm trying to estimate the parameters of an inverse Gamma distribution given its 0.025 and 0.975 quantiles. Currently, I've found rriskDistributions::get.gamma.par which gives me the estimation of parameters given quantiles of a Gamma distribution.…
dyluns
  • 155
  • 9
1
vote
1 answer

Calculate KL Divergence between two gamma distribution list

I have two list. Both include normalized percent: actual_population_distribution = [0.2,0.3,0.3,0.2] sample_population_distribution = [0.1,0.4,0.2,0.3] I wish to fit these two list in to gamma distribution and then calculate the returned two list…
Jennifer
  • 19
  • 2
  • 6
1
vote
0 answers

NetLogo: Find detailed information on "random-gamma" calculation error and its range in NetLogo

I want to look for detailed information such as random-gamma calculation error and its range. But at the moment I have not found yet. If anyone knows it and the risk with somewhat range caused by the random-gamma syntax in NetLogo, please let me…
goodgest
  • 418
  • 3
  • 10
1
vote
3 answers

Fast algorithm for log gamma function

I am trying to write a fast algorithm to compute the log gamma function. Currently my implementation seems naive, and just iterates 10 million times to compute the log of the gamma function (I am also using numba to optimise the code). import numpy…
PyRsquared
  • 6,970
  • 11
  • 50
  • 86
1
vote
1 answer

Gamma function implementation not producing correct values

Function programmed in Fortran 95 to compute values of the Gamma function from mathematics is not producing the correct values. I am trying to implement a recursive function in Fortran 95 that computes values of the Gamma function using the Lanczos…
pr0gramR
  • 126
  • 1
  • 2
  • 12
1
vote
1 answer

Matlab: Error using gammaln... while plotting psychometric functions

I'm using the toolbox psignifit to plot psychometric functions from a dataset. My code looks essentially like the following: load data.mat options = struct; options.sigmoidname = 'logistic'; result = psignifit(data,options); % this is where the…
Ava
  • 157
  • 1
  • 7
1
vote
1 answer

In R, incomplete gamma function with complex input?

Incomplete gamma functions can be calculated in R with pgamma, or with gamma_inc_Q from library(gsl), or with gammainc from library(expint). However, all of these functions take only real input. I need an implementation of the incomplete gamma…
user54038
  • 336
  • 1
  • 9
1
vote
1 answer

R - Derivative of Log Incomplete Gamma Function

The following functions are available in R: gamma to compute gamma function digamma to compute derivative of log gamma function pgamma to compute incomplete gamma function ? to compute derivative of log incomplete gamma function I'm wonder what…
nathanesau
  • 1,681
  • 16
  • 27
1
vote
1 answer

trigamma and digamma functions for bigfloat variable in python

I need to compute the scipy.special trigamma and digamma functions of a variable with type bigfloat in python but I get the following error message: TypeError: ufunc 'psi' not supported for the input types, and the inputs could not be safely coerced…
Shayla
  • 11
  • 3
1
vote
1 answer

Using scipy.integrate.quad to integrate gamma function

How do I find the integral of Gamma(x) = x^(a-1) * e^-x from 0 to infinity when a = 3/2 using scipy.integrate.quad? So far I've tried some code but I am being told that "quad: The first argument is not callable". This is the code I've used: import…
darren
  • 47
  • 1
  • 9
1
vote
1 answer

Numerical precision problems in R?

I have a problem with the following function in R: test <- function(alpha, beta, n){ result <- exp(lgamma(alpha) + lgamma(n + beta) - lgamma(alpha + beta + n) - (lgamma(alpha) + lgamma(beta) - lgamma(alpha + beta))) return(result) } Now if you…
Snowflake
  • 2,869
  • 3
  • 22
  • 44
1
vote
1 answer

R for optimizing a function which involves the gamma function

I am trying to optimize a function which involves a gamma function. my data is a censored data. The error, that I am having is: "Error in fn(par, ...) : attempt to apply non-function" the R code is: logB<-function(theta, data){ #theta=(lambda, rho,…
noah
  • 11
  • 1
  • 6
0
votes
0 answers

How to estimate customer lifetime value in daily increments using BG/Gamma Gamma Models (spend model) in Python?

I am calculating customer lifetime value and this estimation is performed in monthly increments. I would like to calculate CLV in increments of 7 days, 14 days etc.. using the model parameters (see below), do i convert days into month, for i.e., 7…