Open In App

sympy.stats.StudentT() in Python

Last Updated : 08 Jun, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

With the help of sympy.stats.StudentT() method, we can get the continuous random variable which represents the student’s t distribution.

Syntax : sympy.stats.StudentT(name, nu)
Where, nu is real number and nu > 0.
Return : Return the continuous random variable.

Example #1 :
In this example we can see that by using sympy.stats.StudentT() method, we are able to get the continuous random variable representing Student’s T distribution by using this method.




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


Output :

nu 1
– — – –
2 2
/ 2\
| z |
|1 + –|
\ nu/
—————–
____ / nu\
\/ nu *B|1/2, –|
\ 2 /

Example #2 :




# Import sympy and StudentT
from sympy.stats import StudentT, density
from sympy import Symbol, pprint
  
z = 0.46
nu = 2
  
# Using sympy.stats.StudentT() method
X = StudentT("x", nu)
gfg = density(X)(z)
  
pprint(gfg)


Output :

___
0.214993401181957*\/ 2



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads