frac is negative when argument is less than zero
Hello,
I tried plotting the frac function on sagecell and it behaves as expected where frac(x) = x-floor(x). I.E. frac is positive even when its argument is negative.
However on my local installation, plotting frac (plot(frac,-2,2)) outputs the same thing as plot(sign(x)*frac(abs(x)),-2,2).
I'm on debian 12 and sage version 9.5.
I'm a little reluctant to do that just yet because my version is closing in on three years old.
You can try the current version at https://sagecell.sagemath.org/
It works for me with the latest version of Sage (the two functions you provide have different plots, and
frac
is never negative), so you should upgrade.In Sage 10.7beta4 I see:
@MaxAlekseyev: the question was about plotting, not about this particular evaluation of the
frac
function. Sage does not seem to behave consistently.