Am I plotting this function incorrectly?

asked 2021-07-12 18:40:04 +0100

periksson gravatar image

updated 2021-07-12 19:16:29 +0100

FrédéricC gravatar image

Hi everyone,

Glad to getting started using Sage aspart of my uni course.

I have this function that I am plotting, but I am getting a wierd output with a specific range.

This gives reasonable output:

p = (x^3-7*x+2)/(cos(x)-1)
plot(p, (-5, -0.1))

But changing the range looks weird:

p = (x^3-7*x+2)/(cos(x)-1)
plot(p, (-5, 0))

I am doing this on SageCell. Is it Sage having issues plotting the above or me setting range/scale incorrectly?

Thanks a lot,

Per

edit retag flag offensive close merge delete

Comments

1

Well, the value at 0 is -oo. You can truncate using p.plot(ymax=20,ymin=-20).

FrédéricC gravatar imageFrédéricC ( 2021-07-12 20:08:33 +0100 )edit

Thanks @fredericc, it solved my issue. It's just that, when comparing the graphs they don't seem to be the same function. Does plot() maybe set the scale automatically (to eg "loglog")?

periksson gravatar imageperiksson ( 2021-07-12 20:53:40 +0100 )edit