8000 improved hypsum non-convergence behaviour by bfis · Pull Request #651 · mpmath/mpmath · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

improved hypsum non-convergence behaviour #651

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

Closed
wants to merge 1 commit into from

Conversation

bfis
Copy link
Contributor
@bfis bfis commented Nov 24, 2022

This change includes two hypsum related fixes:

  1. It turns the ValueError exception, raised in mp.hypsum when encountering convergence problems, into a more appropriate NoConvergence exception - just as fp.hypsum does already.
  2. It properly handles this NoConvergence exception withing the "fast path" of hyp2f1. The same behavior is already used in the "fast path"s of _hyp2f0, _hypq1fq, and _hyp_borel - and was broken since hypsum never raised the expected NoConvergence exception (in the mp context). Similar to _hyp2f0, this behavior can be suppressed with the keyword argument force_series=True.

I've also seen that similar issues may be affecting hypercomb, since it also raise ValueError instead of NoConvergence to signal convergence issues. If interested, I could also change that function appropriately.

I've verified in known pathological case (mpmath.hyp2f1(3814.269794854973, -1985.4387491751415, 5369.1679108495828, 0.70000000000000007).ae('4.1656634124024037e-532')) that both "fast path" (with raised maxprec) and the "slow path" (which is actually faster) bow yield the same result. If interested, I can also add this as a test case.

This change may positivity affect some of the cases alluded to in #296. For the issues #14 and #495 it shifts the convergence issue into the "slow path", which may be preferable.

@skirpichev skirpichev self-assigned this Apr 20, 2023
@skirpichev skirpichev closed this May 11, 2023
@skirpichev skirpichev reopened this May 11, 2023
return ctx.hypsum(2, 1, (atype, btype, ctype), [a, b, c], z, **kwargs)
except ctx.NoConvergence:
if kwargs.get('force_series', False):
raise
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add a test for this case, see https://app.codecov.io/gh/mpmath/mpmath/pull/651

@skirpichev skirpichev removed their assignment May 17, 2023
@skirpichev
Copy link
Collaborator

Ok, I've cherry-picked this commit in #703.

@skirpichev skirpichev closed this May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0