http://wiki.sagemath.org/interact

2 views
Skip to first unread message

Nick Alexander

unread,
Jun 8, 2009, 12:20:55 PM6/8/09
to sage-devel
Many of you know that I am, let's say, committed to emacs, and
certainly not a big fan of the notebook. However... it does do at
least one thing really well, and that is @interact.

I am writing code to numerically compute period matrices for Riemann
surfaces, and the first step includes a little of graph theory in the
plane: one wants to determine paths around specified branch points
with nice properties. So, of course, I started working up the
routines and using interact to view the outputs.

Unfortunately, it's not exactly a great experience, the actual
developing of interact code. (In fact, I went back to emacs and
static graphs.) But http://wiki.sagemath.org/interact is really,
really cool. So cool, in fact, that I think the sage community needs
to work harder to make this feature even more awesome.

Can we open the floor for some discussion of this feature? Here are
some things I want:

* I want to be able to "pop out" or "anchor" an interact and have it
update a div that's permanently glued to the right side of my browser,
floating to be always visible. I'm no web design guru and even I know
that this is not difficult. The motivation is that I have hundreds of
lines of code computing the relevant bits of the interact, and I have
to keep scrolling around to find the new picture. This would let me
anchor the output and edit more sanely.

(In fact, there's nothing special about an interact cell for this:
almost always, I have one "doit" cell at the bottom that I want to run
after edits, and I could anchor that cell for ease of use.)

* I want to be able to compose interacts. That is, I'd like to
build a library of interacts: one that allows me to specify an input
graph using that neat javascript graph editor (this is good for points
in the plane and for paths in the plane), one that allows me to
specify a function, a nice "range slider with variable endpoints and
steps" (notice how often that comes up in wiki/interact?), etc. Then
I can just glue the inputs together.

* I want these amazing interact examples to be included in the sage
library, as incredibly cool building blocks for future interacts.

* I want the wiki page to be truly interactive, i.e. to link to
sagenb. This stuff is just way too cool to be static.

To all the people who have contributed to the wiki/interact: bravo.
Next time I need to impart a little calculus wisdom, I'll be there.

Nick

Jason Grout

unread,
Jun 8, 2009, 2:04:19 PM6/8/09
to sage-...@googlegroups.com
Nick Alexander wrote:
> Many of you know that I am, let's say, committed to emacs, and
> certainly not a big fan of the notebook. However... it does do at
> least one thing really well, and that is @interact.


At first, I thought you were announcing interacts for your emacs mode!

These are some good suggestions.


>
> I am writing code to numerically compute period matrices for Riemann
> surfaces, and the first step includes a little of graph theory in the
> plane: one wants to determine paths around specified branch points
> with nice properties. So, of course, I started working up the
> routines and using interact to view the outputs.
>
> Unfortunately, it's not exactly a great experience, the actual
> developing of interact code. (In fact, I went back to emacs and
> static graphs.) But http://wiki.sagemath.org/interact is really,
> really cool. So cool, in fact, that I think the sage community needs
> to work harder to make this feature even more awesome.
>
> Can we open the floor for some discussion of this feature? Here are
> some things I want:
>
> * I want to be able to "pop out" or "anchor" an interact and have it
> update a div that's permanently glued to the right side of my browser,
> floating to be always visible. I'm no web design guru and even I know
> that this is not difficult. The motivation is that I have hundreds of
> lines of code computing the relevant bits of the interact, and I have
> to keep scrolling around to find the new picture. This would let me
> anchor the output and edit more sanely.

>
> (In fact, there's nothing special about an interact cell for this:
> almost always, I have one "doit" cell at the bottom that I want to run
> after edits, and I could anchor that cell for ease of use.)

We can anchor with CSS, I believe. I think anchoring a cell would be a
very simple piece of javascript code that changes the CSS of the cell.
Do people think this is a valuable feature?

>
> * I want to be able to compose interacts. That is, I'd like to
> build a library of interacts: one that allows me to specify an input
> graph using that neat javascript graph editor (this is good for points
> in the plane and for paths in the plane), one that allows me to
> specify a function, a nice "range slider with variable endpoints and
> steps" (notice how often that comes up in wiki/interact?), etc. Then
> I can just glue the inputs together.


Can you give an example piece of code and what you'd like it to do?

>
> * I want these amazing interact examples to be included in the sage
> library, as incredibly cool building blocks for future interacts.


+1. This would be a very cool section of the manual or
tutorial---selected @interact examples. Especially since you can edit
and run things in the docs!


>
> * I want the wiki page to be truly interactive, i.e. to link to
> sagenb. This stuff is just way too cool to be static.

+1. I can see links to public worksheets (just copy the current wiki
stuff into a worksheet, publish it, and edit the link in the wiki). If
someone volunteered to maintain the "official" version of each page...

This would also be cool if published sheets could have interactive
@interacts. It seems like Mike Hansen was working on this at one time
(and it also seems like that's a very common response to most "is it
implemented" questions---Mike has touched just about everything!)


Thanks for your input!

Jason


--
Jason Grout

Harald Schilly

unread,
Jun 8, 2009, 4:02:32 PM6/8/09
to sage-devel
On Jun 8, 6:20 pm, Nick Alexander <ncalexan...@gmail.com> wrote:
>   * I want these amazing interact examples to be included in the sage  
> library, as incredibly cool building blocks for future interacts.
>

i could think of something like
interact_plot(<function> | <value pairs for list plot> | ...)
that presents an interface, min to max value, color,
transformations, ... for plotting. of course, also for similar
applications.
interact_statistics(<matrix of values>)

h

Pat LeSmithe

unread,
Jun 18, 2009, 10:47:49 AM6/18/09
to sage-...@googlegroups.com
Nick Alexander wrote:
> * I want to be able to "pop out" or "anchor" an interact and have it

http://www.sagenb.org/home/pub/585/

The code is all client-side, so popping a cell evaluates it. It may be
best to delete all output before reloading.

Strangely, jQuery/UI duplicates the [shift-]click event handlers for a
popped cell's clickbar. We get two new cells for the price of one.
This may be a quirk of the extended click plug-in.

Nevertheless, with the indicated tweak to cell_delete_callback(), I
believe both server and client maintain consistent cell lists. (Apart
from some known TinyMCE issues...)

Corrections and comments are welcome. Improvements more so!

> * I want to be able to compose interacts. That is, I'd like to

I'm not very familiar with functional programming, categories, or much
else, but I think we're discussing an "interact" monad for Sage.

Potentially useful links:

http://en.wikipedia.org/wiki/Monad_(functional_programming)
http://en.wikipedia.org/wiki/Monad_(category_theory)

I also found this loose interpretation of jQuery as a monad (see comment
13):

http://importantshock.wordpress.com/2009/01/18/jquery-is-a-monad/

Perhaps some experts could lend their insight?

Reply all
Reply to author
Forward
0 new messages