On Sat, Jan 9, 2010 at 1:11 PM, Shing Hing Man <mat...@yahoo.com> wrote:
> Hi,
>     First, I define the ring of polynomial over the rationals, S.
> Then define a polynomial g in S.
> Is there a simple way to convert g  to    type
> 'sage.symbolic.expression.Expression' ?
>
>   sage: S.<x> = PolynomialRing(QQ);S
> Univariate Polynomial Ring in x over Rational Field
> sage: g =  x^3 - 11*x^2 + 40*x -48;type(g)
> <class
> 'sage.rings.polynomial.polynomial_element_generic.Polynomial_rational_dense'>-
>
> Thanks in advance for any assistance!
> Shing
>

Yes, type SR(g):

sage: sage: S.<x> = PolynomialRing(QQ);S
Univariate Polynomial Ring in x over Rational Field
sage: g =  x^3 - 11*x^2 + 40*x -48;type(g)
<class 
'sage.rings.polynomial.polynomial_element_generic.Polynomial_rational_dense'>
sage: SR
Symbolic Ring
sage: SR(g)
((x - 11)*x + 40)*x - 48
sage: type(SR(g))
<type 'sage.symbolic.expression.Expression'>

In general, in Sage to convert an object obj to some structure X, do "X(obj)".

William
-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to