Skip to content

Commit

Permalink
Trac #22142: Inconsistent handling of exact function arguments
Browse files Browse the repository at this point in the history
At the moment we have
{{{
sage: polylog(QQbar(sqrt(2)),3)
polylog(1.414213562373095?, 3)
}}}
and
{{{
sage: log(QQbar(sqrt(2)))
0.346573590279973
sage: type(_)
<type 'sage.rings.real_mpfr.RealNumber'>
}}}
So the logarithm of an exact value loses the exactness.

I would expect a symbolic expression
{{{
sage: log(QQbar(sqrt(2)))
log(1.414213562373095?)
}}}
where the argument is the symbolic encapsulation of `QQbar(sqrt(2))`
(for the same reason why the logarithm of the integer 2 becomes the
symbolic `log(2)`.

This is fixed for all `GinacFunctions` in Pynac git master. The ticket
should doctest them in the resp. files under `sage/functions`.

URL: https://trac.sagemath.org/22142
Reported by: dkrenn
Ticket author(s): Daniel Krenn
Reviewer(s): Ralf Stephan
  • Loading branch information
Release Manager authored and vbraun committed Feb 16, 2017
2 parents d9d49ca + c252b4d commit ba3fabd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/sage/functions/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,15 @@ def __init__(self):
3.141592653589793j
sage: log(x).subs(x=float(-1))
3.141592653589793j
:trac:`22142`::
sage: log(QQbar(sqrt(2)))
log(1.414213562373095?)
sage: log(QQbar(sqrt(2))*1.)
0.346573590279973
sage: polylog(QQbar(sqrt(2)),3)
polylog(1.414213562373095?, 3)
"""
GinacFunction.__init__(self, 'log', latex_name=r'\log',
conversions=dict(maxima='log', fricas='log'))
Expand Down

0 comments on commit ba3fabd

Please sign in to comment.