gamma(QQbar(...))

59 views
Skip to first unread message

Clemens Heuberger

unread,
Oct 7, 2016, 7:00:08 AM10/7/16
to sage-...@googlegroups.com

I was surprised by the following behaviour:

sage: gamma(QQbar(sqrt(2)))
0.886581428719259
sage: gamma(QQbar(sqrt(2))).parent()
Complex Field with 53 bits of precision

(I would have preferred to have some symbolic answer or at least an answer in
CIF, but not in CC)

Furthermore:

sage: gamma(QQbar(1/2))
Traceback (most recent call last):
...
TypeError: no canonical coercion from Algebraic Field to Rational Field


I am quite surprised that some result is given for QQbar(sqrt(2)), but not for
QQbar(1/2).

Regards,

Clemens

Ralf Stephan

unread,
Oct 9, 2016, 3:10:34 AM10/9/16
to sage-devel, clemens....@aau.at


On Friday, October 7, 2016 at 1:00:08 PM UTC+2, Clemens Heuberger wrote:

I was surprised by the following behaviour:

sage: gamma(QQbar(sqrt(2)))
0.886581428719259
sage: gamma(QQbar(sqrt(2))).parent()
Complex Field with 53 bits of precision

(I would have preferred to have some symbolic answer or at least an answer in
CIF, but not in CC)

There seems to be no way to effectively guarantee "What goes in goes out (at
least nearly)" except writing a dedicated QQbar.gamma() member function.
OTOH as soon as you return something other than QQbar from such a member
purists will roast you.

CIF doesn't have gamma() either but usage of CIF should be rethought in the light of
sage: ComplexBallField(100)(sqrt(2)).gamma()
[0.8865814287192591250809176124 +/- 2.00e-29]

Really, arb functionality and integration does not leave much to desire, so use it.

As to a possible symbolic result (is there one?) this could be added to the
symbolic gamma().


Furthermore:

sage: gamma(QQbar(1/2))
Traceback (most recent call last):
...
TypeError: no canonical coercion from Algebraic Field to Rational Field

That seems a genuine bug.

Ralf Stephan

unread,
Oct 22, 2016, 9:26:21 AM10/22/16
to sage-devel, clemens....@aau.at
On Friday, October 7, 2016 at 1:00:08 PM UTC+2, Clemens Heuberger wrote:

sage: gamma(QQbar(1/2))
Traceback (most recent call last):
...
TypeError: no canonical coercion from Algebraic Field to Rational Field

Here, Pynac applies a formula and tries effectively what is discussed in

I believe Sage is wrong to not try to convert to ZZ/QQ in AlgebraicNumber.__pow__()
Nevertheless Pynac git master now has a conversion workaround for gamma().

Reply all
Reply to author
Forward
0 new messages