Loading [MathJax]/jax/output/HTML-CSS/jax.js
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 5 years ago

Iguananaut gravatar image

I got

sage: n=var('n')
sage: assume(n>=0)
sage: assume(n,'integer')
sage: a_n=1/20*(1/2*sqrt(5) + 1/2)^n*(11*sqrt(5) + 25) - 1/20*(-1/2*sqrt(5) + 1/2)^n*(11*sqrt(5) - 25) - 1/12*
....: (1/2*I*sqrt(3) + 1/2)^n*(I*sqrt(3) + 3) - 1/12*(-1/2*I*sqrt(3) + 1/2)^n*(-I*sqrt(3) + 3)
sage: a_n.real_part()
------------------------------------------------------------------------
Unhandled SIGSEGV: A segmentation fault occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.
------------------------------------------------------------------------
Segmentation fault (core dumped)

Will update my answer as I find out more, but obviously a segfault shouldn't happen here.

click to hide/show revision 2
No.2 Revision

I got

sage: n=var('n')
sage: assume(n>=0)
sage: assume(n,'integer')
sage: a_n=1/20*(1/2*sqrt(5) + 1/2)^n*(11*sqrt(5) + 25) - 1/20*(-1/2*sqrt(5) + 1/2)^n*(11*sqrt(5) - 25) - 1/12*
....: (1/2*I*sqrt(3) + 1/2)^n*(I*sqrt(3) + 3) - 1/12*(-1/2*I*sqrt(3) + 1/2)^n*(-I*sqrt(3) + 3)
sage: a_n.real_part()
------------------------------------------------------------------------
Unhandled SIGSEGV: A segmentation fault occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.
------------------------------------------------------------------------
Segmentation fault (core dumped)

Will update my answer as I find out more, but obviously a segfault shouldn't happen here.

Confirmed on Linux and Windows. The segfault is coming from pynac.

click to hide/show revision 3
No.3 Revision

I got

sage: n=var('n')
sage: assume(n>=0)
sage: assume(n,'integer')
sage: a_n=1/20*(1/2*sqrt(5) + 1/2)^n*(11*sqrt(5) + 25) - 1/20*(-1/2*sqrt(5) + 1/2)^n*(11*sqrt(5) - 25) - 1/12*
....: (1/2*I*sqrt(3) + 1/2)^n*(I*sqrt(3) + 3) - 1/12*(-1/2*I*sqrt(3) + 1/2)^n*(-I*sqrt(3) + 3)
sage: a_n.real_part()
------------------------------------------------------------------------
Unhandled SIGSEGV: A segmentation fault occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.
------------------------------------------------------------------------
Segmentation fault (core dumped)

Will update my answer as I find out more, but obviously a segfault shouldn't happen here.

Confirmed on Linux and Windows. The segfault is coming from pynac.pynac. It seems to be specifically the assume(n, 'integer') part that does it. Without that it doesn't crash.

click to hide/show revision 4
No.4 Revision

I got

sage: n=var('n')
sage: assume(n>=0)
sage: assume(n,'integer')
sage: a_n=1/20*(1/2*sqrt(5) + 1/2)^n*(11*sqrt(5) + 25) - 1/20*(-1/2*sqrt(5) + 1/2)^n*(11*sqrt(5) - 25) - 1/12*
....: (1/2*I*sqrt(3) + 1/2)^n*(I*sqrt(3) + 3) - 1/12*(-1/2*I*sqrt(3) + 1/2)^n*(-I*sqrt(3) + 3)
sage: a_n.real_part()
------------------------------------------------------------------------
Unhandled SIGSEGV: A segmentation fault occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.
------------------------------------------------------------------------
Segmentation fault (core dumped)

Will update my answer as I find out more, but obviously a segfault shouldn't happen here.

Confirmed on Linux and Windows. The segfault is coming from pynac. It seems to be specifically the assume(n, 'integer') part that does it. Without that it doesn't crash.

I spent a few minutes trying to narrow this down to a simpler example and got this

sage: n=var('n')
sage: assume(n, 'integer')
sage: (I^n).real_part()
<segfault>

