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

Geometric Distribution: Density function returning non-zero values #24995

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

akshaypkbhat
Copy link

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

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
@sympy-bot
Copy link

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.

  • The <!-- BEGIN RELEASE NOTES --> block was not found
Click here to see the pull request description that was parsed.
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

@hanspi42 hanspi42 added the stats label Mar 31, 2023
@@ -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)
Copy link
Contributor

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
g = Geometric("G",p=S(1)/4)
g = Geometric("G", p=S(1)/4)

@1e9abhi1e10
Copy link
Contributor

@akshaypkbhat Read here for writing the release notes.
For the first pull request, you need to add your name and email in the .mailmap file , read here for instructions.

@akshaypkbhat akshaypkbhat marked this pull request as draft April 5, 2023 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants