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
Geometric Distribution: Density function returning non-zero values #24995
base: master
Are you sure you want to change the base?
Conversation
Changed Geometric Distribution pdf function so that for certain inputs, the value of the "density function" (more properly, mass function) should be 0, since the geometric value should be limited to integers 1 or greater if it's intended to be discrete and have the mass function given in the documentation. Added tests to check non-zeron fractional and negative input possibilities. Example: g = Geometric("G",p=S(1)/4) assert density(g)(-1) == 0 assert density(g)(0.5) == 0
Hi, I am the SymPy bot. I'm here to help you write a release notes entry. Please read the guide on how to write release notes. ❌ There was an issue with the release notes. Please do not close this pull request; instead edit the description after reading the guide on how to write release notes.
Click here to see the pull request description that was parsed.
|
@@ -76,6 +76,14 @@ def test_GeometricDistribution(): | |||
Y = Geometric('Y', Rational(3, 10)) | |||
assert coskewness(X, X + Y, X + 2*Y).simplify() == sqrt(230)*Rational(81, 1150) | |||
|
|||
g = Geometric("G",p=S(1)/4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be a space after comma.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
g = Geometric("G",p=S(1)/4) | |
g = Geometric("G", p=S(1)/4) |
@akshaypkbhat Read here for writing the release notes. |
Original request: Issues with Geometric random variables #20031
Fixes non-zero outputs from geometric density function
Changed Geometric Distribution pdf function so that for certain inputs, the value of the "density function" (more properly, mass function) should be 0, since the geometric value should be limited to integers 1 or greater if it's intended to be discrete and have the mass function given in the documentation. Added tests to check non-zeron fractional and negative input possibilities.
Example:
g = Geometric("G",p=S(1)/4)
assert density(g)(-1) == 0
assert density(g)(0.5) == 0