當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python sympy.stats.FDistribution()用法及代碼示例

借助sympy.stats.FDistribution()方法,我們可以獲得代表F分布的連續隨機變量。

用法: sympy.stats.FDistribution(name, d1, d2)
Where, d1 and d2 denotes the degree of freedom.
返回:Return continuous random variable.

範例1:
在這個例子中,我們可以通過使用sympy.stats.FDistribution()方法,我們可以使用該方法獲得代表F分布的連續隨機變量。

# Import sympy and FDistribution 
from sympy.stats import FDistribution, density 
from sympy import Symbol 
  
d1 = Symbol("d1", integer = True, positive = True) 
d2 = Symbol("d2", integer = True, positive = True) 
z = Symbol("z") 
  
# Using sympy.stats.FDistribution() method 
X = FDistribution("x", d1, d2) 
gfg = density(X)(z) 
  
pprint(gfg)

輸出:

d2
— ______________________________
2 / d1 -d1 - d2
d2 *\/ (d1*z) *(d1*z + d2)
————————————-
/d1 d2\
z*B|-, -|
\2 2 /



範例2:

# Import sympy and FDistribution 
from sympy.stats import FDistribution, density 
from sympy import Symbol 
  
d1 = 5
d2 = 6
z = 1
  
# Using sympy.stats.FDistribution() method 
X = FDistribution("x", d1, d2) 
gfg = density(X)(z) 
  
pprint(gfg)

輸出:

____
5400*\/ 55
—————-
1771561*B(5/2, 3)




相關用法


注:本文由純淨天空篩選整理自Jitender_1998大神的英文原創作品 sympy.stats.FDistribution() in python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。