Ask Your Question
1

An Exercicse from A=B

asked 2024-07-19 16:28:28 +0100

Emm gravatar image

updated 2024-07-19 18:47:17 +0100

vdelecroix gravatar image

Let

$ r(n,k) = -k^2 (3n+3-2k) / (2(n+1-k)^2 (2n+1)) $

$ f(n,k) =\frac{n!^4}{k!^2 (n-k)!^2 (2n)!} $

$ g(n,k)=r(n,k) f(n,k) $

from Petkovsek, Wilf & Zeilberger's A=B, p. 27-29.

The authors show how to use Mathematica or Maple to prove that f(n+1,k)-f(n,k)-g(n,k+1)+g(n,k) is zero for any integer values of k and n.

I am not able to prove this with Sage (10.3). Any idea?

edit retag flag offensive close merge delete

Comments

Did you try to use any simplification methods in your code? Like this one:

var('n')
(factorial(n+1)/factorial(n)).simplify_full()
tolga gravatar imagetolga ( 2024-07-19 19:00:55 +0100 )edit

2 Answers

Sort by ยป oldest newest most voted
3

answered 2024-07-19 20:59:17 +0100

Max Alekseyev gravatar image

Function $r(n,k)$ and thus $g(n,k)$ can be computed from $f(n,k)$ as follows:

var('k n')
f(n,k) = factorial(n)^4 / factorial(k)^2 / factorial(n-k)^2 / factorial(2*n)
print( f.WZ_certificate(n, k) )

which prints 1/2*(2*k - 3*n - 3)*k^2/((k - n - 1)^2*(2*n + 1)) matching given $r(n,k)$.

edit flag offensive delete link more
2

answered 2024-07-20 07:21:32 +0100

Emmanuel Charpentier gravatar image

updated 2024-07-20 07:42:36 +0100

A tad less esoteric and much more lazier than @Max Alekseyev's excellent answer ; on Sage 10.4.rc3 :

sage: var("n, k")
(n, k)
sage: f(n, k)=factorial(n)^4/(factorial(k)^2*factorial(n-k)^2*factorial(2*n))
sage: r(n, k)=-k^2*(3*n+3-2*k)/(2*(n+1-k)^2*(2*n+1))
sage: g(n,k)=r(n,k)*f(n,k)
sage: %time (f(n+1,k)-f(n,k)-g(n,k+1)+g(n,k)).simplify_factorial().factor()
CPU times: user 5.87 s, sys: 12.5 ms, total: 5.88 s
Wall time: 4.76 s
0

And, BTW, one can be even lazier :

sage: %time (f(n+1,k)-f(n,k)-g(n,k+1)+g(n,k)).is_zero()
CPU times: user 8.09 s, sys: 56.1 ms, total: 8.15 s
Wall time: 6.75 s
True

To understand why, try :

sage: view((f(n+1,k)-f(n,k)-g(n,k+1)+g(n,k)).numerator())
sage: view((f(n+1,k)-f(n,k)-g(n,k+1)+g(n,k)).numerator().simplify_factorial())
sage: view((f(n+1,k)-f(n,k)-g(n,k+1)+g(n,k)).numerator().simplify_factorial().expand())

EDIT : Of course, this method is valid if and only if the denominator(s) aren't zero, which is possible :

sage: (f(n+1,k)-f(n,k)-g(n,k+1)+g(n,k)).denominator().simplify_factorial().factor().solve(k)
[k == n + 1, k == n, k == -1, factorial(-k + n - 1) == 0, factorial(k) == 0]

EDIT 2 : Other ways :

sage: (f(n+1,k)-f(n,k)-g(n,k+1)+g(n,k)).simplify_full() # simplify() isn't enough...
0
sage: (f(n+1,k)-f(n,k)-g(n,k+1)+g(n,k))._sympy_().simplify()
0
sage: (f(n+1,k)-f(n,k)-g(n,k+1)+g(n,k))._giac_().simplify()
0
sage: # Uses Wolfram Engine
sage: (f(n+1,k)-f(n,k)-g(n,k+1)+g(n,k))._mathematica_().FullSimplify() # Simplify() isn't enough
0

HTH,

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2024-07-19 16:28:28 +0100

Seen: 207 times

Last updated: Jul 20