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.Mon, 26 Apr 2021 08:37:24 +0200Get denominator with hold=Truehttps://ask.sagemath.org/question/56811/get-denominator-with-holdtrue/t2=x.mul(1/(x^2-x),hold=True)
t2.denominator()
results in x-1 instead of x*(x-1) or x^2-x. Is there any other way to obtain x^2-x?Sun, 25 Apr 2021 22:03:53 +0200https://ask.sagemath.org/question/56811/get-denominator-with-holdtrue/Answer by vdelecroix for <p>t2=x.mul(1/(x^2-x),hold=True)
t2.denominator()</p>
<p>results in x-1 instead of x*(x-1) or x^2-x. Is there any other way to obtain x^2-x?</p>
https://ask.sagemath.org/question/56811/get-denominator-with-holdtrue/?answer=56813#post-id-56813To find out about the possible extra arguments of a method you could access its documentation with a question mark. Here
sage: t2.denominator?
Docstring:
Return the denominator of this symbolic expression
INPUT:
* "normalize" -- (default: "True") a boolean.
If "normalize" is "True", the expression is first normalized to
have it as a fraction before getting the denominator.
If "normalize" is "False", the expression is kept and if it is not
a quotient, then this will just return 1.
Hence in your situation you could do
sage: t2.denominator(normalize=False)
x^2 - xSun, 25 Apr 2021 23:37:37 +0200https://ask.sagemath.org/question/56811/get-denominator-with-holdtrue/?answer=56813#post-id-56813Comment by Damm for <p>To find out about the possible extra arguments of a method you could access its documentation with a question mark. Here</p>
<pre><code>sage: t2.denominator?
Docstring:
Return the denominator of this symbolic expression
INPUT:
* "normalize" -- (default: "True") a boolean.
If "normalize" is "True", the expression is first normalized to
have it as a fraction before getting the denominator.
If "normalize" is "False", the expression is kept and if it is not
a quotient, then this will just return 1.
</code></pre>
<p>Hence in your situation you could do</p>
<pre><code>sage: t2.denominator(normalize=False)
x^2 - x
</code></pre>
https://ask.sagemath.org/question/56811/get-denominator-with-holdtrue/?comment=56820#post-id-56820Thx. ðŸ™ˆðŸ™ˆðŸ™ˆMon, 26 Apr 2021 08:37:24 +0200https://ask.sagemath.org/question/56811/get-denominator-with-holdtrue/?comment=56820#post-id-56820