Burcin Erocal wrote: > On Fri, 7 Nov 2008 01:14:26 -0800 (PST) > Simon King <[EMAIL PROTECTED]> wrote: > >> Dear Team, >> >> the impression that I got from this thread is the following: >> ------- >> Commutative: >> 1. If f is a *commutative* polynomial in x,y,z,..., then everybody >> would at least correctly guess that f(1,2,3,...) has the intended >> meaning "evalutation of f at x=1, y=2, z=3,..." >> 2. Some people would actually *expect* (not just accept) that this >> meaning is intended. >> >> => >> It is ok that multivariate polynomials in Sage are callable in the >> sense described above. Currently, symbolic variables commute with each >> other, and thus it is acceptable that they are callable as well. >> >> Hence, no need to change! >> Do we agree on this? > > I was already unhappy about symbolic expressions being callable, this > discussion convinced me that they shouldn't be. > > One thing we should not forget is that, polynomials and symbolic > expressions in Sage are different things. I really appreciate > polynomials being callable, and I don't see the need to differentiate > polynomial functions and polynomials. > > Note that for polynomials, it is clear what to do when it is called. > There is an ordered list of variables that will be substituted. We > don't need to guess what the user intends. > > Things are not so simple for symbolic expressions. I find the current > behavior confusing, and many people on sage-support seem to be confused > by the different ways of constructing functions in Sage. (i.e., > python function definition, f(x) = ... syntax, just use a symbolic > expression) > > I think the python function definition and f(x) = syntax are more than > enough, and we don't need to make symbolic expressions callable. > > The advantage of the f(x) syntax is that it gives a clear and ordered > list of variables to substitute for. One could say that this exists for > any symbolic expression, since we have an alphabetically ordered list of > variables, but then we have the following problem: > > sage: var('x,y,a,b') > (x, y, a, b) > sage: f = a*x + b*y > sage: f(3,5) > 5*y + 3*x > > If I was trying to second guess what the user intended, I would expect > a and b to be constants, and x and y to be replaced. This is just > impossible to get right. > > Keeping the "explicit is better than implicit" motto in mind, I think > this should change. This syntax is much better, IMHO. > > sage: f(x,y) = a*x + b*y > sage: f(3,5) > 5*b + 3*a > > And I think this should raise an error: > > sage: f(5) > b*y + 5*a >
I think it is very handy to be able to partially evaluate an expression. Do you propose a syntax that lets you effectively do f(5) and get a function back? For example, if I want to plot a level curve of f at x=5 presuming that f(x,y)=2*x+3*y, say. Here are some possibilities: plot( f(x=5), (y, -10,10)) plot( f(x=5,y=y), (y, -10,10)) plot( f(5,None), (y, -10,10)) plot( f(5,y), (y, -10,10)) g(y) = f(5,y) plot(g, (y, -10,10)) That last one seemed too verbose 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://www.sagemath.org -~----------~----~----~----~------~----~------~--~---