On Tue, Sep 27, 2011 at 7:15 PM, D. S. McNeil <dsm...@gmail.com> wrote:
> I don't think you should need to call _add_, but this looks like a bug to me:
>
> ----------------------------------------------------------------------
> | Sage Version 4.7.1, Release Date: 2011-08-11                       |
> | Type notebook() for the GUI, and license() for information.        |
> ----------------------------------------------------------------------
> sage: 1+SR(2)
> 3
> sage: 1.__add__(SR(2))
> 3
> sage: 1._add_(SR(2))
>
> ------------------------------------------------------------------------
> Unhandled SIGSEGV: A segmentation fault occurred in Sage.
> This probably occurred because a *compiled* component of Sage has a bug
> in it and is not properly wrapped with sig_on(), sig_off(). You might
> want to run Sage under gdb with 'sage -gdb' to debug this.
> Sage will now terminate.

This is definitely not a bug.   The definition of the _add_ method
absolutely demands that both inputs have exactly the same parent.  In
the above instance, the left hand input (=1) has parent ZZ, and the
right hand input (=SR(2)) has parent the symbolic ring.

 -- William

>
>
>
> Similarly for _sub_ and _mul_.  _div_ gives a slightly different result:
>
>
> sage: 1._div_(SR(2))
> 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', (3258, 0))
>
> 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', (3244, 0))
>
> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call last)
>
> /Users/mcneil/<ipython console> in <module>()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/rings/integer.so
> in sage.rings.integer.Integer._div_ (sage/rings/integer.c:11866)()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/rings/integer.so
> in sage.rings.integer.Integer._div_ (sage/rings/integer.c:11824)()
>
> /Applications/sage/local/lib/python2.6/site-packages/sage/rings/integer_ring.so
> in sage.rings.integer_ring.IntegerRing_class._div
> (sage/rings/integer_ring.c:5158)()
>
> TypeError: Argument 'right' has incorrect type (expected
> sage.rings.integer.Integer, got sage.symbolic.expression.Expression)
>
>
> Doug
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to 
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at 
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>



-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to