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

Implement symbolic confluent hypergeometric functions #14896

Closed
eviatarbach opened this issue Jul 16, 2013 · 63 comments
Closed

Implement symbolic confluent hypergeometric functions #14896

eviatarbach opened this issue Jul 16, 2013 · 63 comments

Comments

@eviatarbach
Copy link

This patch implements the Kummer confluent hypergeometric functions hypergeometric_M and hypergeometric_U (superseding the previous numerical-only version), complete with numeric evaluation, simplification, and transformation to generalized hypergeometric functions.

Depends on #2516
Depends on #16697

CC: @kcrisman @benjaminfjones

Component: symbolics

Keywords: hypergeometric, kummer

Author: Eviatar Bach, Ralf Stephan

Branch/Commit: 23a5c65

Reviewer: Jan Keitel, Ralf Stephan, Nils Bruin, Paul Masson

Issue created by migration from https://trac.sagemath.org/ticket/14896

@eviatarbach
Copy link
Author

comment:1

Attachment: trac_14896.patch.gz

Whittaker functions can be easily implemented similarly; the reason I didn't include them in this patch is because the Maxima conversion is a bit more complicated.

@eviatarbach
Copy link
Author

Attachment: trac_14896_2.patch.gz

@eviatarbach
Copy link
Author

comment:2

Last patch, to be applied independently, adds LaTeX names which I forgot in the original.

@fchapoton
Copy link
Contributor

Changed keywords from none to hypergeometric

@KPanComputes
Copy link

comment:8

This one does not have a valid git branch attached to it... So, I have set it to "needs work". I am willing to review this ticket once there is a valid git branch.

@nbruin
Copy link
Contributor

nbruin commented May 8, 2014

comment:9

is this a dupe of #2516?

@eviatarbach
Copy link
Author

comment:10

No. Confluent hypergeometric functions are a specific type of hypergeometric function, which are solutions to Kummer's differential equation.

Thanks for offering to review, Kannappan! I'm new to the Git workflow, but I'll try to create the branch as soon as possible.

@sagetrac-jkeitel
Copy link
Mannequin

sagetrac-jkeitel mannequin commented May 21, 2014

Commit: 3b32a6c

@sagetrac-jkeitel
Copy link
Mannequin

sagetrac-jkeitel mannequin commented May 21, 2014

comment:11

I've created a git branch and fixed a few failing doctests. There are still many functions that do not have docstrings.


Last 10 new commits:

4b4ed75Merge branch 'develop' into t/2516/ticket/2516
0dbbacd2516: fix last doctests
934d0572516: remove hack
0f5a4ff2516: fix doctest
eeb273eMerge branch 'develop' into t/2516/ticket/2516
62f7faaMerge branch 'master' into t/2516/ticket/2516
9c6749ddoctest coverage
051edffMerge branch 'develop' into t/2516/ticket/2516
9d6eea1# Branch hyper
3b32a6cRemove trailing whitespace and fix a few doctests by adding algorithm argument.

@sagetrac-jkeitel
Copy link
Mannequin

sagetrac-jkeitel mannequin commented May 21, 2014

Branch: u/jkeitel/ticket/14896

@rwst
Copy link

rwst commented Jul 16, 2014

Changed branch from u/jkeitel/ticket/14896 to u/rws/ticket/14896

@rwst
Copy link

rwst commented Jul 16, 2014

Changed commit from 3b32a6c to b87c57b

@rwst
Copy link

rwst commented Jul 16, 2014

comment:13

Documentation as is looks good. I fixed a newly appearing doctest fail.


Last 10 new commits:

