On Wed, Jan 20, 2016 at 2:02 PM, Vincent Delecroix
<20100.delecr...@gmail.com> wrote:
> Sorry... I found out! We can implement a _pushout_ in the parent. Very
> simple. Sorry for the noise.

For completeness (when somebody finds this via a search) if you follow
the trac ticket, you'll see the nice simple code Vincent just wrote:

    def _pushout_(self, other):
        r"""
        Implement a pushout with real interval fields

        TESTS::

            sage: c = ComplexIntervalField(128).an_element()
            sage: r = RealIntervalField(64).an_element()
            sage: c + r
            1 + 1*I
            sage: r + c
            1 + 1*I
            sage: parent(c+r)
            Complex Interval Field with 64 bits of precision
        """
        from sage.rings.real_mpfi import RealIntervalField_class
        if isinstance(other, RealIntervalField_class):
            prec = min(self.prec(), other.prec())
            return ComplexIntervalField(prec)

Indeed, that is very nice, and it's hard to imagine something simpler.
Great job people who designed this (Robert Bradshaw et al.)!

> Vincent
>
>
> On 20/01/16 18:50, Vincent Delecroix wrote:
>>
>> Hello,
>>
>> I would like to make the following works (see #19922)
>> {{{
>> sage: c = ComplexIntervalField(128).an_element()
>> sage: r = RealIntervalField(64).an_element()
>> sage: c + r
>> 1 + 1*I
>> sage: parent(_)
>> Complex Interval Field with 64 bits of precision
>> }}}
>> (currently we got a type error)
>>
>> I am not sure how to proceed with coercions at this point as a new ring
>> needs to be created... any hint?
>>
>> Cheers,
>> Vincent
>
>
> --
> 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.



-- 
William (http://wstein.org)

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