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

Dropped NaN in hyperu function #11363

Closed
jacksonvanover opened this issue Jan 14, 2020 · 3 comments · Fixed by #11481
Closed

Dropped NaN in hyperu function #11363

jacksonvanover opened this issue Jan 14, 2020 · 3 comments · Fixed by #11481
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.special
Milestone

Comments

@jacksonvanover
Copy link

jacksonvanover commented Jan 14, 2020

When the third argument to the hyperu function is a NaN, the return is usually NaN. However, it is possible to choose first and second parameters such that the return is 1.

Reproducing code example:

Python 3.6.8 (default, Oct  7 2019, 12:59:55) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from scipy import special
>>> import numpy as np
>>> special.hyperu(0, 1, np.nan)
1.0
>>> special.hyperu(0, 2, np.nan)
nan
>>> special.hyperu(0, 1.1, np.nan)
1.0
>>> special.hyperu(0, 1.6, np.nan)
1.0
>>> special.hyperu(0, 1.9, np.nan)
1.0
>>> special.hyperu(0, 2.1, np.nan)
1.0
>>> special.hyperu(0, 2.2, np.nan)
1.0
>>> special.hyperu(0, 2.6, np.nan)
1.0
>>> special.hyperu(0, 3, np.nan)
nan
>>> special.hyperu(0, 7, np.nan)
nan
>>> special.hyperu(1, 7, np.nan)
nan
>>> special.hyperu(1235, 7, np.nan)
nan
>>> special.hyperu(0, 2.0, np.nan)
nan
>>> special.hyperu(1, 1, np.nan)
nan
>>> special.hyperu(1, 0, np.nan)
nan
>>> special.hyperu(1, 11, np.nan)
nan

Scipy/Numpy/Python version information:

1.4.1 1.17.4 sys.version_info(major=3, minor=6, micro=8, releaselevel='final', serial=0)

@jacksonvanover
Copy link
Author

This appears to be the case for hyp1f1 as well

@peytondmurray
Copy link
Contributor

Just addressed this issue in my PR. On a side note @jacksonvanover hyp1f1 appears to check for np.nan-valued arguments, and there is a test which has already been implemented which checks for this.

@jacksonvanover
Copy link
Author

@peytondmurray, thanks for the follow-up! I realize that the hyp1f1 behavior I was referring to was from version 1.3.1 of scipy and has clearly been fixed. Thanks for your work!

@tylerjereddy tylerjereddy added this to the 1.5.0 milestone Feb 9, 2020
@tylerjereddy tylerjereddy added the defect A clear bug or issue that prevents SciPy from being installed or used as expected label Feb 9, 2020
gwgundersen pushed a commit to gwgundersen/scipy that referenced this issue Jul 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.special
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants