Ask Your Question
1

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

asked 8 years ago

danny gravatar image

updated 2 years ago

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]
Preview: (hide)

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 ( 8 years ago )

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

tmonteil gravatar imagetmonteil ( 8 years ago )

1 Answer

Sort by » oldest newest most voted
1

answered 8 years ago

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.

Preview: (hide)
link

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: 8 years ago

Seen: 1,110 times

Last updated: Jun 16 '16