Hi!
At several occasions in the last couple of days, I was bitten by
oddities and bugs in the conversion of multivariate polynomial rings.
Sure enough, if there is a coercion then conversion should be fine,
and I didn't find an error in this case.
However, what should happen if there is no coercion map? Should the
variables be mapped by position (corresponding to Singular's "fetch"
command) or by name (corresponding to Singular's "imap" command)?
Currently, *both* is used, which seems quite inconsistent to me:
First: Same variable names in different order
sage: R1.<a,b,c,d,e> = GF(3)[]
sage: R2.<e,d,c,b,a> = GF(3)[]
sage: R1('e')
e
sage: R2(_)
e
sage: R1(e)
e
-> It behaves like imap.
---------------------------
Second: Same number of variables, but only a partial overlap of names:
sage: R1.<a,b,c,d,e> = GF(3)[]
sage: R3.<f,e,d,b,c> = GF(3)[]
sage: R1('e')
e
sage: R3(_)
c
sage: R1(e)
b
-> It behaves like fetch
--------------------------
Third: Different number of variables, no coercion map available, but
still it should be the case that R1 can make a sense out of R4('e')
and vice versa. But in fact, it goes BOOOM:
sage: R1.<a,b,c,d,e> = GF(3)[]
sage: R4.<g,f,e,d,c,b> = GF(3)[]
sage: R1('e')
e
sage: R4(_)
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1181, 0))
---------------------------------------------------------------------------
TypeError Traceback (most recent
call last)
...
TypeError: unable to coerce <type 'list'> to an integer
sage: R1(e)
--> the same error
---------------------------
The third example is tracket at http://trac.sagemath.org/sage_trac/ticket/7654
-- hopefully some libsingular expert noticed it.
But what about the inconsistency in the first two examples?
For Infinite Polynomial Rings, I always need conversion *by names*. Is
there a conversion command (for MPolynomialRing_libsingular, at least)
that always behaves exactly like "imap" (and is as fast as imap, too)?
Actually imap would map a variable of the source ring to zero, if the
target ring has no variable of that name -- but that would be ok for
my application.
Best regards,
Simon
--
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org