In [ ]:
from sympy import *
init_printing(use_latex='mathjax')
x, y, z = symbols('x,y,z')

Probability Modeling

In [ ]:
from sympy.stats import *
In [ ]:
X = Normal('X', 0, 1)
X
In [ ]:
# Density
In [ ]:
# Density of expressions
In [ ]:
# Probability
In [ ]:
# Sampling
In [ ]:
 

Dice

In [ ]:
A = Die('A', 6)
B = Die('B', 6)

density(A+B)
In [ ]:
 

Evaluate = False

In [ ]:
 
In [ ]:
 
In [ ]:
 

More distributions

In [ ]:
from sympy.stats import Gamma
Gamma?
In [ ]:
k = Symbol('k', positive=True)
theta = Symbol('theta', positive=True)
A = Gamma('A', k, theta)
A
In [ ]:
density(A**2)(x)