In Sage 7.2, your example produces an error:

NameError: global name 'f' is not defined



On Sunday, May 29, 2016 at 10:48:29 AM UTC-7, William wrote:
>
> On Sat, May 28, 2016 at 9:48 AM,  <[email protected] <javascript:>> 
> wrote: 
> > Hello everyone, still new to Sage.  followed the pre_tutorials and 
> online 
> > ingteract wiki examples. 
> > 
> > question: 
> > 
> > the  code like bellow.  given the relationship between V and P is 
> V=P+107, 
> > and two input_box  are defined. 
> > 
> > @interact 
> > 
> > def _(P=input_box(20, width=6, label="power(dBm)"),V=input_box(127, 
> width=6, 
> > label="voltage(dBuV)")): 
> >     V=P+107 
> > 
> > 
> > want to know is it possible to realize when I input the new number to 
> the 
> > input_box of P, the input_box of V will dynamically update the value 
> base on 
> > the relationship of V=P+107.  and the vice versa. 
> > 
> > thanks in advance. 
>
> A few years ago I rewrote interacts for Sage worksheets at 
> SageMathCloud (https://cloud.sagemath.com), and they have the 
> functionality you're asking about, e.g.,: 
>
> @interact 
> def f(P=input_box(20, width=15, label="power(dBm)"),V=input_box(127, 
> width=15, label="voltage(dBuV)")): 
>     print "before update, V = ", V 
>     f.V = P+107 
>
> Click here to see (but you have to make a copy in your own project): 
>
>   
> https://104.154.250.163/projects/4a5f0542-5873-4eed-a85c-a18c706e8bcd/files/support/2016-05-29-interact.sagews
>  
>
> I don't know if anybody else's interact work covers this case. 
>
> William 
>
>
>
> > 
> > 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "sage-support" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to [email protected] <javascript:>. 
> > To post to this group, send email to [email protected] 
> <javascript:>. 
> > Visit this group at https://groups.google.com/group/sage-support. 
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> William (http://wstein.org) 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to