On Oct 12, 12:27 pm, [EMAIL PROTECTED] wrote:
> On Fri, 12 Oct 2007, Joel B. Mohler wrote:
> > Hmm, possibly.  kwargs feels scary to me with variables since the 'x' in the
> > kwargs parameter list is a totally different 'x' than the one in P.gen(0).
> > They just happened to be named the same in some different scope.  I think
> > that allowing both methods might be ok.
>
> ... I don't understand what you mean by this.  When you construct a 
> polynomial ring, each variable gets a name, and that name is (AFAIK) 
> immutable.

I think I understand.  It just feels cleaner if variables are
variables, and strings are strings, and the two only meet during
parsing and printing (and not necessarily even during parsing).

For me, this is partly an aesthetic issue, but there are practical
consequences as well.  If some ways of dealing with polynomials
require variable names as strings, then there's no way of dealing with
this:

sage: QQ['x']['x']['x', 'x']
Multivariate Polynomial Ring in x, x over Univariate Polynomial Ring
in x over Univariate Polynomial Ring in x over Rational Field
sage: QQ['x']['x']['x', 'x'].random_element()
((-4*x^2 + x + 2)*x^2 + (2*x^2 + 8*x - 1/2)*x + 1/6*x^2 + 2*x + 1/4)*x
+ ((1/7*x^2 - 2*x - 1)*x^2 + (x^2 + x + 1/10)*x + 1/6*x^2 + 2*x + 1)*x
+ (1/2*x^2 + x + 1)*x^2 + (-2*x^2 + 9*x - 1)*x + 1/2*x^2 + x + 3/2

That's an absurd example, of course, but there are more important
issues as well.  Suppose you have an algorithm that takes a polynomial
in an arbitrary multivariate ring, and your algorithm needs to lift
the polynomial to a ring with one more variable, do some computations
there, and then drop back to the original ring.  What to name the new
variable?  If names are unimportant, and the identity of the variable
object is all that matters, then it's easy...just always name the new
variable "z".  However, if names are vital, then it's important to
make sure the name doesn't clash with any names used in the current
polynomial ring (or its base rings, recursively).

However, given all that, I think separating variables and their names
is a lost cause in SAGE.  Polynomials must have distinct, sensible
variable names, or else they cannot be shared with Pari, or with any
subprocess-based interface.  There's already code all through SAGE
that maps back and forth between variables and their names with
abandon, so adding one more place won't hurt much.

There is one more issue; I wonder if cutting down on the number of
places we need to map from strings to variables would make things
faster?

Carl


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to