proposal for "interactive data input" functionality in notebook

1 view
Skip to first unread message

Jurgis Pralgauskis

unread,
Apr 4, 2008, 7:43:30 AM4/4/08
to sage-devel, sage...@googlegroups.com
Hello,

the idea was inspired by @interact
but sometimes I'd need input box (or text area) not only for one
block, but for the rest of worksheet
the idea came when experimenting wiht matrixes (as their input is not
comfortable):
- textarea, where I can enter rows separated with spaces would be superb
- there could be a rows x cols table with input boxes (with indexes)
inside each cell

"input" stuff would be convenient for first time users to experiment
lets say, if they could choose the function (or data file) from a listbox
and then see the steps (blocks) of analysis (and can experiment with
some blocks if they want)

if "input" is combined with auto recalculate (and optionally can hide
intermediate blocks, just show the (last) output),
then converting existing worksheet to interact functionality would be a breeze

"input" could also do some parsing and validation.
I guess "input" definition blocks should be autonomous (not mixed with
other code), so that it would be clear at what code position we
already have the values

probably the syntax could be just the same as in @interact
just at least add new inputtype for textarea

well, I can use usual (python) blocks to input data -- that seems not
a big problem (but this is inconvenient (especially in matrix case))
I also know http://sagemath.blogspot.com/2008/02/mathematics-research-education-and-sage.html

is there some sage-edu wishlist on http://sagetrac.org/sage_trac or somewhere?

and for the sake of interest:
what (modules) should be considered to hack to implement "input" functionality

Best Regards

ps.: by the way -- one more idea could be also implemented with
interact (as wims is based on pari, as I know)
http://wims.unice.fr/wims/wims.cgi?module=tool%2Fanalysis%2Ffunction.en

--
Jurgis Pralgauskis
omni: 8-616 77613; teledema: 8-657 65656;
jabber: jur...@akl.lt; skype: dz0rdzas;
Don't worry, be happy and make things better ;)

William Stein

unread,
Apr 4, 2008, 11:30:53 AM4/4/08
to sage-...@googlegroups.com

I think interact is just as useful in research as in education. So
far I've used it
several times in research; and, several times in education. It's
great for both.

The functionality you request above with textareas is something I definitely
anticipated somebody else adding after the first version of interact. Good!
The same with the spreadsheet-style input for matrices, which I would
really like to see. Does anybody know of any good examples of javascript
that inputs a spreadsheet or matrix of values?!

>
> and for the sake of interest:
> what (modules) should be considered to hack to implement "input" functionality

To implement both functions you describe above you would probably only
have to edit the file

SAGE_ROOT/devel/sage/sage/server/notebook/interact.py

This definitely won't be trivial, but fortunately that file has lots of
documentation. You could probably get away with just modifying
the input_box and InputBox classes to have an extra options that
allows for a given number of rows and columns. Also, you might
need some clever javascript or a submit button or something,
to know when to submit the multiline input textarea.

For the spreadsheet, it would depend if it uses much javascript
or not. If it does, do something like the slider (and Slider) classes.
If not, it will be more like InputBox.

Happy coding!

>
> Best Regards
>
> ps.: by the way -- one more idea could be also implemented with
> interact (as wims is based on pari, as I know)
> http://wims.unice.fr/wims/wims.cgi?module=tool%2Fanalysis%2Ffunction.en
>
> --
> Jurgis Pralgauskis
> omni: 8-616 77613; teledema: 8-657 65656;
> jabber: jur...@akl.lt; skype: dz0rdzas;
> Don't worry, be happy and make things better ;)
>
> >
>

--
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

dean moore

unread,
Apr 4, 2008, 12:54:35 PM4/4/08
to sage-...@googlegroups.com
On Fri, Apr 4, 2008 at 9:30 AM, William Stein <wst...@gmail.com> wrote:

The functionality you request above with textareas is something I definitely
anticipated somebody else adding after the first version of interact. Good!
The same with the spreadsheet-style input for matrices, which I would
really like to see.  Does anybody know of any good examples of javascript
that inputs a spreadsheet or matrix of values?!

Aware that open-source software is all over the 'Net, I did a quick
search & found an open-source (GNU GPLv2 License) spreadsheet, in
JavaScript, HTML, CSS & PHP, at this link.  Played around with the
demo, entered a 2 x 2 system and did a few simple calculations. 

It admits, "not very user friendly as it's in very early stages" -- though
in six languages is nice.

Doubtless there are gobs of others out there -- that was only a quick search & I'm
not saying it's the be-all & end-all.

Dean

Reply all
Reply to author
Forward
0 new messages