#16198: allow constant != 1 in log(power series)
-------------------------------------------------+-------------------------
Reporter: rws | Owner:
Type: defect | Status:
Priority: minor | needs_work
Component: calculus | Milestone: sage-6.5
Keywords: log, function, series | Resolution:
expansion | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
-------------------------------------------------+-------------------------
Description changed by jdemeyer:
Old description:
> `log(power series)` fails when the constant coefficient is not 1:
> {{{
> sage: R.<x> = PowerSeriesRing(ZZ)
> sage: log(2-x)
> ---------------------------------------------------------------------------
> ArithmeticError Traceback (most recent call
> last)
> <ipython-input-45-e3dfbfa60870> in <module>()
> ----> 1 log(Integer(2)-x)
>
> /home/ralf/sage/local/lib/python2.7/site-packages/sage/functions/log.pyc
> in __call__(self, *args, **kwds)
> 338 if base is None:
> 339 if len(args) == 1:
> --> 340 return GinacFunction.__call__(self, *args,
> **kwds)
> 341 # second argument is base
> 342 base = args[1]
>
> /home/ralf/sage/local/lib/python2.7/site-
> packages/sage/symbolic/function.so in
> sage.symbolic.function.BuiltinFunction.__call__
> (sage/symbolic/function.cpp:8750)()
>
> /home/ralf/sage/local/lib/python2.7/site-
> packages/sage/rings/power_series_ring_element.so in
> sage.rings.power_series_ring_element.PowerSeries.log
> (sage/rings/power_series_ring_element.c:12985)()
>
> ArithmeticError: constant term of power series is not 1
> }}}
> Pari has no problems:
> {{{
> ? log(2-x)
> %1 = 0.69314718055994530941723212145817656807 - 1/2*x - 1/8*x^2 -
> 1/24*x^3 - 1/64*x^4 - 1/160*x^5 - 1/384*x^6 - 1/896*x^7 - 1/2048*x^8 -
> 1/4608*x^9 - 1/10240*x^10 - 1/22528*x^11 - 1/49152*x^12 - 1/106496*x^13 -
> 1/229376*x^14 - 1/491520*x^15 + O(x^16)
> }}}
> Effectively the log of the constant is taken but this simply changes the
> base ring from whatever to SR if the constant is not equal to one.
New description:
`log(power series)` fails when the constant coefficient is not 1:
{{{
sage: R.<x> = PowerSeriesRing(RR)
sage: log(2+x)
---------------------------------------------------------------------------
ArithmeticError Traceback (most recent call
last)
<ipython-input-4-49ca3295e0d6> in <module>()
----> 1 log(Integer(2)+x)
/usr/local/src/sage-git/local/lib/python2.7/site-
packages/sage/functions/log.pyc in __call__(self, *args, **kwds)
311 if base is None:
312 if len(args) == 1:
--> 313 return GinacFunction.__call__(self, *args, **kwds)
314 # second argument is base
315 base = args[1]
/usr/local/src/sage-git/local/lib/python2.7/site-
packages/sage/symbolic/function.so in
sage.symbolic.function.BuiltinFunction.__call__
(build/cythonized/sage/symbolic/function.cpp:9120)()
/usr/local/src/sage-git/local/lib/python2.7/site-
packages/sage/rings/power_series_ring_element.so in
sage.rings.power_series_ring_element.PowerSeries.log
(build/cythonized/sage/rings/power_series_ring_element.c:15894)()
ArithmeticError: constant term of power series is not 1
}}}
Pari has no problems:
{{{
? log(2-x)
%1 = 0.69314718055994530941723212145817656807 - 1/2*x - 1/8*x^2 - 1/24*x^3
- 1/64*x^4 - 1/160*x^5 - 1/384*x^6 - 1/896*x^7 - 1/2048*x^8 - 1/4608*x^9 -
1/10240*x^10 - 1/22528*x^11 - 1/49152*x^12 - 1/106496*x^13 - 1/229376*x^14
- 1/491520*x^15 + O(x^16)
}}}
Effectively the log of the constant is taken but this simply changes the
base ring from whatever to SR if the constant is not equal to one.
--
--
Ticket URL: <http://trac.sagemath.org/ticket/16198#comment:8>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.