On Wednesday, May 14, 2014 11:28:54 PM UTC+2, Matthew wrote:
>
> Generally when debugging sympy.stats I recommend inspecting the integrals
> that it produces using the evaluate=False keyword. Sympy.stats almost
> always shoves off most of the hard work onto another SymPy module like
> integrals.
>
> In [1]: from sympy.stats import *
>
> In [2]: X = ContinuousRV(x, exp(-x), Interval(0, oo))
>
> In [3]: P(X < log(2), evaluate=False)
> Out[3]:
> 0
> ⌠
> ⎮ -z
> ⎮ ℯ
> ⎮ ─── dz
> ⎮ 2
> ⌡
> -∞
>
This function should be integrated from -log(2) to 0, not from -oo to 0.
I followed the debugger
> /home/.../sympy/sympy/stats/crv.py(392)compute_density()
391 fy = sum(fx(g) * abs(g.diff(y)) for g in gs)
--> 392 return Lambda(y, fy)
393
Line 391 of crv.py, it looks like the density function gets shifted by
-log(2) without properly shifting the definition interval.
Previously, crv.where( ) failed to compute the proper interval with the
log(2) condition, raising a NonImplementedError. Maybe it's just a bug in
the interval transformation?
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/0e87126d-8b41-4137-9338-bb159b0b75b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.