# A bug in function sine about symbolic computation in Sagemath 7.2?

sage: n=7
sage: [RR(sin(i)) for i in [0,pi/n,..,2*pi]]
[0.000000000000000,
0.433883739117558,
0.781831482468030,
0.974927912181824,
0.974927912181824,
0.781831482468030,
0.433883739117558,
0.000000000000000,
0.433883739117558,
0.781831482468030,
0.974927912181824,
0.974927912181824,
0.781831482468030,
0.433883739117558,
0.000000000000000]
sage: [sin(RR(i)) for i in [0,pi/n,..,2*pi]]
[0.000000000000000,
0.433883739117558,
0.781831482468030,
0.974927912181824,
0.974927912181824,
0.781831482468030,
0.433883739117558,
1.22464679914735e-16,
-0.433883739117558,
-0.781831482468030,
-0.974927912181824,
-0.974927912181824,
-0.781831482468030,
-0.433883739117558,
-2.44929359829471e-16]

edit retag close merge delete

Why do you think this is a bug? RR has 53 bits of precision, and 1.22e-16 is sufficiently close to zero. More precisely, RR(pi) is not exactly equal to pi, so sin(RR(pi)) is not exactly equal to zero. Same with sin(RR(2*pi)).

( 2016-06-16 18:44:37 +0200 )edit

I guess the reported issue is about wrong signs in the symbolic version, not about numerical approximation.

( 2016-06-16 20:18:44 +0200 )edit

Sort by ยป oldest newest most voted

Thanks for reporting, it is a known issue, and should be fixed in the next major version, see trac ticket 20752, to be merged in 7.3.beta5.

more