On Sat, 14 Mar 2009 14:10:32 -0500
Jason Grout <jason-s...@creativetrax.com> wrote:

> 
> Burcin Erocal wrote:
> > On Sat, 14 Mar 2009 11:45:13 -0700
> > William Stein <wst...@gmail.com> wrote:
> > 
> 
> > It is a similar situation for the plot commands. Many people have
> > complained about the inconsistencies in Sage's plotting interface.
> > 
> > Looking at MMA's plot commands, only this syntax is accepted:
> > 
> > Plot[Sin[x], {x, 0, Pi}]
> > 
> > Note the explicit variable name.
> > 
> > I think we should try to make the syntax uniform for all the plot
> > functions, and ask the user to specify the variable in every case.
> > (This means deprecating the xmin/xmax parameters of the plot
> > function as well.)
> 
> Specifying a variable in every case doesn't work for us.  If f is a 
> python function, or a "function" (in that it has a specified order of 
> variables), it makes it so that we still need to support (-2,2)
> syntax.


With a little python magic, we can work around this.

sage: def f(x,y):
....:     return x + x*y
....: 
sage: f.func_code.co_argcount
2
sage: f.func_code.co_varnames
('x', 'y')


We could write a wrapper that takes a python function, and returns
another one that takes keyword arguments. Then the plotting code would
use this wrapper as a preprocessor before doing anything with python
functions.

Cheers,
Burcin

--~--~---------~--~----~------------~-------~--~----~
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