Python - Calculate Gamma Distribution (Skewness)

by matt392 in Circuits > Software

32 Views, 1 Favorites, 0 Comments

Python - Calculate Gamma Distribution (Skewness)

GammaDistribution.jpg
GammaDistFormula.png
print ("This program will calculate the Gamma Distribution (Skewness).")

import math

###  Formula for calculating the Gamma Distribution:
#  GammaDistribution =  (2/(math.sqrt(ShapeParameter)
###########################################

# Enter the ShapeParameter
def SolveForGammaDistribution():
    print ("Solving for the Gamma Distribution (Skewness).")

    # Enter the Shape Parameter 
    ShapeParameter = float(input("Enter the Shape Parameter: ") )
    
    # Calculate the bottom section
    BottomSection = (math.sqrt(ShapeParameter) )
    print("The bottom section is: ", BottomSection)
    # Calculate the Gamma Distribution
    GammaDistribution = (2/BottomSection)
    print("The Gamma Distribution is: ", GammaDistribution)
        
ContinueCalculations = "y"

# Check to see if the user wants to continue to calculate the Gamma Distribution
while (ContinueCalculations=="y"):
    SolveForGammaDistribution()
    ContinueCalculations = input("Would like to do another calculation for the Gamma Distribution? (y/n): ")

print("==================================")
print ("Thank you to www.fxsolver.com for assistance with this formula.")