-
-
Notifications
You must be signed in to change notification settings - Fork 565
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
evaluate log gamma for complex input #12521
Comments
comment:1
I cannot reproduce some examples from the description with Sage 4.8:
Do you use a different version? Did you apply some patches? Paul |
comment:2
Yes, I guess this is after #10075. There is the same problem before that patch, but the systems and outputs will be different. In particular, inheriting from the parent of the input (which most generic There is no patch, so this doesn't depend on #10075 in that sense, but I will put it anyway so that it's clear. Thanks! |
Dependencies: #10075 |
Changed dependencies from #10075 to none |
comment:3
Removing dependency so as not to confuse anyone, now that that is in a long-since released version of Sage. |
comment:4
by the way, MPFR provides two functions: However there is another function This would solve the problem at least for real input. Paul |
comment:6
There is a related issue with the beta function:
This is presumably because GiNaC uses |
comment:8
Our current implementation is wrong. For the principal branch,
Changing to critical because the documentation claims that it's the principal branch, which is mathematically wrong. |
comment:9
I'd like to have another reference for this (perhaps NIST or A&S) but this sounds plausible. So what is the relation between this and the mpfr versions? |
comment:10
Paul, could you please comment on this code for
This correctly computes the principal branch. However, I'm concerned about precision; the result of |
comment:11
Dear Eviatar, I see no argument to tell the precision of the output in this function, thus I guess the result should be computed to the precision of the input. Then the real part seems fine to me. For the imaginary part, you create the variable Paul |
comment:12
Replying to @kcrisman:
there are some references on http://mathworld.wolfram.com/LogGammaFunction.html Paul |
comment:13
Thank you. I suspected there might be a problem like this. I think maybe using MPFR for positive reals (since it's faster) and mpmath for negative reals might be best. |
Attachment: trac_12521.patch.gz |
comment:14
Patch uploaded. It uses mpmath to evaluate Patchbot apply trac_12521.2.patch |
This comment has been minimized.
This comment has been minimized.
Reviewer: Burcin Erocal |
comment:15
Attachment: trac_12521.2.patch.gz The patchbot complains about old style doctest continuation. Since you need to edit the patch anyway... In the Thanks for the patch! Great work noticing that we don't actually compute the principal branch. |
Author: Eviatar Bach |
comment:16
Thanks! I had already fixed the doctest continuation and overwrote the previous patch, but the patchbot didn't test it again. I fixed the import issue. I also noticed that the results for Python Patchbot apply trac_12521_3.patch |
comment:23
I am reverting the deprecation of |
Work Issues: speedup |
Changed reviewer from Burcin Erocal to Burcin Erocal, Ralf Stephan |
comment:27
Tests are good in New commits:
|
Commit: |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:29
Has anyone checked the mathematics of this recently? Eviatar usually does a very good job on this stuff, but unfortunately Burcin didn't make it clear whether the rest was approved of other than the different imports. |
This comment has been minimized.
This comment has been minimized.
Changed author from Eviatar Bach to Eviatar Bach, Ralf Stephan |
Changed work issues from speedup to none |
comment:34
With these changes the beta() function is still producing small imaginary parts around poles and not returning the appropriate signed Infinity at the poles. Presumably that should be on another ticket. Otherwise looks fine to me. |
Changed branch from u/rws/evaluate_log_gamma_for_complex_input to |
Currently, we use MPFR or Ginac to evaluate
log_gamma
, but this returnsNaN
for negative input with even ceiling.We can use mpmath or something other trick to get this to work, now that #10075 has a nice symbolic function available. See #10072 for where we originally got better numerical evaluation.
Putting as defect because there is a log gamma for negative numbers, though we should talk about branches...
Apply: attachment: trac_12521_3.patch
There is now also the arb option:
CC: @burcin @sagetrac-ktkohl @sagetrac-fstan @zimmermann6 @benjaminfjones @eviatarbach @paulmasson
Component: basic arithmetic
Keywords: lgamma log_gamma
Author: Eviatar Bach, Ralf Stephan
Branch/Commit:
c11c3ef
Reviewer: Burcin Erocal, Ralf Stephan
Issue created by migration from https://trac.sagemath.org/ticket/12521
The text was updated successfully, but these errors were encountered: