Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E(sin(X)) doesn't work #19364

Open
czgdp1807 opened this issue May 19, 2020 · 0 comments
Open

E(sin(X)) doesn't work #19364

czgdp1807 opened this issue May 19, 2020 · 0 comments
Labels

Comments

@czgdp1807
Copy link
Member

It falis for expression having CRV in trigonometric functions due to complex integration

>>> X = Normal('X', 2, 3)
>>> Y = Normal('Y', 3, 4)
>>> Z = Poisson('Z', 4)
>>> W = Poisson('W', 3)
>>> x = symbols('x', real=True)
>>> y, w, z = symbols('y, w, z')
>>> Expectation(2*X + 3*Y + z*X*Y).expand()
z*Expectation(X*Y) + 2*Expectation(X) + 3*Expectation(Y)
>>> Expectation(2*X + 3*Y + z*X*Y).doit()
6*z + 13
>>> Expectation(sin(X)).doit() # doesn't work for CRV
Traceback (most recent call last):
  ...
TypeError: Invalid comparison of non-real I*im(exp_polar(-I*pi/2))*erf(3*sqrt(2)*I*exp_polar(0)*im(exp_polar(
I*pi/2))/2)
>>> X = Die('X')
>>> Expectation(sin(X)).doit()   # works fine with FRV
sin(5)/6 + sin(4)/6 + sin(6)/6 + sin(3)/6 + sin(1)/6 + sin(2)/6
>>> Expectation(sin(Z)).doit()  #  works with DRV but doesn't evaluate
Sum(4**Z*exp(-4)*sin(Z)/factorial(Z), (Z, 0, oo))

>>> Expectation(sin(X)).doit() # doesn't work for CRV Should I add this as XFAIL?

Originally posted by @Smit-create in https://github.com/sympy/sympy/pull/19290/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants