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.Wed, 11 Nov 2015 20:35:52 +0100Simplifying a simple rational functionhttps://ask.sagemath.org/question/30641/simplifying-a-simple-rational-function/The following code:
var('d,T')
simplify((d^(T + 1)-d)/d)
returns:
(d^(T + 1) - d)/d
Apparently, this should be simplified to:
d^T - 1
What am I doing wrong?Wed, 11 Nov 2015 19:21:58 +0100https://ask.sagemath.org/question/30641/simplifying-a-simple-rational-function/Answer by B r u n o for <p>The following code:</p>
<pre><code>var('d,T')
simplify((d^(T + 1)-d)/d)
</code></pre>
<p>returns:</p>
<pre><code>(d^(T + 1) - d)/d
</code></pre>
<p>Apparently, this should be simplified to:</p>
<pre><code>d^T - 1
</code></pre>
<p>What am I doing wrong?</p>
https://ask.sagemath.org/question/30641/simplifying-a-simple-rational-function/?answer=30643#post-id-30643For this expression, you can use `simplify_rational()` instead of `simplify()`:
sage: var('d, T')
(d, T)
sage: f = (d^(T+1)-d)/d
sage: f.simplify_rational()
d^T - 1
Note that in this case you also have:
sage: f.expand()
d^T - 1
Note that in a more general case, the "most simplified" expression is obtained with the command `simplify_full()`:
sage: f.simplify_full()
d^T - 1Wed, 11 Nov 2015 20:35:52 +0100https://ask.sagemath.org/question/30641/simplifying-a-simple-rational-function/?answer=30643#post-id-30643