-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
Support for hypergeometric functions #1383
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: R. Bernstein <[email protected]>
I am actually thinking about changing this to a |
SymPy does import mpmath. So in theory SymPy could/should fall back to mpmath. (I don't know if that was always the case in the past when this project first started out.) I don't know enough about the pros and cons of doing using SymPy over mpmath. Please educate me. |
It'd possibly allow for things like If I do it, I'll also change the existing |
While I think adding a SymPy method for Hypergeometric1F1 when a, b, and z are vectors or are symbolic is a great idea, I think in this situation it is better left as a follow-on PR. Here is why... If doing that would cause the stuff here to be drastically ripped out or changed, then it would make sense to wait. But as best as I can tell that's not likely to happen here. Right? This PR, I think, is complete by itself and a useful step forward. It is also getting large. Many small and quicker PRs (assuming we are not just redoing the previous ones because we haven't thought about the bigger picture), are better than one large PR that spans a long time period. Here, I think you outlined the bigger picture, and if I have it right there are two reasonably separable steps to this.
Thanks. |
Co-authored-by: R. Bernstein <[email protected]>
summary_text = "Tricomi confluent hypergeometric function" | ||
sympy_name = "" | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't revise functions until we've mastered the existing ones.
@@ -117,3 +117,101 @@ class Hypergeometric1F1(MPMathFunction): | |||
} | |||
summary_text = "compute Kummer confluent hypergeometric function" | |||
sympy_name = "" | |||
|
|||
|
|||
class MeijerG(MPMathFunction): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not start more functions until we have mastered the ones in progress.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rocky, please kindly wait with the reviews. I'll let you know once I'm done with this PR and put it out of draft mode. Otherwise, my development flow may be confusing to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already too large. Please reduce the scope.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't want folks to see what's up. People get notifications even when working in draft mode.
Instead, fork the code and work in your private fork. Thanks.
235cb2f improves things but also has some serious problems. WMA for Hypergeometric functions gives numeric results when numeric arguments are given. So we need to do the same thing. |
Thank you for brining this up. Indeed, I've this on my radar and take care of the compatibility and the flags. Once I'm done, I will flag this PR for review. |
Here, plot explicitly requests a numerical evaluation. | ||
""" | ||
|
||
attributes = A_LISTABLE | A_NUMERIC_FUNCTION | A_PROTECTED | A_READ_PROTECTED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attributes = A_LISTABLE | A_NUMERIC_FUNCTION | A_PROTECTED | A_READ_PROTECTED | |
attributes = A_LISTABLE | A_NUMERIC_FUNCTION | A_PROTECTED |
In contrast to HypergeometricPFQ, WMA does not list this as being ReadProtected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rocky I've these changes on my radar. Kindly wait until I've marked this PR for review. Before that, I'm just focusing on the important functional aspects. But, I'll fix the documentation and the attributes before completion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, I'll limit myself to these four functions, which I will also be needing at work right now. But, eventually, other hypergeometric functions can be implemented just via rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do that later in another PR.
Why include MeijerG and HypergeometricU? What essential features do each of these add above Hypergeometric1F1 and HypegeomtericPFQ? Also note there is Hypergeometric0F1 and Hypergeometric2F1 which might easily be added later. |
In fact, as rightly identified by SymPy, good routines for Unfortunately, I need But then I realised that |
Ok - Thanks for the information and explanation. |
Note
This PR is still under development.
Introduction
This PR includes support for the following hypergeometric functions:
Hypergeometric1F1
HypergeometricPFQ
MeijerG
HypergeometricU
Checklist
Special behaviour where(z_?RealQ
leads to a numerical evaluation (as an earlier MMA alternative toN[]
).z_?MachineNumberQ
is used instead ofRealQ
.)Plot[]
Tests
TBD