It appears to go into an infinite recursion and eventually overflow the stack in

src/sagemath/sage/local/lib/libpynac.so.18(_ZNK5GiNaC5power9real_partEv+0x51)[0x7f7c45607bf1]

The correct answer for Re[in] should be cos(πn2) but I guess it's not that clever, and it certainly shouldn't crash...

If I don't stipulate that nZ then it does give the correct answer:

sage: n=var('n')
sage: (I^n).real_part()
cos(1/2*pi*real_part(n))*e^(-1/2*pi*imag_part(n))
click to hide/show revision 5
No.5 Revision

I got

sage: n=var('n')
sage: assume(n>=0)
sage: assume(n,'integer')
sage: a_n=1/20*(1/2*sqrt(5) + 1/2)^n*(11*sqrt(5) + 25) - 1/20*(-1/2*sqrt(5) + 1/2)^n*(11*sqrt(5) - 25) - 1/12*
....: (1/2*I*sqrt(3) + 1/2)^n*(I*sqrt(3) + 3) - 1/12*(-1/2*I*sqrt(3) + 1/2)^n*(-I*sqrt(3) + 3)
sage: a_n.real_part()
------------------------------------------------------------------------
Unhandled SIGSEGV: A segmentation fault occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.
------------------------------------------------------------------------
Segmentation fault (core dumped)

Will update my answer as I find out more, but obviously a segfault shouldn't happen here.

Confirmed on Linux and Windows. The segfault is coming from pynac. It seems to be specifically the assume(n, 'integer') part that does it. Without that it doesn't crash.

I spent a few minutes trying to narrow this down to a simpler example and got this

sage: n=var('n')
sage: assume(n, 'integer')
sage: (I^n).real_part()
<segfault>

It appears to go into an infinite recursion and eventually overflow the stack in

src/sagemath/sage/local/lib/libpynac.so.18(_ZNK5GiNaC5power9real_partEv+0x51)[0x7f7c45607bf1]

The correct answer for Re[in] should be cos(πn2) but I guess it's not that clever, and it certainly shouldn't crash...

If I don't stipulate that nZ then it does give the correct answer:answer, sort of...

sage: n=var('n')
sage: (I^n).real_part()
cos(1/2*pi*real_part(n))*e^(-1/2*pi*imag_part(n))
click to hide/show revision 6
No.6 Revision

I got

sage: n=var('n')
sage: assume(n>=0)
sage: assume(n,'integer')
sage: a_n=1/20*(1/2*sqrt(5) + 1/2)^n*(11*sqrt(5) + 25) - 1/20*(-1/2*sqrt(5) + 1/2)^n*(11*sqrt(5) - 25) - 1/12*
....: (1/2*I*sqrt(3) + 1/2)^n*(I*sqrt(3) + 3) - 1/12*(-1/2*I*sqrt(3) + 1/2)^n*(-I*sqrt(3) + 3)
sage: a_n.real_part()
------------------------------------------------------------------------
Unhandled SIGSEGV: A segmentation fault occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.
------------------------------------------------------------------------
Segmentation fault (core dumped)

Will update my answer as I find out more, but obviously a segfault shouldn't happen here.

Confirmed on Linux and Windows. The segfault is coming from pynac. It seems to be specifically the assume(n, 'integer') part that does it. Without that it doesn't crash.

I spent a few minutes trying to narrow this down to a simpler example and got this

sage: n=var('n')
sage: assume(n, 'integer')
sage: (I^n).real_part()
<segfault>

It appears to go into an infinite recursion and eventually overflow the stack in

src/sagemath/sage/local/lib/libpynac.so.18(_ZNK5GiNaC5power9real_partEv+0x51)[0x7f7c45607bf1]

The correct answer for Re[in] should be cos(πn2) but I guess it's not that clever, and it certainly shouldn't crash...

If I don't stipulate that nZ then it does give the correct answer, sort of...

sage: n=var('n')
sage: (I^n).real_part()
cos(1/2*pi*real_part(n))*e^(-1/2*pi*imag_part(n))

This is now tracked at https://trac.sagemath.org/ticket/28357