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
Error with handmade Gamma Distribution (Easy Fix) #19959
Comments
Well, that's the issue with |
The check happens only once, right i.e., during the object creation? So, may be |
Yes, only once.
Removing the check may be more useful as it is always not sure even using |
Maybe log a warning instead of throw an error when the integral is not one? |
Problem
The following was working in sympy version 1.5. It does not work in 1.6.
The following code returns
ValueError: The pdf on the given set is incorrect.
:However, this is exactly the pdf in the documentation.
Upon inspection, I found in line 154 in
crv_types.py
, we have thatval = integrate(pdf(x), (x, set))
returnstheta*theta**(-k)*theta**(k - 1)
. I assumeintegrate
does not simplify the expression since this value is 1.Proposed possible fixes:
val = integrate(pdf(x), (x, set))
withval = simplify(integrate(pdf(x), (x, set)))
. (This may be inefficient for complex integrals that turn out to be incorrect)._value_check(val == S.One, "The pdf on the given set is incorrect.")
with_value_check((val - S.One) == S.Zero, "The pdf on the given set is incorrect.")
. (This might also use thesimplify
method behind the scenes. But if it does not, it will be more efficient).drv_types.py
may have the same issue.Unless I have done something horribly wrong, should I submit a PR for this? (I'll also add unit tests for this).
The text was updated successfully, but these errors were encountered: