[sage-support] Problem with simplify_hypergeometric().

2021-11-26 Thread Peter Luschny
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]

-- 
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+unsubscr...@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.


Re: [sage-support] Problem with simplify_hypergeometric().

2021-11-26 Thread Ray Rogers
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


On 11/26/21 10:13, Peter Luschny wrote:

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]

--
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+unsubscr...@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 
.


--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/dbcb79b0-1b5b-4178-7d06-5046e36eb607%40gmail.com.
(n,k),T(n,k) , [((0, 0), 1)]
(n,k),Ta(n,k), [((0, 0), 1)]
(n,k),S(n,k) , [((0, 0), 1)]
(n,k),Sa(n,k), [((0, 0), 1)]
--
(n,k),T(n,k) , [((1, 0), 1), ((1, 1), 1)]
(n,k),Ta(n,k), [((1, 0), 2), ((1, 1), 1)]
(n,k),S(n,k) , [((1, 0), 2), ((1, 1), 1)]
(n,k),Sa(n,k), [((1, 0), 2), ((1, 1), 1)]
--
(n,k),T(n,k) , [((2, 0), 1), ((2, 1), 2), ((2, 2), 1)]
(n,k),Ta(n,k), [((2, 0), 4), ((2, 1), 2), ((2, 2), 1)]
(n,k),S(n,k) , [((2, 0), 4), ((2, 1), 2), ((2, 2), 1)]
(n,k),Sa(n,k), [((2, 0), 4), ((2, 1), 2), ((2, 2), 1)]
--
(n,k),T(n,k) , [((3, 0), 1), ((3, 1), 3), ((3, 2), 2), ((3, 3), 1)]
(n,k),Ta(n,k), [((3, 0), 8), ((3, 1), 4), ((3, 2), 2), ((3, 3), 1)]
(n,k),S(n,k) , [((3, 0), 8), ((3, 1), 4), ((3, 2), 2), ((3, 3), 1)]
(n,k),Sa(n,k), [((3, 0), 8), ((3, 1), 4), ((3, 2), 2), ((3, 3), 1)]
--
(n,k),T(n,k) , [((4, 0), 1), ((4, 1), 4), ((4, 2), 4), ((4, 3), 2), ((4, 4), 1)]
(n,k),Ta(n,k), [((4, 0), 16), ((4, 1), 8), ((4, 2), 4), ((4, 3), 2), ((4, 4), 
1)]
(n,k),S(n,k) , [((4, 0), 16), ((4, 1), 8), ((4, 2), 4), ((4, 3), 2), ((4, 4), 
1)]
(n,k),Sa(n,k), [((4, 0), 16), ((4, 1), 8), ((4, 2), 4), ((4, 3), 2), ((4, 4), 
1)]
--
(n,k),T(n,k) , [((5, 0), 1), ((5, 1), 5), ((5, 2), 7), ((5, 3), 4), ((5, 4), 
2), ((5, 5), 1)]
(n,k),Ta(n,k), [((5, 0), 32), ((5, 1), 16), ((5, 2), 8), ((5, 3), 4), ((5, 4), 
2), ((5, 5), 1)]
(n,k),S(n,k) , [((5, 0), 32), ((5, 1), 16), ((5, 2), 8), ((5, 3), 4), ((5, 4), 
2), ((5, 5), 1)]
(n,k),Sa(n,k), [((5, 0), 32), ((5, 1), 16), ((5, 2), 8), ((5, 3), 4), ((5, 4), 
2), ((5, 5), 1)]
--
(n,k),T(n,k) , [((6, 0), 1), ((6, 1), 6), ((6, 2), 11), ((6, 3), 8), ((6, 4), 
4), ((6, 5), 2), ((6, 6), 1)]
(n,k),Ta(n,k), [((6, 0), 64), ((6, 1), 32), ((6, 2), 16), ((6, 3), 8), ((6, 4), 
4), ((6, 5), 2), ((6, 6), 1)]
(n,k),S(n,k) , [((6, 0), 64), ((6, 1), 32), ((6, 2), 16), ((6, 3), 8), ((6, 4), 
4), ((6, 5), 2), ((6, 6), 1)]
(n,k),Sa(n,k), [((6, 0), 64), ((6, 1), 32), ((6, 2), 16), ((6, 3), 8), ((6, 4), 
4), ((6, 5), 2), ((6, 6), 1)]
--
(n,k),T(n,k) , [((7, 0), 1), ((7, 1), 7), ((7, 2), 16), ((7, 3), 15), ((7, 4), 
8), ((7, 5), 4), ((7, 6), 2), ((7, 7), 1)]
(n,k),Ta(n,k), [((7, 0), 128), ((7, 1), 64), ((7, 2), 32), ((7, 3), 16), ((7, 
4), 8), ((7, 5), 4), ((7, 6), 2), ((7, 7), 1)]
(n,k),S(n,k) , [((7, 0), 128), ((7, 1), 64), ((7, 2), 32), ((7, 3), 16), ((7, 
4), 8), ((7, 5), 4), ((7, 6), 2), ((7, 7), 1)]
(n,k),Sa(n,k), [((7, 0), 128), ((7, 1), 64), ((7, 2), 32), ((7, 3), 16), ((7, 
4), 8), ((7, 5), 4), ((7, 6),

Re: [sage-support] Problem with simplify_hypergeometric().

2021-11-26 Thread slelievre
Possibly related:

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

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/ea264550-10b3-4c6e-9352-5c1fc2707a56n%40googlegroups.com.