On Sun, Sep 27, 2009 at 3:43 AM, Maurizio <maurizio.gran...@gmail.com> wrote:
>
> Hi all,
> let me catch this notebook refactoring to ask for something that just
> came to my mind.
>
> Let's assume you have any kind of design or analysis process flow, one
> great thing I'd like to have is the chance to define some input
> variables to be equal to a value that, whenever is updated, all the
> following calculations involving that same input variable are
> repeated.
>
> I'll try to explain better with a concrete example. At the beginning
> of the worksheet I could write in a cell something like:
>
> a,b = live_input([RR, CC])
>
> and I get two input boxes like :
>
> a = [input box]
> b = [input box]
>
> These two variables, a and b, have a defined type (specified as
> argument of that "live_input" function), and a special attribute
> "live" (or whatever else you like), implying that the following cells
> have to be re-evaluated whenever the values of a and b are updated IF
> they (the cells) contain calculations anyhow referred to a or b.

I'm pretty sure it is impossible to decide whether a cells output depends on the
value of a given variable.  You could get it write some of the time by seeing
if the variable appears, but given the dynamic nature of Python it is
impossible to
decide in general.

That said, if you were allowed to tag a cell as depending, then this is easy to
implement.  I've even made an implementation of this in the current notebook:

http://sagenb.org/home/pub/905/

If you try that and evaluate all the cells in order, then you'll see
that changing a and b
causes all the other dependent cells to update.  You can add
non-dependent cells and
they won't update.  Obviously the above is a bit cumbersome, but could
be made smoother
if it gets at what you're after.

William

>
> So, three cells later I have:
>
> c = a + b; c
>
> And whenever I update a or b, the evaluation of that cell is repeated
> and c gets updated accordingly. This also implies that c inherits the
> "live" attribute, so that any subsequent calculation involving "c" in
> the following cells is updated (re-evaluated) as well.
>
> In this way, you can imagine any kind of flow, whose input can be
> specified at the beginning of the worksheet, and you can immediately
> see the effects of changing some inputs, by just updating those boxes,
> and without having to manually evaluate the right cells. I think this
> is a piece of automation that should be pretty easily handable by the
> computer, and that could greatly improve the user experience.
>
> This kind of behaviour is the default in MathCad, which is very useful
> for this kind of flows. In that case, they have two ways of defining
> inputs: local definition, which affects only the subsequent
> calculations, and global definition, which affects all the
> calculations of the worksheet (also the one that comes before the
> global variable definition).
>
> I'll be glad to see your comments, I hope you can catch the usefulness
> of this (if any) :P
>
> Thanks, and regards
>
> Maurizio
>
> PS: feel free to ask me for many more insights, if I've not been clear
> enough
> >
>



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

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to