On Thu, Sep 7, 2017 at 2:00 PM, Ben Hutz <bn4...@gmail.com> wrote:

> Yes, but *after* implementing the coercion for the homsets I'm getting the
> behavior above. The 'a==0' doesn't go through the coecion framework, but
> the a==P(0) does. So one returns true and the other false. I'm trying to
> figure out why == is not utilizing the coercion/richcmp in that case.
>

Once you construct P(0), both a and P(0) are in the same parent, so there
are no coercions involved in the test a==P(0).  In your branch, what does
sage: a.parent().coerce_map_from(QQ)
return?


> You'd be surprised at how often in Sage the shorthand of leaving of the
> last coordinate occurs. But, yes, it is just a shorthand and is used in the
> __init__() for point.
>

I certainly agree that leaving off the last coordinate is convenient and
common.  But the difference is between *conversion* (where you specify the
parent explicitly) and *coercion* (which happens implicitly, like in the
equality test you're making above).  Are you trying to add coercions, just
for A^1 and P^1?  Or something more?
David


> On Thursday, September 7, 2017 at 12:53:05 PM UTC-5, David Roe wrote:
>
>>
>>
>> On Thu, Sep 7, 2017 at 1:46 PM, Ben Hutz <bn4...@gmail.com> wrote:
>>
>>> Yes, I'm working on the coercion now.
>>>
>>> However, isn't a==0 checking coercion from the parent of a to the parent
>>> of 0. In other words, the homset of rational points on P and QQ.
>>>
>>
>> Yes, I got confused by the notation, since normally in Sage P(0) would
>> create an element of P.   But there's still no coercion:
>>
>> sage: a.parent().has_coerce_map_from(QQ)
>> False
>>
>> In dimension 1, there is a canonical coercion, but not in higher
>>> dimensions.
>>>
>>
>> Sure, but only for P^1 and A^1, not other curves.  Is there value in
>> having coercions just for those two, for dynamics for example?
>> David
>>
>> On Thursday, September 7, 2017 at 12:17:57 PM UTC-5, David Roe wrote:
>>>>
>>>> The reason that a==0 returns false is that there is no coercion map
>>>> from QQ to P:
>>>>
>>>> sage: P.has_coerce_map_from(QQ)
>>>> False
>>>>
>>>> I'm not convinced that there should be a coercion, it's pretty rare
>>>> that a scheme has a natural map from its base ring.
>>>> However, it seems like there's also a problem hiding here, probably
>>>> because schemes don't use the coercion model properly:
>>>>
>>>> sage: P.convert_map_from(QQ)
>>>> Traceback (most recent call last)
>>>> ...
>>>> RuntimeError: BUG in coercion model, no element constructor for <class
>>>> 'sage.schemes.projective.projective_space.ProjectiveSpace_
>>>> rational_field_with_category'>
>>>>
>>>> David
>>>>
>>>> On Thu, Sep 7, 2017 at 1:11 PM, Ben Hutz <bn4...@gmail.com> wrote:
>>>>
>>>>> I'm working on implementing coercion for scheme points and had a
>>>>> question about how comparison is done. As an explicit example consider the
>>>>> following point
>>>>>
>>>>> P.<u,v>= ProjectiveSpace (QQ ,1)
>>>>> a=P(0)
>>>>>
>>>>> in particular, the integer 0 is coerced into the projective point
>>>>> (0:1). For comparisons it appears that
>>>>>
>>>>> a == P(0)  (returns to True)
>>>>>
>>>>> calls the _richcmp_() function so uses the coercion framework, but
>>>>>
>>>>> a==0  (returns False even though it knows there is a coercion from the
>>>>> integer ring to P)
>>>>>
>>>>> is calling something else. There does not appear to be an  __eq__()
>>>>> operator implemented for scheme points, but it does show up in tab
>>>>> completion in the notebook, but can't tell me where the code is from. Is
>>>>> this an artifact of starting to transition the code to python3. Or this
>>>>> just broken somewhere?
>>>>>
>>>>> Thanks,
>>>>>   Ben
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "sage-devel" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to sage-devel+...@googlegroups.com.
>>>>> To post to this group, send email to sage-...@googlegroups.com.
>>>>> Visit this group at https://groups.google.com/group/sage-devel.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "sage-devel" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to sage-devel+...@googlegroups.com.
>>> To post to this group, send email to sage-...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/sage-devel.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to