Opened 13 years ago

Closed 13 years ago

#3271 closed enhancement (duplicate)

inject and MPolynomialRing -- the inject_on command doesn't support MPolynomialRing

Reported by: was Owned by: malb
Priority: major Milestone: sage-3.0.2
Component: commutative algebra Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


Add support for MPolynomialRing to inject_on() command. This is likely very easy.

> Dear sage community,
> I am new to sage, so please forgive me if I am reporting well-known
> behaviour here.
> When generating multivariate polynomial rings, some (seemingly) odd
> things can happen:
> 1. Sage seems to guess the meaning of 'x' in some cases:
> sage: QX=MPolynomialRing(QQ,2,'xy'); QX
> Multivariate Polynomial Ring in x, y over Rational Field
> sage: x in QX     # no variables assinged to indeterminates yet...
> False

That is the predefined symbolic x that is defined at startup
before you do anything.   Unless you explicitly assign the
gens of QX to variables (or set auto injection on), 
they won't be bound to variables. 

sage: type(x)
<class 'sage.calculus.calculus.SymbolicVariable'>
sage: QX=MPolynomialRing(QQ,2,'xy')
sage: type(x)
<class 'sage.calculus.calculus.SymbolicVariable'>
sage: QX.gens()
(x, y)
sage: type(QX.gens()[0])
<type 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>

You might like the inject_on() mode:

sage: inject_on()
Redefining: Frac FreeMonoid GF FractionField FiniteField PolynomialRing quotient NumberField LaurentSeriesRing quo 
sage: QX=PolynomialRing(QQ,2,'xy')
Defining x, y
sage: type(x)
<type 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>
sage: type(y)
<type 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>

WARNING: inject_on only works with the PolynomialRing command, not the
MPolynomialRing command.   Either the latter should be supported, or 
the command should be removed entirely. 

Change History (2)

comment:1 Changed 13 years ago by burcin

I thought MPolynomialRing was set to be deprecated, see #2353.

comment:2 Changed 13 years ago by burcin

  • Resolution set to duplicate
  • Status changed from new to closed

This is a duplicate of #1414.

Note: See TracTickets for help on using tickets.