Friday, December 12, 2025
HomeLanguagessympy.stats.PowerFunction() in Python

sympy.stats.PowerFunction() in Python

With the help of sympy.stats.PowerFunction() method, we can get the continuous random variable which represents the Power Function distribution.

Syntax : sympy.stats.PowerFunction(name, alpha, a, b)
Where, a, b and alpha are real number.

Return : Return the continuous random variable.

Example #1 :
In this example we can see that by using sympy.stats.PowerFunction() method, we are able to get the continuous random variable representing power function distribution by using this method.




# Import sympy and PowerFunction
from sympy.stats import PowerFunction, density
from sympy import Symbol, pprint
  
z = Symbol("z")
alpha = Symbol("alpha", positive = True)
a = Symbol("a", positive = True)
b = Symbol("b", positive = True)
  
# Using sympy.stats.PowerFunction() method
X = PowerFunction("x", alpha, a, b)
gfg = density(X)(z)
  
print(gfg)


Output :

(-2*a + 2*z)/(-a + b)**2

Example #2 :




# Import sympy and PowerFunction
from sympy.stats import PowerFunction, density, variance
from sympy import Symbol, pprint
  
z = Symbol("z")
alpha = 2
a = 0
b = 1
  
# Using sympy.stats.PowerFunction() method
X = PowerFunction("x", alpha, a, b)
gfg = density(X)(z)
  
pprint(variance(gfg))


Output :

1/18

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32444 POSTS0 COMMENTS
Milvus
105 POSTS0 COMMENTS
Nango Kala
6813 POSTS0 COMMENTS
Nicole Veronica
11951 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12027 POSTS0 COMMENTS
Shaida Kate Naidoo
6945 POSTS0 COMMENTS
Ted Musemwa
7198 POSTS0 COMMENTS
Thapelo Manthata
6892 POSTS0 COMMENTS
Umr Jansen
6881 POSTS0 COMMENTS