e5a53436882: do word search/replace for symtable keys
4c1b0eb6882: correction to previous commit
518de3e6882: add symable rules for e,i,I; fix maxima_var; add doctests
7a6696bMerge branch 'u/rws/bugs_in_conversion_of_variable_names_from_maxima_to_sage' of trac.sagemath.org:sage into t/8734/ticket/8734-1
a8df107Merge branch 't/8734/ticket/8734-1' into t/16007/ticket/16007
9e66d16Merge commit 'a8df107e76527d83a87456520395ab85dbc44050' of trac.sagemath.org:sage into t/2516/public/hypergeometric
5ac82242516: fix doctests affected by 16007 merge
b2f8dc52516: this 16007-related doctest fail seems to be uncovered only by 2516, so fix it here
c2b74cbMerge branch 't/2516/b2f8dc5a1c82312271f2e2361b142358a66d0965' into t/14896/ticket/14896
b87c57b14896: fix doctest failing due to changes by 16007

@rwst
Copy link

rwst commented Jul 16, 2014

comment:14

Seems I found a Maxima interface problem with hypergeometric:

sage: hypergeometric_M(1,b,x).simplify_hypergeometric()
(b - 1)*x^(-b + 1)*e^x*gamma_greek(b - 1, x)
sage: hypergeometric([1],[b],x).simplify_hypergeometric()
(b - 1)*x^(-b + 1)*e^x*gamma_greek(b - 1, x)

Of course that should be gamma.

@nbruin
Copy link
Contributor

nbruin commented Jul 16, 2014

comment:15

Replying to @rwst:

(b - 1)*x^(-b + 1)*e^x*gamma_greek(b - 1, x)

Of course that should be gamma.

I'm not so sure: according to the maxima documentation:

  • gamma - gamma function (complete)
  • gamma_greek - lower incomplete gamma function
  • gamma_incomplete - upper incomplete gamma function

in sage, gamma(a,z) is documented to be the upper gamma function, which gets translated appropriately. We might not have a lower gamma function yet.

@kcrisman
Copy link
Member

comment:16
(b - 1)*x^(-b + 1)*e^x*gamma_greek(b - 1, x)

Of course that should be gamma.

I'm not so sure: according to the maxima documentation:

  • gamma - gamma function (complete)
  • gamma_greek - lower incomplete gamma function
  • gamma_incomplete - upper incomplete gamma function

Good catch.

in sage, gamma(a,z) is documented to be the upper gamma function, which gets translated appropriately. We might not have a lower gamma function yet.

Maybe we can make it by gamma - upper incomplete?

@rwst
Copy link

rwst commented Jul 17, 2014

comment:17

Replying to @kcrisman:

Maybe we can make it by gamma - upper incomplete?

Maybe define it in special.py both as maxima and Sage-evaluated (gamma-gamma_inc) function. Objections?

@nbruin
Copy link
Contributor

nbruin commented Jul 17, 2014

comment:18

If maxima can produce gamma_greek spontaneously, then we should be able to make sense of it. The most straightforward way is by having a transliteration, gamma_incomplete_lower or gamma_lower perhaps. Adding new symbolic functions isn't that laborious, is it? Simplification methods can be grown later.

FYI: Mathematica seems to have Gamma[a,z] for upper and Gamma[a,0,z] for lower; Maple seems to have upper Gamma. So it does seem packages have been gravitating to the upper one more than the lower one. However, if that means our confluent hypergeometric functions always end up being translated into a more convoluted expression than a straight gamma_lower would give, we're not doing ourselves favours

(e.g., for numerical work: do you really want to evaluate gamma_lower(a,z) as gamma(z)-gamma_upper(a,z) ?)

Without strong indications in either direction, I'd be hesitant to make a choice and rather follow the lead of our main underlying engine: implement gamma_lower.

@rwst
Copy link

rwst commented Mar 17, 2015

comment:35

Also needs merge in of updated #16697 and a squash.

@rwst
Copy link

rwst commented Mar 17, 2015

comment:36

Pending because #16697 is pending.

@rwst rwst removed this from the sage-6.4 milestone Mar 17, 2015
@rwst rwst added the pending label Mar 17, 2015
@rwst
Copy link

rwst commented May 21, 2016

Changed branch from u/rws/ticket/14896 to u/rws/14896

@rwst
Copy link

rwst commented May 21, 2016

