Open In App

sympy.stats.Skellam() function in Python

Last Updated : 18 Aug, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

With the help of sympy.stats.Skellam() method, we can create a discrete random variable with a Skellam distribution. 

The Skellam is the distribution of the difference N1 – N2 of two statistically independent random variables N1 and N2 each Poisson-distributed with respective expected values mu1 and mu2.

Syntax:  sympy.stats.Skellam(name, mu1, mu2)

Parameters:
 mu1:  A non-negative value
 mu2:  A non-negative value


Returns: discrete random variable with a Skellam distribution.

Example #1 :

Python3




# import sympy, Skellam, density, Symbol
from sympy.stats import Skellam, density
from sympy import Symbol
  
mu1 = Symbol("mu1", positive = True)
mu2 = Symbol("mu2", positive = True)
  
# using sympy.stats.Skellam() method
X = Skellam("x", mu1, mu2)
skeDist = density(X)(z)
  
print(skeDist)


Output:

(mu1/mu2)**(z/2)*exp(-mu1 - mu2)*besseli(z, 2*sqrt(mu1)*sqrt(mu2))

Example #2 :

Python3




# import sympy, Skellam, density
from sympy.stats import Skellam, density
  
# using sympy.stats.Skellam() method
X = Skellam("x", 1, 2)
skeDist = density(X)(3)
  
print(skeDist)


Output:

sqrt(2)*exp(-3)*besseli(3, 2*sqrt(2))/4

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

Similar Reads