On Thu, May 22, 2008 at 8:50 AM, Simon King <[EMAIL PROTECTED]> wrote:
>
> Dear William,
>
> On May 22, 4:09 pm, "William Stein" <[EMAIL PROTECTED]> wrote:
>> I disagree. There is a canonical coercion to the symbolic ring.
>
> It seems that i need to learn more about canonical coercion. I thought
> that a coercion map goes between two parent structures, according to
> http://modular.math.washington.edu/sage/doc/html/prog/node17.html
> But the strings do not form a parent structure (or at least,
> 'x'.parent() is not defined).
That's right.
>
> In fact there is no coercion around:
There is a non-canonical coercion:
sage: SR('x')
x
That's used when constructing the symbolic equation:
sage: x == 'x'
x == x
Normally equality testing should only use canonical coercions:
sage: QQ(1) == GF(7)(1)
False
sage: GF(7)(QQ(1))
1
> sage: x.parent()._coerce_('x')
> Traceback
> ...
> <type 'exceptions.TypeError'>: cannot coerce type '<type 'str'>' into
> a SymbolicExpression.
>
> Consequently, we have
> sage: x == 'x***2'
> False
>
> According to
> http://modular.math.washington.edu/sage/doc/html/prog/node17.html,
> var('x')=='x' should return False as well, since there is no coercion
> between strings and SymbolicExpression.
var('x') == 'x' is a constructor for a symbolic equation, so it should
return a symbolic equation.
>
> So, in what sense is var('x')=='x' involving a canonical coercion
> map?
It turns out that this involves the noncanonical coercion map.
> Is there a definition of "coercion map" and of "canonical", except the
> page http://modular.math.washington.edu/sage/doc/html/prog/node17.html?
Yes.
-- William
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---