#16671: implement harmonic number function H(n,m)
-------------------------+-------------------------------------------------
       Reporter:  rws    |        Owner:
           Type:         |       Status:  needs_work
  defect                 |    Milestone:  sage-6.4
       Priority:  major  |   Resolution:
      Component:         |    Merged in:
  symbolics              |    Reviewers:
       Keywords:         |  Work issues:
  special, log           |       Commit:
        Authors:  Ralf   |  fabf86397adf8c07ce9b63b64c64e5f724702d21
  Stephan                |     Stopgaps:
Report Upstream:  N/A    |
         Branch:         |
  u/rws/16671            |
   Dependencies:         |
-------------------------+-------------------------------------------------

Comment (by rws):

 Replying to [comment:47 jdemeyer]:
 > Artificial example (this could be a doctest):
 > {{{
 > sage: harmonic_number._eval_(10, Qp(5)(1))
 > 7381/2520
 > }}}
 > but the answer should be
 > {{{
 > sage: Qp(5)(harmonic_number(10))
 > 4*5^-1 + 2 + 2*5 + 4*5^2 + 3*5^3 + 5^4 + 4*5^5 + 4*5^6 + 5^7 + 4*5^8 +
 3*5^9 + 5^10 + 4*5^11 + 4*5^12 + 5^13 + 4*5^14 + 3*5^15 + 5^16 + 4*5^17 +
 4*5^18 + O(5^19)
 > }}}
 I think this is the only example where `H(n,m)` would have a useful
 meaning, and it can be computed, as you show, by staying in the rationals
 and converting the result. Trying to support this case however will fail
 in `BuiltinFunction.__call__`:
 {{{
 sage: harmonic_number(5,Qp(5)(8))
 Traceback (most recent call last):
   File "<ipython-input-9-03dbaa59749c>", line 1, in <module>
     harmonic_number(Integer(5),Qp(Integer(5))(Integer(8)))
   File "/home/ralf/sage/local/lib/python2.7/site-
 packages/sage/functions/log.py", line 886, in __call__
     return BuiltinFunction.__call__(self, z, m, **kwds)
   File "sage/symbolic/function.pyx", line 993, in
 sage.symbolic.function.BuiltinFunction.__call__
 (build/cythonized/sage/symbolic/function.cpp:10572)
     res = super(BuiltinFunction, self).__call__(
   File "sage/symbolic/function.pyx", line 487, in
 sage.symbolic.function.Function.__call__
 (build/cythonized/sage/symbolic/function.cpp:6301)
     raise TypeError, "cannot coerce arguments: %s"%(err)
 TypeError: cannot coerce arguments: no canonical coercion from 5-adic
 Field with capped relative precision 20 to Symbolic Ring
 }}}

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