from sympy import *
from sympy.stats import *
mu, Y = symbols('mu Y', real = True, constant = True)
sigma = symbols('sigma', real = True, positive=True)
X = Normal('X', mu, sigma)
When asking for:
E(X, evaluate=False)
I get:
∞
⌠
⎮ 2
⎮ -(X - μ)
⎮ ──────────
⎮ 2
⎮ 2⋅σ
⎮ √2⋅X⋅ℯ
⎮ ──────────────── dX
⎮ 2⋅√π⋅σ
⌡
-∞
Which is what I expect. When asking for:
E(X, X>0, evaluate=False)
E(X, X>pi, evaluate=False)
E(X, X >-3, evaluate=False)
Using any constant, the result is as expected from the Normal Definition of conditional expectation. However, when trying to solve for:
E(X, X>Y)
I'm getting an error that has to do with roots. Is there a way to define a Y, such that sympy acknowledges that it is a constant, just like a 0 or a -3 or even pi, and shows the integration as expected? I'm assuming the problem with the request I have from sympy is that somehow the Y isn't acknowledges as a constant and therefore, when trying to solve this request, sympy is faced with a roots problem.