cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Gamma two parameters

hegel
7-Bedrock

Gamma two parameters

Well, the gamma function presents a problem in mathcad that makes it difficult at first sight to apply it to concrete problems in comparison with other languages like R or Python.
This problem is that the gamma function in mathcad has only one parameter (it seems to me that their engineers do not corroborate their pre-made functions with wikipedia). The gamma function requires 2 parameters: 1) the shape parameter: s 2) the rate parameter: r.
After racking my brain for many hours I came up with equivalent formulas in different ways:
For probability density function (pdf):
1) with the direct formula.
2) adapting the density function given by mathcad:
pdfgamma(x,s,r):=dgamma(x*r,s)*r

For the cumulative probability function (cdf) there are three ways to do this:
1) define the incomplete gamma function and then calculate the cdf.
2) use a serial form
3) defining a new function with the one already given by mathcad:
cdfgamma(x,s,r):=pggamma(x*r,s)

Regarding the generation of random numbers the following function adapted to the mathcad one is satisfied

rgamma2(m,s,r):=rgamma(m,s)/r

I have no answer for qgamma2(p,s,r).

That's all folks, and hoping that mathcad for version 20 already incorporates the gamma function with 2 parameters.
abrazos desde Argentina.

1 REPLY 1
LucMeekes
23-Emerald III
(To:hegel)

This is what I built long time ago:

 
 

LucMeekes_2-1710527756506.png

The function names in purple are the built-in functions of Mathcad.

 

Success!
Luc

 

 

Announcements

Top Tags