ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 05 Sep 2019 10:33:54 +0200How did simplify_full() manipulate this expression?https://ask.sagemath.org/question/47674/how-did-simplify_full-manipulate-this-expression/ This is sort of a follow up to a previous question of mine: https://ask.sagemath.org/question/47535/checking-identity-of-two-combinatorial-expressions/
I wanted to prove a certain combinatorial equality. Now, to prove this identity in Sage, I can define the two function $\text{LHS}(n,k)$ and $\text{RHS}(n,k)$ representing the left- and righthand side and make sure that $\text{LHS}(n,k)-\text{RHS}(n,k)=0$ with the following code (actually the code provides a proof of a slightly more general identity,
which holds for other values of $n, k$ as well.):
var('n k')
def LHS(n,k):
return n/2*(
(n/2+1-k)/(n/2+1)*((n/2+1)/(k/2)*binomial(n/2-3,k-4)*2**(n/2-k+1)*1/(k/2-1)*binomial(k-4,k/2-2))+
2*(k/2+1)/(n/2+1)*((n/2+1)/(k/2+1)*binomial(n/2-3,k-2)*2**(n/2-k-1)*1/(k/2)*binomial(k-2,k/2-1)))
def RHS(n,k):
return (n/k)*(2**(n/2-k))*binomial(n/2-2,k-2)*binomial(k-2,k/2-1)
(LHS(n,k)-RHS(n,k)).simplify_full()
This outputs
0
which is what I want but I would like to prove this identity with pen-and-paper and this seems to be a bit tricky. I wonder if there is a way to see how exactly simplify_full() were able simplify the expressions?Fri, 30 Aug 2019 17:48:04 +0200https://ask.sagemath.org/question/47674/how-did-simplify_full-manipulate-this-expression/Comment by rburing for <p>This is sort of a follow up to a previous question of mine: <a href="https://ask.sagemath.org/question/47535/checking-identity-of-two-combinatorial-expressions/">https://ask.sagemath.org/question/475...</a></p>
<p>I wanted to prove a certain combinatorial equality. Now, to prove this identity in Sage, I can define the two function $\text{LHS}(n,k)$ and $\text{RHS}(n,k)$ representing the left- and righthand side and make sure that $\text{LHS}(n,k)-\text{RHS}(n,k)=0$ with the following code (actually the code provides a proof of a slightly more general identity,
which holds for other values of $n, k$ as well.):</p>
<pre><code>var('n k')
def LHS(n,k):
return n/2*(
(n/2+1-k)/(n/2+1)*((n/2+1)/(k/2)*binomial(n/2-3,k-4)*2**(n/2-k+1)*1/(k/2-1)*binomial(k-4,k/2-2))+
2*(k/2+1)/(n/2+1)*((n/2+1)/(k/2+1)*binomial(n/2-3,k-2)*2**(n/2-k-1)*1/(k/2)*binomial(k-2,k/2-1)))
def RHS(n,k):
return (n/k)*(2**(n/2-k))*binomial(n/2-2,k-2)*binomial(k-2,k/2-1)
(LHS(n,k)-RHS(n,k)).simplify_full()
</code></pre>
<p>This outputs</p>
<pre><code>0
</code></pre>
<p>which is what I want but I would like to prove this identity with pen-and-paper and this seems to be a bit tricky. I wonder if there is a way to see how exactly simplify_full() were able simplify the expressions?</p>
https://ask.sagemath.org/question/47674/how-did-simplify_full-manipulate-this-expression/?comment=47769#post-id-47769Try [generating functions](http://www.zacharyabel.com/papers/Multi-GF_A06_MathRefl.pdf) maybe.Thu, 05 Sep 2019 10:33:54 +0200https://ask.sagemath.org/question/47674/how-did-simplify_full-manipulate-this-expression/?comment=47769#post-id-47769Answer by Emmanuel Charpentier for <p>This is sort of a follow up to a previous question of mine: <a href="https://ask.sagemath.org/question/47535/checking-identity-of-two-combinatorial-expressions/">https://ask.sagemath.org/question/475...</a></p>
<p>I wanted to prove a certain combinatorial equality. Now, to prove this identity in Sage, I can define the two function $\text{LHS}(n,k)$ and $\text{RHS}(n,k)$ representing the left- and righthand side and make sure that $\text{LHS}(n,k)-\text{RHS}(n,k)=0$ with the following code (actually the code provides a proof of a slightly more general identity,
which holds for other values of $n, k$ as well.):</p>
<pre><code>var('n k')
def LHS(n,k):
return n/2*(
(n/2+1-k)/(n/2+1)*((n/2+1)/(k/2)*binomial(n/2-3,k-4)*2**(n/2-k+1)*1/(k/2-1)*binomial(k-4,k/2-2))+
2*(k/2+1)/(n/2+1)*((n/2+1)/(k/2+1)*binomial(n/2-3,k-2)*2**(n/2-k-1)*1/(k/2)*binomial(k-2,k/2-1)))
def RHS(n,k):
return (n/k)*(2**(n/2-k))*binomial(n/2-2,k-2)*binomial(k-2,k/2-1)
(LHS(n,k)-RHS(n,k)).simplify_full()
</code></pre>
<p>This outputs</p>
<pre><code>0
</code></pre>
<p>which is what I want but I would like to prove this identity with pen-and-paper and this seems to be a bit tricky. I wonder if there is a way to see how exactly simplify_full() were able simplify the expressions?</p>
https://ask.sagemath.org/question/47674/how-did-simplify_full-manipulate-this-expression/?answer=47676#post-id-47676Well...
sage: (LHS(n,k)-RHS(n,k)).simplify_factorial().canonicalize_radical()
0
is a big fat red hint...
**EDIT :** The big fat red hint is that `canonicalize_radical` transforms an "horrible`expression to someting more palatable...Fri, 30 Aug 2019 18:50:35 +0200https://ask.sagemath.org/question/47674/how-did-simplify_full-manipulate-this-expression/?answer=47676#post-id-47676Comment by joakim_uhlin for <p>Well...</p>
<pre><code>sage: (LHS(n,k)-RHS(n,k)).simplify_factorial().canonicalize_radical()
0
</code></pre>
<p>is a big fat red hint...</p>
<p><strong>EDIT :</strong> The big fat red hint is that <code>canonicalize_radical</code> transforms an "horrible`expression to someting more palatable...</p>
https://ask.sagemath.org/question/47674/how-did-simplify_full-manipulate-this-expression/?comment=47679#post-id-47679Right. As the expression obtained by writing "(LHS(n,k)-RHS(n,k)).simplify_factorial()" is quite horrible, I suspect that Sage will not be able to give me any good insight into how to prove this equality.Fri, 30 Aug 2019 20:05:52 +0200https://ask.sagemath.org/question/47674/how-did-simplify_full-manipulate-this-expression/?comment=47679#post-id-47679