#32016 closed enhancement (fixed)

Fix hurwitz_zeta(0, x) not expanding

Reported by: pluschny Owned by:
Priority: minor Milestone: sage-9.4
Component: symbolics Keywords: hurwitz_zeta
Cc: slelievre Merged in:
Authors: Frédéric Chapoton Reviewers: Peter Luschny
Report Upstream: N/A Work issues:
Branch: 785b4e2 (Commits, GitHub, GitLab) Commit: 785b4e27162892519d6bb1d5208551893e28a52e
Dependencies: Stopgaps:

Status badges

Description (last modified by slelievre)

Having defined:

def B(n, x):
    return -n*hurwitz_zeta(1 - n, x) if n != 0 else 1

we expect expand(B(n, x)) to match bernoulli_polynomial(x, n).

Using this small utility function to compare them:

def table(nmax):
    nab = [('n', 'expand(B(n, x))', 'bernoulli_polynomial(x, n)')]
    nab.extend([(n, expand(B(n, x)), bernoulli_polynomial(x, n))
                for n in range(nmax + 1)])
    k = len(str(nmax))
    m = max(len(str(x)) for t in nab for x in t)
    hline = '-' * (k + m + 7)
    print(hline)
    for n, a, b in nab:
        print(f' %{k}s     %{m}s' % (n, a))
        print(f' %{k}s     %{m}s' % ('', b))
        print(hline)

we notice they match except for n = 1:

sage: table(4)
----------------------------------
 n                expand(B(n, x))
       bernoulli_polynomial(x, n)
----------------------------------
 0                              1
                                1
----------------------------------
 1            -hurwitz_zeta(0, x)
                          x - 1/2
----------------------------------
 2                  x^2 - x + 1/6
                    x^2 - x + 1/6
----------------------------------
 3          x^3 - 3/2*x^2 + 1/2*x
            x^3 - 3/2*x^2 + 1/2*x
----------------------------------
 4       x^4 - 2*x^3 + x^2 - 1/30
         x^4 - 2*x^3 + x^2 - 1/30
----------------------------------

This ticket fixes that case.

Change History (7)

comment:1 Changed 14 months ago by chapoton

  • Authors set to Frédéric Chapoton
  • Branch set to u/chapoton/32016
  • Commit set to 785b4e27162892519d6bb1d5208551893e28a52e
  • Status changed from new to needs_review

fixed, please review


New commits:

785b4e2Hurwitz zeta at n=0

comment:2 Changed 14 months ago by pluschny

  • Status changed from needs_review to positive_review

Looks good to me. Merci!

comment:3 Changed 14 months ago by chapoton

reviewer full name please

comment:4 Changed 14 months ago by pluschny

  • Reviewers set to Peter Luschny

I don't know if I am qualified as a reviewer in the sense of the SageMath organization.

comment:5 Changed 14 months ago by slelievre

  • Cc slelievre added
  • Description modified (diff)
  • Keywords hurwitz_zeta added
  • Summary changed from hurwitz_zeta(0, x) does not expand to Fix hurwitz_zeta(0, x) not expanding
  • Type changed from PLEASE CHANGE to enhancement

I don't know if I am qualified as a reviewer in the sense of the SageMath organization.

You are!

comment:6 Changed 14 months ago by slelievre

  • Description modified (diff)

comment:7 Changed 13 months ago by vbraun

  • Branch changed from u/chapoton/32016 to 785b4e27162892519d6bb1d5208551893e28a52e
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.