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.Sun, 11 Apr 2021 16:01:59 +0200Simplify factorials Questionhttps://ask.sagemath.org/question/56593/simplify-factorials-question/Hi , sorry this may seem so easy but i'm just starting sage !
I want this code to show the answer, how can i do that ? how can i change the code ?
n=var('n)
f=factorial(2*n + 3)/factorial(n + 1)
f.simplify_factorial()
output is :
factorial(2*n + 3)/factorial(n + 1)Sat, 10 Apr 2021 17:38:56 +0200https://ask.sagemath.org/question/56593/simplify-factorials-question/Comment by b@nnon.us for <p>Hi , sorry this may seem so easy but i'm just starting sage ! </p>
<p>I want this code to show the answer, how can i do that ? how can i change the code ?</p>
<pre><code>n=var('n)
f=factorial(2*n + 3)/factorial(n + 1)
f.simplify_factorial()
</code></pre>
<p>output is :</p>
<pre><code>factorial(2*n + 3)/factorial(n + 1)
</code></pre>
https://ask.sagemath.org/question/56593/simplify-factorials-question/?comment=56603#post-id-56603The answer would look like this:
$$(2n+3)(2n+2)(2n+1)(2n)(2n-1) \cdots (2n-n+2)$$
It would have $n+2$ factors. Not very useful, and I am not sure why it's needed.Sat, 10 Apr 2021 23:36:57 +0200https://ask.sagemath.org/question/56593/simplify-factorials-question/?comment=56603#post-id-56603Comment by vdelecroix for <p>Hi , sorry this may seem so easy but i'm just starting sage ! </p>
<p>I want this code to show the answer, how can i do that ? how can i change the code ?</p>
<pre><code>n=var('n)
f=factorial(2*n + 3)/factorial(n + 1)
f.simplify_factorial()
</code></pre>
<p>output is :</p>
<pre><code>factorial(2*n + 3)/factorial(n + 1)
</code></pre>
https://ask.sagemath.org/question/56593/simplify-factorials-question/?comment=56596#post-id-56596Could you develop on what you mean by "the answer"?Sat, 10 Apr 2021 19:26:56 +0200https://ask.sagemath.org/question/56593/simplify-factorials-question/?comment=56596#post-id-56596Answer by slelievre for <p>Hi , sorry this may seem so easy but i'm just starting sage ! </p>
<p>I want this code to show the answer, how can i do that ? how can i change the code ?</p>
<pre><code>n=var('n)
f=factorial(2*n + 3)/factorial(n + 1)
f.simplify_factorial()
</code></pre>
<p>output is :</p>
<pre><code>factorial(2*n + 3)/factorial(n + 1)
</code></pre>
https://ask.sagemath.org/question/56593/simplify-factorials-question/?answer=56617#post-id-56617Sage offers various ways to express the desired product, using
- factorial
- gamma
- falling factorial
- rising factorial
- product
- held product
Only the last one seems to keep the desired product
expressed as a product of n + 2 terms.
sage: k, n = SR.var('k, n')
sage: factorial(2*n + 3)/factorial(n + 1)
factorial(2*n + 3)/factorial(n + 1)
sage: gamma(2*n + 4)/gamma(n + 2)
gamma(2*n + 4)/gamma(n + 2)
sage: falling_factorial(2*n + 3, n + 2)
gamma(2*n + 4)/gamma(n + 2)
sage: rising_factorial(n + 2, n + 2)
gamma(2*n + 4)/gamma(n + 2)
sage: product(k, k, n + 2, 2*n + 3)
factorial(2*n + 3)/factorial(n + 1)
sage: product(k, k, n + 2, 2*n + 3, hold=True)
product(k, k, n + 2, 2*n + 3)
Sun, 11 Apr 2021 16:01:59 +0200https://ask.sagemath.org/question/56593/simplify-factorials-question/?answer=56617#post-id-56617