David Harvey wrote:
> 
> On Nov 17, 2007, at 7:41 PM, William Stein wrote:
> 
>> I'm pretty excited about this!  I think it would be extremely  
>> amazingly
>> useful if you could make up some more examples like this one
>>
>> sage: a = Slider(1,10)
>> sage: plot(sin(a()*x),-3,3)
> 
> Why not just
> 
>> plot(sin(a*x),-3,3)
> 
> instead of
> 
>> plot(sin(a()*x),-3,3)


Your first example is what I was originally thinking.  It would be 
simpler.  I wasn't sure how it would work to have a slider object 
multiplied by something, etc.  I figured in the end that rather than 
rewrite all the multiplication, addition, subtraction, etc., it'd be 
easier to have the __call__ method in "a" return whatever the current 
value of "a" was, and then let Sage take care of how to use that value 
in the expression.

Can we have "a" be a Slider object and have a*something (or a+something, 
etc.) make sense without rewriting a bunch of code to have operations 
work with Widget objects?

Can we just attach a "widget" property to any object in Sage?  That way 
"a" could be, say, a number, but it would have a "a.widget" which would 
encapsulate the necessary widget functionality?  I think this would be 
much more complicated.

-Jason


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to