On Sep 7, 1:34 pm, tvn <[email protected]> wrote:
> Hi John and Jason,  thanks  --  the inject_variables() did what I
> want.
>
> I have another question below and hope you can help
>
> what if I already have create a function call f = x - y as below
>
> sage: vs = var('x y')
> sage: f = x - y
> sage: type(f)
> <type 'sage.symbolic.expression.Expression'>

The expression f is not a function, but a symbolic expression. It is
callable, though

sage: f(x=1,y=1)
0
sage: g(x,y)=x-y
sage: type(g)
<type 'sage.symbolic.expression.Expression'>

OK, so that doesn't give it away. But:

sage: g(1,1)
0

(Note that there is no need to specify the names of the variables. Try
that with f and you'll get a deprecation warning.)

Anyway, for your question:

sage: F=QQ['x','y'](f)
sage: F
x - y
sage: type(F)
<type
'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>

It's not a "polydict", but I think all dictionary functionality is
present on F as well.

I haven't succeeded in creating a "polydict" bivariate polynomial ring
over Q. You can get a a "polydict" ring by asking for a polynomial
ring over a more exotic base ring:

sage: type(PolynomialRing(FractionField(QQ['t']),['x','y']))
<class
'sage.rings.polynomial.multi_polynomial_ring.MPolynomialRing_polydict_domain'>

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to