Ask Your Question
1

Get denominator with hold=True

asked 3 years ago

anonymous user

Anonymous

updated 1 year ago

slelievre gravatar image

I am struggling to get the denominator of an expression defined with hold=True.

The expression is a quotient with a common factor in the numerator and denominator.

I don't want the common factor to be cleared out.

Example:

sage: t2 = x.mul(1 / (x^2 - x), hold=True)

sage: t2
x/(x^2 - x)

sage: t2.denominator()
x - 1

This results in x - 1 instead of x*(x - 1) or x^2 - x.

Is there any other way to obtain x^2 - x?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 3 years ago

vdelecroix gravatar image

updated 3 years ago

To 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 - x
Preview: (hide)
link

Comments

Thx. 🙈🙈🙈

Damm gravatar imageDamm ( 3 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 3 years ago

Seen: 737 times

Last updated: May 19 '23