sympy.stats.NormalGamma() function in Python

With the help of sympy.stats.NormalGamma() method, we can create a bivariate joint random variable with multivariate Normal gamma distribution.

Syntax:  sympy.stats.NormalGamma(syms, mu, lamda, alpha, beta)
 
Parameters:
 syms: the symbol, for identifying the random variable
 mu: a real number, the mean of the normal distribution
 lambda: a positive integer
 alpha: a positive integer
 beta: a positive integer

Returns:  a bivariate joint random variable with multivariate Normal gamma distribution.

Example #1 :

Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

# import sympy, NormalGamma, density, symbols
from sympy.stats import density, NormalGamma
from sympy import symbols, pprint
  
y, z = symbols('y z')
  
# using sympy.stats.NormalGamma() method
X = NormalGamma('X', 0, 1, 2, 3)
norGammaDist = density(X)(y, z)
  
pprint(norGammaDist)

chevron_right


Output :

                      2   
                    -y *z 
                    ------
    ___  3/2  -3*z    2   
9*\/ 2 *z   *e    *e      
--------------------------
             ____         
         2*\/ pi      

Example #2 :



Python3

filter_none

edit
close

play_arrow

link
brightness_4
code

# import sympy, NormalGamma, density, symbols
from sympy.stats import density, NormalGamma
from sympy import symbols, pprint
  
y, z = symbols('y z')
  
# using sympy.stats.NormalGamma() method
X = NormalGamma('X', 1 / 2, 3, 4, 6)
norGammaDist = density(X)(y, z)
  
pprint(norGammaDist)

chevron_right


Output :

                                    2 
                      -3*z*(y - 1/2)  
                      ----------------
      ___  7/2  -6*z         2        
108*\/ 6 *z   *e    *e                
--------------------------------------
                  ____                
                \/ pi       

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.