Ask Your Question

Specifying names of variables in output of self.coordinate_ring()

Let

E = EllipticCurve([1,2,3,4,5])


Then E.coordinate_ring() outputs a ring with generators.

E.coordinate_ring().gens()


yields

(xbar,ybar,zbar)


Is there a way to change the names of these variables at any point in this process?

EDIT The goal is to have sage treat the underlying rings to be treated as unique objects. Currently if I execute

E1 = EllipticCurve([1,2,3,4,5]).coordinate_ring()
E1._names = ('a','b','c')
E2 = EllipticCurve([1,2,3,4,5]).coordinate_ring()
E2._names =('l','m','n')
E1;E2


I get

Quotient of Multivariate Polynomial Ring in x, y, z over Rational Field by the ideal (-x^3 - 2*x^2*z + x*y*z + y^2*z - 4*x*z^2 + 3*y*z^2 - 5*z^3)
Quotient of Multivariate Polynomial Ring in x, y, z over Rational Field by the ideal (-x^3 - 2*x^2*z + x*y*z + y^2*z - 4*x*z^2 + 3*y*z^2 - 5*z^3)


(An indication that the rings are "the same":

E1sing = E1._singular_()
E2sing = E2._singular_()

ProdE1E2sing = singular.ringtensor(E1sing,E2sing);
ProdE1E2.sage()


gives

Quotient of Multivariate Polynomial Ring in x, y, z over Rational Field by the ideal (-x^3 - 2*x^2*z + x*y*z + y^2*z - 4*x*z^2 + 3*y*z^2 - 5*z^3)


whereas there should be 6 variables if the two rings were unique.)

Note: I have also tried to change the _gens, as well as injecting variables at every stage, but all with the same outcome.

edit retag close merge delete

1 Answer

Sort by ยป oldest newest most voted

This is probably an ugly hack, but you after reading the source code of such quotient rings, you can change the hidden _names attribute of your object as follows:

sage: R = E.coordinate_ring()
sage: R._names = ('X','Y','Z')


Then you can see:

sage: R.gens()
(X, Y, Z)


And you can let the Sage (=Python) variables X, Y, Z point to those indeterminates as follows:

sage: R.inject_variables()
Defining X, Y, Z
sage: X+Y^2
Y^2 + X

more

Comments

Agreed on the ugly hack.

( 2016-02-11 22:00:58 +0100 )edit

@tmonteil I un-accepted this answer since it didn't seem to actually change the names. But if I should accept the answer based on the unedited question and ask a new question, please let me know (or whatever the correct thing to do is).

( 2016-02-20 04:38:45 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Stats

Asked: 2016-02-11 06:18:32 +0100

Seen: 305 times

Last updated: Feb 20 '16