comment:38

Updated with newest #16697, squashed into three tickets, removed pending. Please review.


New commits:

0e19f0bMerge branch 'develop' into u/jkeitel/ticket/14896
da3a14614896: fix documentation, doctests, coverage; use mpmath, other

@rwst
Copy link

rwst commented May 21, 2016

Changed commit from a628fcb to da3a146

@rwst rwst added this to the sage-7.3 milestone May 21, 2016
@rwst
Copy link

rwst commented May 21, 2016

comment:39

Please review/merge #16697 first (its commit metadata is missing here).

@paulmasson
Copy link
Mannequin

paulmasson mannequin commented Jun 28, 2016

comment:40

Ralf, I'm trying to merge existing commits to a branch that already includes #16697 but I'm getting errors:

    STDOUT: Auto-merging src/sage/symbolic/expression_conversions.py
    STDOUT: CONFLICT (content): Merge conflict in src/sage/symbolic/expression_conversions.py
    STDOUT: Auto-merging src/sage/symbolic/expression.pyx
    STDOUT: Auto-merging src/sage/functions/special.py
    STDOUT: Auto-merging src/sage/functions/other.py
    STDOUT: CONFLICT (content): Merge conflict in src/sage/functions/other.py
    STDOUT: Auto-merging src/sage/functions/hypergeometric.py
    STDOUT: Auto-merging src/sage/functions/all.py
    STDOUT: CONFLICT (content): Merge conflict in src/sage/functions/all.py
    STDOUT: Automatic merge failed; fix conflicts and then commit the result.

Am I doing something wrong or do these commits need updating after all this time? Would like to get this one reviewed.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 29, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

58f6a12Merge branch 'develop' into t/14896/14896

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 29, 2016

Changed commit from da3a146 to 58f6a12

@paulmasson
Copy link
Mannequin

paulmasson mannequin commented Jun 29, 2016

comment:42

Still getting an error:

    STDOUT: Auto-merging src/sage/symbolic/expression_conversions.py
    STDOUT: CONFLICT (content): Merge conflict in src/sage/symbolic/expression_conversions.py
    STDOUT: Auto-merging src/sage/functions/all.py
    STDOUT: Automatic merge failed; fix conflicts and then commit the result.

@rwst
Copy link

rwst commented Jun 30, 2016

comment:43

As you can see at the top of the ticket the branch cleanly merges with beta5. So you seem to want to merge it with a different version? And why merge at all? Just git trac checkout 14896 and compile.

@paulmasson
Copy link
Mannequin

paulmasson mannequin commented Jun 30, 2016

comment:44

I assumed I needed keep track of changes from#16697 manually, but clearly Trac does that automatically.

Running a doctest on symbolic/expression_conversions.py gives an error:

ValueError: line 93 of the docstring for sage.symbolic.expression_conversions.InterfaceInit.derivative has inconsistent leading whitespace: '======='

This is the same file that had a merge conflict.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 1, 2016

Changed commit from 58f6a12 to 23a5c65

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jul 1, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

23a5c65Merge branch 'develop' into t/14896/14896

@rwst
Copy link

rwst commented Jul 1, 2016

comment:46

I updated to beta6 and had a merge conflict there too which should be resolved now. Let's try again, please.

@paulmasson
Copy link
Mannequin

paulmasson mannequin commented Jul 1, 2016

Changed reviewer from Jan Keitel, Ralf Stephan, Nils Bruin to Jan Keitel, Ralf Stephan, Nils Bruin, Paul Masson

@paulmasson
Copy link
Mannequin

paulmasson mannequin commented Jul 1, 2016

comment:47

Doctests all pass. Documentation builds. Random numeric testing accurate and both functions plot. Symbolic behavior as expected.

Looks good to me.

@rwst
Copy link

rwst commented Jul 2, 2016

comment:48

Thanks for the review.

@vbraun
Copy link
Member

vbraun commented Jul 2, 2016

Changed branch from u/rws/14896 to 23a5c65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants