Problem with simplify_hypergeometric().

29 views
Skip to first unread message

Peter Luschny

unread,
Nov 26, 2021, 10:13:28 AM11/26/21
to sage-support
Please consider

         def H(n,k): return hypergeometric([-k, -n + k], [-k], -1)
    def T(n,k): return int(H(n,k).n())
    def S(n,k): return H(n,k).simplify_hypergeometric()
    for n in range(8):
        print([T(n, k) for k in range(n+1)])
        print([S(n, k) for k in range(n+1)])

The result:

[1] [1] [1, 1] [2, 1] [1, 2, 1] [4, 2, 1] [1, 3, 2, 1] [8, 4, 2, 1]

I expected the same result in both cases. Note that both Maple and Mathematika return the first variant, T(n, k), probably indicating a problem in simplify_hypergeometric()? [Windows 64, Sage 9.3]

Ray Rogers

unread,
Nov 26, 2021, 11:04:24 AM11/26/21
to sage-s...@googlegroups.com, peter....@gmail.com

I think this illustrates the problem more clearly; possibly related to a complaint that I got bounced on :)

def H(n,k): return hypergeometric([-k, -n + k], [-k], -1)

def Ha(n,k): return hypergeometric([ -n + k], [], -1)
def T(n,k): return int(H(n,k).n())
def Ta(n,k): return int(Ha(n,k).n())
def S(n,k): return H(n,k).simplify_hypergeometric()
def Sa(n,k): return Ha(n,k).simplify_hypergeometric()
for n in range(8):
        print('(n,k),T(n,k) ' + ', '+str([((n,k),T(n, k)) for k in range(n+1)]))
        print('(n,k),Ta(n,k)' + ', '+str([((n,k),Ta(n, k)) for k in range(n+1)]))
        print('(n,k),S(n,k) ' + ', '+str([((n,k),S(n, k)) for k in range(n+1)]))
        print('(n,k),Sa(n,k)' + ', '+str([((n,k),Sa(n, k)) for k in range(n+1)]))
        print('--------------')

The result is attached; since it goes on for a while.  The core is that the numerator [-k] and denominator [-k] is not always cancelled.  Apparently the problem reaches further than I thought.

Ray

--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/dcc99528-81b3-439e-bf74-38af5688bc67n%40googlegroups.com.
sage-math-hyp.txt

slelievre

unread,
Nov 26, 2021, 1:32:24 PM11/26/21
to sage-support
Possibly related:

- Sage Trac ticket 31890
  simplify_hypergeometric is unstable
  https://trac.sagemath.org/ticket/31890

Reply all
Reply to author
Forward
0 new messages