# Plots: display period information

Disclaimer: I'm new to Sage.

Is it possible to indicate the period when plotting periodic functions?

According to my trig book, for example, "you have a graph that has four complete cycles of the sine curve in the space where you would usually find one", as shown here:

f(x)=-2*sin(4*(x+pi/4))+3
plot(f(x),(x,-2*pi,2*pi))


Is there a way to indicate each period? If not, could I approximate it with ticks? Something like:

f(x)=-2*sin(4*(x+pi/4))
P=points([(pi,0),(2*pi,0)], pointsize=40, color='red')
P+plot(f(x),(x,-2*pi,2*pi), ticks=pi/2, tick_formatter=pi)

edit retag close merge delete

I'm not sure what about your solution isn't what you want. You can specify arbitrary ticks and the format you chose is correct... maybe I'm not sure exactly what you mean by "indicate the period".

Sort by » oldest newest most voted You can create a list of points indicating the periods. (I use list comprehension. )

f(x)=-2*sin(4*(x+pi/4))
P=points([(k*pi/2,0) for k in [-4..4]], pointsize=40, color='red')
P+plot(f(x),(x,-2*pi,2*pi), ticks=pi/2, tick_formatter=pi)

more

1

Perfect! It didn't occur to me to use a list comprehension.