Hello, read the following session OR if you won't please go directly to the question below
$ sage
----------------------------------------------------------------------
| Sage Version 5.6, Release Date: 2013-01-21 |
----------------------------------------------------------------------
sage: a,b,s = var('a b s')
sage: expr1 = (a^2*s + 2)/(s^3 + s + 3) + s
sage: expr1.denominator()
s^3 + s + 3
sage: type(s)
<type 'sage.symbolic.expression.Expression'>
sage: FF.<s> = FunctionField(SR)
sage: FF(expr1)
s + (a^2*s + 2)/(s^3 + s + 3)
sage: FF(expr1).denominator()
1
# s in expr1 is NOT recognized as the s in the definition of the
# function field.
sage: type(s)
<type 'sage.rings.function_field.function_field_element.FunctionFieldElement_rational'>
# BUT:
sage: x = var('x')
sage: expr2 = x + (45^2 + 2)/(x^3 + x + 3)
sage: FF2.<x> = FunctionField(RR)
# now RR instead of SR and x as the variable.
sage: FF2(expr2)
(x^4 + x^2 + 3.00000000000000*x + 2027.00000000000)/(x^3 + x + 3.00000000000000)
sage: FF2(expr2).denominator()
x^3 + x + 3.00000000000000
# x is correctly recognized in expr2 but not in expr1 !
sage: type(x)
<type 'sage.rings.function_field.function_field_element.FunctionFieldElement_rational'>
QUESTION: a FunctionField over RR with the variable x correctly recognizes expressions where x=var('x') appears in the expression (see above), and the computation of denominator is correct; FunctionField over SR with the variable s do not recognizes expressions with s=var('s'); instead in this case the s is treated like a coefficient (denominator=1 in example above in the first part). How can i adjust this behavior, so that I obtain the same answer in both following cases:
sage: expr1
s + (a^2*s + 2)/(s^3 + s + 3)
# here s = var('s') is symbolic expression
sage: FF(expr1).denominator()
1
# I DO NOT WANT THIS ANSWER
sage: FF(s + (a^2*s+2)/(s^3 + s + 3)).denominator()
s^3 + s + 3
# but this answer (that works if the expression is constructed by hand) with
sage: type(s)
<type 'sage.rings.function_field.function_field_element.FunctionFieldElement_rational'>
Any suggestion ? THANK YOU VERY MUCH !