Ask Your Question

Are there options for interactive/dynamic content?

asked 2012-05-29 10:59:39 -0600

ooglyboogly gravatar image

updated 2012-05-30 01:41:24 -0600

I'm starting to switch over to sage from mathematica, and so far the biggest thing I'm missing is the ability to make interactive applets. I managed to get mplh5canvas up and running. While it's a nice start, It's far from the sort of thing I can do with mathematica.

In mathematica, one can make an interactive sin graph with something like (I forget if the dynamic tag goes with the a or the plot[]):


And of course it's even easier with Manipulate[].

How far is Sage from this sort of functionality? I think this sort of thing is immensely helpful to students who just want to explore a function.

If I learn how to effectively use the HTML 5 canvas and javascript, are dynamic plots within reach?

EDIT: Thanks a lot! Interact seems to be what I was looking for.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2012-05-29 12:03:51 -0600

Eviatar Bach gravatar image

updated 2012-05-29 12:05:06 -0600

Yes, there is a way to do this, with interact.

For your example, the equivalent in Sage would be (this goes in a notebook cell):

def interact_sin(a=slider(0, 5)):
    plot(a * sin(x), -10, 10).show()
edit flag offensive delete link more



plot(a * sin(x), -10, 10,ymin=-5,ymax=5).show() looks better.

Shashank gravatar imageShashank ( 2012-05-29 12:07:14 -0600 )edit

Yeah, but I wanted to make it the same as the poster's example.

Eviatar Bach gravatar imageEviatar Bach ( 2012-05-29 12:14:28 -0600 )edit

Yes I understand. My comment was for the OP.

Shashank gravatar imageShashank ( 2012-05-29 15:41:52 -0600 )edit

answered 2012-05-29 11:27:26 -0600

Shashank gravatar image

There are a few examples on the website. Have a look at the following links

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-05-29 10:59:39 -0600

Seen: 356 times

Last updated: May 30 '12