On Sun, Mar 29, 2009 at 4:13 PM, Rob Beezer <goo...@beezer.cotse.net> wrote:
>
> On Mar 29, 12:29 pm, William Stein <wst...@gmail.com> wrote:
>> No, it will never ever relieve one of the burden of issuing a var
>> beforehand, since the Python parser can't understand the input
>> expression if the var hasn't been declared.
>
> So, I don't know much about how the preparser and variables all work,
> but the following snippet
>
> sage: preparse( 'f(y)=sin(y)' )
> '_ = var("y"); f = symbolic_expression(sin(y)).function(y)'
>
> lead me to think that if diff() and integrate() were to *always*
> require specifying the relevant variable, and the expression only
> contained that variable, then maybe the preparser could do something
> similar and the operation could carry on from there.
>
> So is the following *hypothetical* behavior not possible (or not
> desirable)?
>
> sage: preparse(  'differentiate(y^3, y)' )
> '_ = var("y"); differentiate(y**Integer(3), y)'
>
> If such a thing were indeed possible, I think it would make simple
> uses of Sage for calculus a whole lot easier for students.
>
> Rob

It's possible in theory, but not desirable.  I can think of two
reasons right off:

(1) A big difference between

  diff(y^3, y)

and

 f(y) = y^3

is that the first is valid Python syntax, but the second is not.

(2) If I write

sage: d = differentiate

would your preparser thing be invoked when I type

sage: d(y^3, y)

If yes, then where do you draw the line?  If no, then won't this lead
to lots of additional confusion?

>
>
>
> >
>



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

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

Reply via email to