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
10
votes
6 answers

How to make a function that computes the factorial for numbers with decimals?

How can I make a function that calculates the factorial (or the gamma function) of decimal numbers in JavaScript? For example, how could I calculate 2.33!?
Mich'
  • 683
  • 1
  • 8
  • 17
8
votes
2 answers

Is there mathematical gamma function in C#?

I'd like to make a scientific calculator in C#, but I didn't find gamma function to calculate fractal factorials. The function's description is below: https://en.wikipedia.org/wiki/Gamma_function How can I reach gamma function in C#?
Kovoliver
  • 238
  • 2
  • 13
5
votes
2 answers

Renewal Function for Weibull Distribution

The renewal function for Weibull distribution m(t) with t = 10 is given as below. I want to find the value of m(t). I wrote the following r code to compute m(t) last_term = NULL gamma_k = NULL n = 50 for(k in 1:n){ gamma_k[k] = gamma(2*k +…
score324
  • 687
  • 10
  • 18
5
votes
3 answers

calculating the Gamma function for negative real values (C++, Boost)

The following infinite serious require the calculation of factorial for non-integer, negative, real numbers: (it is a way to calculate the circumference of an ellipse, a and b are the semi-major and semi minor axis and h is defined as: h =…
sivan shani
  • 87
  • 1
  • 8
5
votes
1 answer

Incomplete gamma function does not accept complex value inputs

I'm trying to compute the upper incomplete gamma function defined like in this post. If I use from scipy.special import gamma,gammainc from numpy import linspace a = 0 z = (2+3j)*np.linspace(0,10) gamma(a)*(1-gammainc(a,z)) where z is a complex…
Medulla Oblongata
  • 3,771
  • 8
  • 36
  • 75
5
votes
2 answers

Calculate binomial coffeficient very reliably

What is the best method to calculate a binomial coefficient in C++? I've seen some code fragments but it seemed to me that it is always only doable in some specific region. I need a very, very, very reliable calculation. I tried it with a gamma…
Ben
  • 1,432
  • 4
  • 20
  • 43
4
votes
1 answer

Difficulties in evaluating mpmath gammainc function

I am playing with the python library mpmath, in particular evaluating the incomplete gamma function. This is part of a root finding routine but its evaluation is extremely slow for some combinations of complex-valued arguments. import mpmath as…
linello
  • 8,451
  • 18
  • 63
  • 109
4
votes
4 answers

Gamma Function in Python

I'm fairly new to Python but would like to use Euler's Gamma Function in a function I am writing. I'd prefer not to write it as an integral and was wondering if there's something I can import that easily defines the gamma function. Thanks
Lanier Freeman
  • 273
  • 2
  • 3
  • 6
4
votes
1 answer

The precision of scipy.special.gammaln

The Problem A lot of my programming involves the statistics functions in scipy.stats. A new problem required computing the pmf of the beta-binomial distribution. Because it has an analytic form, but doesn't show up in scipy.stats, I needed to define…
mtw729
  • 163
  • 1
  • 5
3
votes
3 answers

Simple approximation of Inverse Incomplete gamma function

How could one approximate Inverse Incomplete gamma function Г(s,x) by some simple analytical function f(s,Г)? That means write something like x = f(s,Г) = 12*log(123.45*Г) + Г + 123.4^s . (I need at least ideas or references.)
klm123
  • 12,105
  • 14
  • 57
  • 95
3
votes
3 answers

How to run a GLM gamma regression in Python with R like formulas

I am running a GLM regression in Python using statsmodels using the following code. I specifically want to implement a log link function. I am able to write R like formulas using Statsmodels. The following code successfully runs but throws up a…
3
votes
2 answers

Plotting model with gamma distribution in ggplot

I am plotting the relationships between flight speed and time for females and males in my species. My generalized linear mixed model (random intercept for individual ID) suggests that there is a difference between females in males, so in figure, I…
tnt
  • 1,149
  • 14
  • 24
3
votes
2 answers

How can i optimize this S-curve function?

I am working on a gamma function that generates a "S-Curve". I need to run it in a realtime environment so i need to speed it up as much as possible. The code is as follows: float Gamma = 2.0f; //Input Variable float GammaMult = pow(0.5f,…
user2339945
  • 623
  • 1
  • 9
  • 14
3
votes
2 answers

How to plot a product function in R?

I'm trying a problem but first I have to plot in r (x+1)(x+2)...(x+n), with n being a fixed integer. Any idea how to create this routine?
albert
  • 305
  • 4
  • 12
3
votes
1 answer

R language source code - what is `NOMORE_FOR_THREADS` in the C code

I was going through the R source code for the function gamma() which points to this C source file. The snippet of the code is as follows: #ifdef NOMORE_FOR_THREADS static int ngam = 0; static double xmin = 0, xmax = 0., xsml = 0., dxrel =…
Sid
  • 65
  • 8
1
2 3 4 5