#1613 closed enhancement (duplicate)
interactive manipulation of variables using AJAX in notebook
Reported by: | schilly | Owned by: | boothby |
---|---|---|---|
Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
Component: | notebook | Keywords: | |
Cc: | jason-sage@… | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | Work issues: | ||
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
Like the "Manipulate" function in Mathematica, SAGE could include a similar feature using AJAX.
The idea is, to introduce a widget (slider, drop down, boolean button, list of option-buttons,...) that changes the value of a variable interactively. is a new value set, the cell is evaluated and the new result is shown.
my idea for the syntax: every time the input field has a manipulate function, a variable assignment is done before the expression is evaluated.
example: manipulate(plot(sin(n*x),x),{'n':range(-3,3)})
where n is chosen from the range of integers between -3 and 3. (syntax is only an example, could be better, but an associative array seems applicable. (just manipulate(expr, var, range, var2, range) should work, too)
the manipulate should also work appended: expression.manipulate(var,range,...)
the server sends suitable html code back, which could consist of a lightweight horizontal slider for each variable, which does appropriate rounding to integers (or smaller/larger intervals) and everytime a mouse-up event is issued, the cell is reevaluated with the new variable assignment.
note: mathematica goes a step further using dynamic elements, which update throughout the entire notebook after a new assignment is done. this is more complicated, since there must be a mechanism to register a cell in a client/observer manner. this could be addressed later... (and of course, issues of looping...)
Change History (5)
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
thx for pointing out #1322 ... i was unaware of it. My idea is similar, but much more general. When I have time and understand how sage works I'll try to do a patch, too, but this won't be very soon ;)
comment:3 Changed 14 years ago by
- Cc jason-sage@… added
Possible implementation notes:
We probably want to have the code that we plan to reevaluate in quotes so that we can just eval it and it isn't evaluated when it is passed to the function, i.e., manipulate("plot(sin(n*x),x)",{'n':range(-3,3)}).
When the code is evaluated, it creates a slider and a separate output area.
When the slider is moved, the following code is executed:
n=<NEW SLIDER VALUE> plot(sin(n*x),x)
and the output is put into the separate output area.
comment:4 Changed 14 years ago by
- Resolution set to duplicate
- Status changed from new to closed
comment:5 Changed 14 years ago by
- Milestone changed from sage-wishlist to sage-duplicate/invalid
See #1322 for an alpha patch which together a very shaky implementation of this. Is this writeup an expanded version of #1322?