improved hypsum non-convergence behaviour #651
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change includes two
hypsum
related fixes:ValueError
exception, raised inmp.hypsum
when encountering convergence problems, into a more appropriateNoConvergence
exception - just asfp.hypsum
does already.NoConvergence
exception withing the "fast path" ofhyp2f1
. The same behavior is already used in the "fast path"s of_hyp2f0
,_hypq1fq
, and_hyp_borel
- and was broken sincehypsum
never raised the expectedNoConvergence
exception (in themp
context). Similar to_hyp2f0
, this behavior can be suppressed with the keyword argumentforce_series=True
.I've also seen that similar issues may be affecting
hypercomb
, since it also raiseValueError
instead ofNoConvergence
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 raisedmaxprec
) 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.