On Sat, Mar 14, 2009 at 10:29 AM, Carl Witty <carl.wi...@gmail.com> wrote: > > As discussed at > http://groups.google.com/group/sage-devel/browse_thread/thread/b1a03f8fc8ae8fcd/553773d7ba600ae7#553773d7ba600ae7 > , I'm writing a patch to deprecate calling symbolic expressions > without variable names. > > In the course of writing the patch, and subsequent discussions with > Jason and Burcin, some issues have come up; I just wanted to report on > what we've decided and give people a chance to object. > > 1) Piecewise functions: > With my initial patch, > sage: f = Piecewise([[(-1,1),1/2+x-x^3]]) > doesn't work (that is, you get deprecation errors when you call f); > Burcin suggested an optional variable argument to Piecewise, so you > could type this instead: > sage: f = Piecewise([[(-1,1),1/2+x-x^3]], x)
This seems reasonable, maybe. Also sage: f(x) = Piecewise([[(-1,1),1/2+x-x^3]]) should work. Also "Piecewise" suggests "piecewise *function*" so maybe they *have* to be a function? It's not a peicewise symbolic expression! > > 2) plotting > A lot of the plotting code is willing to pick variable names (in > alphabetical order) if names aren't given in the plot ranges. > For instance, this is a doctest in plot.py: > sage: f = sin(x^2 + y^2)*cos(x)*sin(y) > sage: c = contour_plot(f, (-4, 4), (-4, 4), plot_points=100) > This will be deprecated, but any of the following will work: -1 I'm strongly against deprecating anything like this for plotting, since there are clear labeled axes in the plot. > sage: c = contour_plot(f, (x, -4, 4), (y, -4, 4), plot_points=100) > sage: c = contour_plot(f.function(x, y), (-4, 4), (-4, 4), plot_points=100) > sage: c = contour_plot(lambda x,y: f(x=x,y=y), (-4, 4), (-4, 4), > plot_points=100) > > 3) plotting single-variable expressions > As a special exception to the above rule, plots that want a > single-argument function will also accept a single-variable > expression; the following code will continue to work: > sage: plot(sin(x), (-3, 3)) > As far as I know, this will be the only place in all of Sage where a > symbolic expression is automatically promoted to a function without > the user specifying a variable name (without a deprecation warning). +1 > > 4) fast_float > The fast_float code assigns variable names in alphabetical order if > the variable names are not explicitly given. This will be deprecated. +1 -- it's _fast_float_ anyways, so mainly for internal use. > > Carl > > > > -- 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 -~----------~----~----~----~------~----~------~--~---