Ask Your Question
1

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

asked 2016-06-16 07:44:07 -0500

danny gravatar image

updated 2016-06-16 13:19:32 -0500

tmonteil gravatar image
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 flag offensive close merge delete

Comments

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

John Palmieri gravatar imageJohn Palmieri ( 2016-06-16 11:44:37 -0500 )edit

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

tmonteil gravatar imagetmonteil ( 2016-06-16 13:18:44 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-06-16 13:17:46 -0500

tmonteil gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-06-16 07:44:07 -0500

Seen: 481 times

Last updated: Jun 16 '16