-
-
Notifications
You must be signed in to change notification settings - Fork 561
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 harmonic number function H(n,m) #16671
Comments
comment:1
For exact values, FLINT has arith_harmonic_number() |
comment:2
Replying to @fredrik-johansson:
Unfortunately, neither FLINT nor mpmath implements the generalized H(m,n) returned by Maxima in the code example. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Commit: |
Author: Ralf Stephan |
comment:5
It is already implemented, I'm just waiting for https://groups.google.com/forum/?hl=en#!topic/sage-devel/SM_FLL33t2g as to argument order of the generalized version. New commits:
|
comment:6
Replying to @rwst:
For For conversions to other maxima interfaces a good start may the special examples in The workhorse for the other direction is Your conversion is not that strange though. You just need to swap arguments, which means no special conversion at all as long as you can get it converted to a sage function that expects the arguments in the required order and produces the desired symbolic expression. It seems that as long as you can get an entry into |
comment:8
Thanks, that was absolutely helpful. I'll put a link on the symbolics wiki page. Please review. |
Changed keywords from none to special, log |
comment:9
A few remarks.
(never mind that this is a ValueError and not a TypeError). The maxima_lib specific translator does not have trouble with this:
Regular languages are not sufficient to describe expression languages (the nested parentheses can't be expressed in a regular language--they need a stack or something similar). Can't you get that conversion by giving an appropriate
from
you see that this should simply be
With your version one gets:
which is not the desired form, and you'll find this form can't be converted back either. |
comment:10
By the way, what's your most convincing argument to use an argument order opposite to that of maxima? I think your ordering agrees with what maple and mathematica have chosen, so it may well be that that is indeed the ordering that has most consensus. The wikipedia page is ambiguous since it lists |
comment:11
The paper I looked at had H_n(m), and Wikipedia has mostly H_n,m and H_n(m), but the paper would not be relevant. WP is, and it's listed as reference. |
comment:13
Replying to @nbruin:
Is there ready mechanics for this? I can't find one. Do you expect me to implement it?
Thanks, included. |
comment:14
Replying to @rwst:
No, just use it. If you do
That way, the parsing won't be more broken than for other functions (and it seems we're doing fine for most expressions nowadays). The regex for
I think "parsing" psi via regex was just a quick fix around the fact that the expression parser doesn't know what to do with square brackets (and since they're rare, you can get away with not really parsing them properly). In your case, round brackets are so common that you'll quickly get caught if you don't deal with them properly. Luckily, the parser knows how to deal with them, you just have to swap the arguments. |
comment:68
|
comment:69
Yes, this is because of #17790, and for that reason this ticket is pending (but needs review for everything else). |
Changed branch from u/rws/16671 to u/arminstraub/ticket/16671/harmonic_numbers |
comment:71
I have merged the code with the current codebase and simplified When merging the code into the current codebase, there was the following conflict in
It was unclear to me to which degree the underlying code had changed, which is why this code for working with In any case, it seems to me that any such change might be better suited for a separate ticket because it is not specific to harmonic numbers. Consequently, I also removed from
as well as from
I think that a separate ticket should be used for uniformly fixing the coercion/conversion of p-adics to the symbolic ring. Since the present code doesn't touch these issues, I have removed the dependency on #17790. By the way, I liked the symbolic sum you were using for computing
The only other changes I made were small touches to the doc strings. A quick Thank you for the nice work! It would be great to finally have harmonic numbers in Sage. |
Changed dependencies from #17790 to none |
Reviewer: Ralf Stephan |
comment:72
I agree with your changes, especially the removal of the dependency on #17790, this specialty is stuff for another ticket. I'm assuming you reviewed my code, so I set positive now, after more extensive tests pass here. Please add your name in the Author and Reviewer fields. Thanks. |
Changed author from Ralf Stephan to Ralf Stephan, Armin Straub |
comment:73
Thanks for checking! Yes, I did also review your code. I don't know enough about maxima and the intricacies of interfacing it, but it is my understanding that that part of the code was checked by you and Nils, and I didn't run into any additional trouble. |
Changed reviewer from Ralf Stephan to Ralf Stephan, Armin Straub |
comment:74
The patchbot complains about Also, the bot indicates an issue with startup_modules, but I couldn't make sense of it... |
comment:75
I would ignore both but let's wait for the release manager. |
Changed branch from u/arminstraub/ticket/16671/harmonic_numbers to |
H(n,m) belongs to the holonomic repertoir and should be available in Sage, both numerically and symbolically. For some info, see https://groups.google.com/forum/#!topic/sage-devel/uaA0yU7dZHU and https://en.wikipedia.org/wiki/Harmonic_number
This is actually a defect because we leave a Maxima result undefined:
CC: @eviatarbach @dkrenn
Component: symbolics
Keywords: special, log
Author: Ralf Stephan, Armin Straub
Branch/Commit:
9042104
Reviewer: Ralf Stephan, Armin Straub
Issue created by migration from https://trac.sagemath.org/ticket/16671
The text was updated successfully, but these errors were encountered: