Ask Your Question
0

Plots: display period information

asked 2015-07-10 22:32:46 +0100

mellow_yellow gravatar image

updated 2015-07-10 23:23:33 +0100

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

Comments

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

kcrisman gravatar imagekcrisman ( 2015-07-11 00:01:31 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-07-11 23:55:40 +0100

ndomes gravatar image

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)
edit flag offensive delete link more

Comments

1

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

mellow_yellow gravatar imagemellow_yellow ( 2015-07-13 18:04:20 +0100 )edit

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: 2015-07-10 22:32:46 +0100

Seen: 1,006 times

Last updated: Jul 11 '15