Opened 5 years ago
Last modified 4 years ago
#18141 new enhancement
special values of transcendental functions
Reported by: | rws | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-6.6 |
Component: | symbolics | Keywords: | |
Cc: | behackl | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
The functions in transcentental.py
could return special values:
zetaderiv(0,1)=-1/2*log(2*pi)
, http://dlmf.nist.gov/25.6#E11zetaderiv(0,2)=-1/2*log(2*pi)^2+...
, http://dlmf.nist.gov/25.6#E12, needs Euler constantshurwitz_zeta
, we already have:sage: hurwitz_zeta(5,1/2) 31*zeta(5) sage: hurwitz_zeta(x,1/2) hurwitz_zeta(x, 1/2)
The latter should be(2^x-1)*zeta(x)
. Alsohurwitz_zeta(0,...)
is missing, http://dlmf.nist.gov/25.11#v
This ticket may also discuss: are there closed forms without zeta
for
zeta
with odd positive argument: http://dlmf.nist.gov/25.6#E6 ?
Change History (12)
comment:1 Changed 5 years ago by
- Cc behackl added
comment:2 follow-up: ↓ 3 Changed 4 years ago by
comment:3 in reply to: ↑ 2 ; follow-up: ↓ 5 Changed 4 years ago by
Replying to behackl:
I'm rather motivated to implement some of the special values mentioned above; and I guess the "correct" place would be
src/functions/transcendental.py
, wouldn't it?
Yes, where the functions are.
However, I'm not quite sure of how to tackle the implementation of the Stieltjes constants. I think that it would be elegant if the constants were also available in pynac (such that
zeta(s).series(s==1)
could yield the appropriate series expansion directly).
To recap GiNaC/Pynac by default implements series by differentiation so a naive way to get a nice expansion would be to implement special values of the derivatives like in #17678 with the Bessel functions. With zetaderiv
this doesn't look like resulting in something usable:
sage: zeta(x).series(x==1,2) 1*(x - 1)^(-1) + (euler_gamma + log(2) + log(pi) + 2*zetaderiv(1, 0)) + (1/2*euler_gamma^2 - 1/24*pi^2 + (euler_gamma + log(pi) + 2*zetaderiv(1, 0))*log(2) + 1/2*log(2)^2 + (euler_gamma + 2*zetaderiv(1, 0))*log(pi) + 1/2*log(pi)^2 + 2*euler_gamma*zetaderiv(1, 0) - zetaderiv(2, 0))*(x - 1) + Order((x - 1)^2)
I haven't fiddled with Pynac series yet so I'm naive on how to get a different output for this. I'm also not exactly at home with complex analysis.
The problem with this approach is, that I'm not sure of how to implement a familiy of constants in pynac---or even just in sage.
In Sage there is symbolic/constants*
with three source files. Earlier I had started written about the Pynac side in https://github.com/pynac/pynac/wiki/%7C-constants
To implement a family of symbolic constants (i.e. indexed) would be a first.
However, at first glance I see no reason why Stieltjes
could not be another function taking only arguments from NN.
What do you think about moving the part with the Stieltjes constants to a separate ticket?
It looks like this is a sensible approach.
comment:4 Changed 4 years ago by
comment:5 in reply to: ↑ 3 ; follow-up: ↓ 6 Changed 4 years ago by
Replying to rws:
However, at first glance I see no reason why
Stieltjes
could not be another function taking only arguments from NN.What do you think about moving the part with the Stieltjes constants to a separate ticket?
It looks like this is a sensible approach.
This is a good idea; I'll open a ticket for the zeta-expansion. Should I also open an issue for pynac?
Also, the numerical evaluation of the Stieltjes constants would be implemented in Sage (by some sort of _evalf_
or _eval_
I guess)---or would you need to add some sort of method in pynac as well?
comment:6 in reply to: ↑ 5 Changed 4 years ago by
Replying to behackl:
This is a good idea; I'll open a ticket for the zeta-expansion. Should I also open an issue for pynac?
Done.
Also, the numerical evaluation of the Stieltjes constants would be implemented in Sage (by some sort of
_evalf_
or_eval_
I guess)---or would you need to add some sort of method in pynac as well?
No. This could be a Cython function using arb.
comment:7 Changed 4 years ago by
No, Python suffices: http://docs.sympy.org/dev/modules/mpmath/functions/zeta.html#stieltjes
comment:8 follow-up: ↓ 9 Changed 4 years ago by
This means we can have generalized Stieltjes constants and Hurwitz zeta expansion with only minor additional work, right?
comment:9 in reply to: ↑ 8 Changed 4 years ago by
Replying to rws:
This means we can have generalized Stieltjes constants and Hurwitz zeta expansion with only minor additional work, right?
For the Zeta-function: yes, that is my impression. Regarding the expansion of the Hurwitz-Zeta, I'm not quite sure: Function_HurwitzZeta
is not a Ginac
-function, but a BuiltinFunction
---and I don't know whether the series expansion of this function can be influenced. Currently:
sage: hurwitz_zeta(s, x).series(s==1) Traceback (most recent call last): ... NotImplementedError: derivative with respect to first argument
But yes, of course: if it is possible to set the expansion in some place, then we get the respective expansion of hurwitz_zeta
for free, given that we have the generalized Stiltjes-constants.
comment:10 follow-up: ↓ 11 Changed 4 years ago by
It seems that adapting the expansion from .series()
is possible by implementing a _series_
-method (this is somehow mentioned here in symbolic/function.pyx
.
comment:11 in reply to: ↑ 10 Changed 4 years ago by
Replying to behackl:
It seems that adapting the expansion from
.series()
is possible by implementing a_series_
-method (this is somehow mentioned here insymbolic/function.pyx
.
Yes, setting any of these functions in Python will override Pynac's implementation (and slow down its calls). In case of _series_
it's dispatched to in function::series
, see https://github.com/pynac/pynac/blob/master/ginac/function.cpp#L943.
From experimentation I can say that if you define a Function_zeta::_series_()
method it will be called with 6 arguments, e.g. zeta(y).series(x==1,5)
will call the Python function Function_zeta::_series_(self, (y,), {'var': x, 'options': 0, 'at': 1, 'order': 5})
so you need to define it as _series_(self, varlist, var=..., options=... , at=..., order=...)
and return an expression.
comment:12 Changed 4 years ago by
Regarding this ticket: as it turns out, there are closed-form formulae for zetaderiv(k, 0)
in general, cf. this paper, Theorem 3 and (14).
The question is, whether we want that kind of expansion to happen for all k, or just for reasonably small k (as far as I can tell, these expansions really blow up fast in terms of summands).
Hi!
I'm rather motivated to implement some of the special values mentioned above; and I guess the "correct" place would be
src/functions/transcendental.py
, wouldn't it?However, I'm not quite sure of how to tackle the implementation of the Stieltjes constants. I think that it would be elegant if the constants were also available in pynac (such that
zeta(s).series(s==1)
could yield the appropriate series expansion directly).The problem with this approach is, that I'm not sure of how to implement a familiy of constants in pynac---or even just in sage.
What do you think about moving the part with the Stieltjes constants to a separate ticket?