ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 03 Nov 2015 20:54:56 -0600What guarantees simplify()?http://ask.sagemath.org/question/30440/what-guarantees-simplify/ How to convert (n!/k!)*binomial(k,n-k) to factorials? From an answer of tmonteil in question 30394:
var('k,n')
expr = n.factorial()/k.factorial()*binomial(k,n-k)
expr.factorial_simplify()
factorial(n)/(factorial(2*k - n)*factorial(-k + n))
The new question is: what is the contract of simplify()
(or factorial_simplify())?
I think a simplification is only useful if it returns
an equivalent expression. Is this is guaranteed?
In our example: Take n=1 and k=0. expr is 0 in this case
but expr.factorial_simplify() is not defined (or gives an
ValueError if executed) because factorial(2*k-n) = factorial(-1).
So my question might be rephrased: Is this an accidental
bug or a systematic unreliability which renders simplify()
essentially useless?
Peter
Tue, 03 Nov 2015 15:51:24 -0600http://ask.sagemath.org/question/30440/what-guarantees-simplify/Comment by kcrisman for <p>How to convert (n!/k!)*binomial(k,n-k) to factorials? From an answer of tmonteil in question 30394:</p>
<pre><code>var('k,n')
expr = n.factorial()/k.factorial()*binomial(k,n-k)
expr.factorial_simplify()
factorial(n)/(factorial(2*k - n)*factorial(-k + n))
</code></pre>
<p>The new question is: what is the contract of simplify()
(or factorial_simplify())? </p>
<p>I think a simplification is only useful if it returns
an equivalent expression. Is this is guaranteed? </p>
<p>In our example: Take n=1 and k=0. expr is 0 in this case
but expr.factorial_simplify() is not defined (or gives an
ValueError if executed) because factorial(2*k-n) = factorial(-1).</p>
<p>So my question might be rephrased: Is this an accidental
bug or a systematic unreliability which renders simplify()
essentially useless?</p>
<p>Peter</p>
http://ask.sagemath.org/question/30440/what-guarantees-simplify/?comment=30446#post-id-30446Simplification is simpler and hence presumably not always exactly the same. In fact, even `x/x` isn't really `1`. I think one should expect measure zero differences in such situations.Tue, 03 Nov 2015 20:54:56 -0600http://ask.sagemath.org/question/30440/what-guarantees-simplify/?comment=30446#post-id-30446