#16198: allow constant <> 1 in log(power series)
-------------------------------------------------+-------------------------
       Reporter:  rws                            |        Owner:
           Type:  defect                         |       Status:  new
       Priority:  minor                          |    Milestone:  sage-6.2
      Component:  calculus                       |   Resolution:
       Keywords:  log, function, series          |    Merged in:
  expansion                                      |    Reviewers:
        Authors:                                 |  Work issues:
Report Upstream:  N/A                            |       Commit:
         Branch:                                 |     Stopgaps:
   Dependencies:                                 |
-------------------------------------------------+-------------------------
Changes (by rws):

 * priority:  major => minor


Old description:

> The default method for `log(power series)` is from GiNAC but it 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)
> }}}
> so calling Pari should be made default in `PowerSeries.log()`.

New 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.

--

Comment:

 So it looks like any constant from `exp(n)`, `n` in `NN0` will leave this
 in `PowerSeries(ZZ)` but anything else will make it necessary to rebase in
 `PowerSeries(SR)`.

--
Ticket URL: <http://trac.sagemath.org/ticket/16198#comment:2>
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.

Reply via email to