Hi Martin!

On 12 Dez., 16:00, Martin Albrecht <[email protected]>
wrote:
[...]
> It should always  map *by names* and not by index IMHO.

It isn't that easy, I think.

One very important requirements is: If there is coercion then
conversion should yield the same result.

So, if there is no coercion then conversion can do whatever we like --
for example, R(p) may map by name and raise an error if p contains a
variable that is not contained in R (this is what R(repr(p)) would do,
but of course R(p) should be faster than string conversion).
But if R(repr(p)) works then R(p) must not raise an error; see ticket
#7654

However, in my first two examples, there *are* coercion maps: More or
less canonical maps that are defined on the whole ring.

We have two natural choices for coercion from R1 to R2: By position
*or* by name; one could chose 'by name', and this is what is currently
done.

But there is no name-preserving map from R1 to R3. Therefore, coercion
is by position.
Imagine:
  sage: R.<a,b,c> = QQ[]
  sage: S.<x,a,b> = QQ[]
  sage: p1 = a*b
  sage: p2 = a*b + x*b
  sage: R(p1)  # it is possible to do it name preserving -- do what
can be done...
  a*b
  sage: R(p2) # now it is impossible, so, map by position
  b*c + a*c
What a desaster...!

So, I don't suggest that conversion should always attempt to be name
preserving.

Instead, my questions are:
1. Can you please fix #7654?
2. Is there a wrapper for singular's "imap"?

I would like to be able to do
  sage: R.imap(p1)
  a*b
  sage: R.imap(p2)
  a*b   # this is since x is mapped to zero

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

Reply via email to