Memory error mixing exact numbers and decimal ones

asked 2017-02-14 18:42:39 +0200

franpena gravatar image

Hi,

I wonder why this code gives an error in Sage 7.5.1:

f(x)=3*sin(2*pi*(1.75-2*x))
if abs(f(0.7)) < 1e-12:
     print 1

MemoryError: Not enough memory to calculate cyclotomic polynomial of 428914250225777
edit retag flag offensive close merge delete

Comments

1

Checking whether a given expression is close to zero symbolically can be very challenging. Still, it does seem surprising that this would come in with something that seems simple ... as a workaround, try f(0.7).n() instead. (The pi is not approximated otherwise, which is presumably what is leading to this problem.)

kcrisman gravatar imagekcrisman ( 2017-02-14 22:36:10 +0200 )edit

This is indeed a bug that is also reproducible on sage-7.6.beta5.

vdelecroix gravatar imagevdelecroix ( 2017-03-10 01:18:13 +0200 )edit

Is there a ticket for it yet?

kcrisman gravatar imagekcrisman ( 2017-03-10 05:50:57 +0200 )edit

Not that I know.

vdelecroix gravatar imagevdelecroix ( 2017-03-10 09:34:23 +0200 )edit