Skip to content

Add Fox H-function with rational A and B parameters#982

Merged
skirpichev merged 4 commits intompmath:masterfrom
ZenithalHourlyRate:foxh
Jul 27, 2025
Merged

Add Fox H-function with rational A and B parameters#982
skirpichev merged 4 commits intompmath:masterfrom
ZenithalHourlyRate:foxh

Conversation

@ZenithalHourlyRate
Copy link
Contributor

Closes #980

Please let me know if I missed anything.

@fredrik-johansson
Copy link
Collaborator

fredrik-johansson commented Jul 23, 2025

Be careful with a doctest example like this:

    >>> foxh([[(1/10,(6,5)), (13/10,1)],[(17/5,2)]],[[(7/5,2)],[(pi,1)]],0.2)
    0.1436702548477872864197888

Here the output is not actually H(1/10, ...) to 25 digits but H(0.100000000000000005551..., ...) to 25 digits.

@skirpichev
Copy link
Collaborator

Here the output is not actually H(1/10, ...) to 25 digits but H(0.100000000000000005551..., ...) to 25 digits.

I guess, you meant "input".

I don't think this issue is too severe nowadays, as Python's float's are usually just IEEE doubles, i.e. doctest will be stable across systems (modulo bugs). But I also suggest using exact binary fractions, not 1/10 or 13/10:
https://mpmath.readthedocs.io/en/latest/basics.html#providing-correct-input

@ZenithalHourlyRate
Copy link
Contributor Author

Updated the doc example and tests. The difference in argument indeed causes some deviation in the result.

-    >>> foxh([[(1/10,(6,5)), (13/10,1)],[(17/5,2)]],[[(7/5,2)],[(pi,1)]],0.2)
-    0.1436702548477872864197888
+    >>> foxh([[(mpf('1/10'),(6,5)), (mpf('13/10'),1)],[(mpf('17/5'),2)]],[[(mpf('7/5'),2)],[(pi,1)]],mpf('0.2'))
+    0.1436702548477872392572574

@skirpichev skirpichev self-requested a review July 24, 2025 04:34
@ZenithalHourlyRate
Copy link
Contributor Author

Suggested changes applied.

@skirpichev skirpichev self-requested a review July 25, 2025 06:28
@skirpichev skirpichev merged commit 9ac078c into mpmath:master Jul 27, 2025
12 checks passed
@skirpichev skirpichev added this to the 1.4 milestone Oct 12, 2025
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.

Is it possible to integrate an implement of Fox H-function with rational scale parameter to mpmath

3 participants