Python math library – gamma() function:

Python language allows various mathematical operations, that has applications in scientific domain. Python has an in-built function which computes the gamma value numerically of the value of number passed into the function.

Code 1: Demonstration of working of gamma()

Comparing factorial() and gamma():

The value of gamma can be found using factorial (x-1), but we use gamma() because when a similar task is given to both functions, gamma() offers better performance.

Code 2: Comparison of factorial() and gamma()

 

Leave a Reply

Your email address will not be published. Required fields are marked *