Nils,  thanks  -- I think I was able to do what I want using your code
snippet


def foo(f1,f2,vs):
    R = PolynomialRing(QQ,vs)
    f1_ = R(f1)
    f2_ = R(f2)
    I = R*[f1_]
    G = I.radical().groebner_basis()
    res = f2_.reduce(G)
    return res == 0




On Sep 7, 3:04 pm, Nils Bruin <nbr...@sfu.ca> wrote:
> On Sep 7, 1:34 pm, tvn <nguyenthanh...@gmail.com> 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_domai 
> n'>

-- 
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