On Nov 6, 2008, at 4:56 PM, Robert Dodier wrote:

> On Nov 5, 10:10 pm, Nick Alexander <[EMAIL PROTECTED]> wrote:
>
>> I find this bizarre.  I am absolutely certain that I want to view $f$
>> as a polynomial in one variable and evaluate it at 10.
>
> That's nice. I wouldn't want to stand in your way.
> What is worrisome here is that you are all too ready to
> rule out alternatives, which, as pointed out elsewhere in
> this thread, are not nearly as bizarre as you say.
> It's rather unmathematical, frankly, to insist that you know
> the one true interpretation of an ambiguous expression.

I think settling on a good, consistent, default behavior is fine,  
especially if it's what most people "expect." I do consider it a bug  
if these kind of interpretations were impossible to make explicitly.

sage: f(x) = x^3+1
sage: f+1                 # perfectly natural
x |--> x^3 + 2
sage: f^3                  # should this be f(f(f(x))) or consistent  
with the above?
x |--> (x^3 + 1)^3

Of course, Python functions don't behave this way (do any languages)  
so maybe that's not too bad:

sage: f = lambda x: x^3+1
sage: f^3
Traceback (most recent call last)
...
TypeError: unsupported operand type(s) for ** or pow(): 'function'  
and 'int'

>> I can think of lots of alternate ideas (evaluate everything to
>> bottom!) but I believe none of them are common.
>
> All of the alternatives I suggested are pedestrian.
> I'm too ignorant to suggest anything exotic.
>
> The larger issue is that callable symbolic expressions are a
> convenience hack; since they are starting fresh, Sage
> developers can and should steer away from them.
> I say this after encountering various convenience hacks
> in Maxima, which, lo, these many decades on, are
> very hard to banish.

Some acceptance of "convenience hacks" are necessary to make a  
useable system. The whole coercion model is one such example  
(pedantically, it's wrong to do, for instance, arithmetic between  
elements belonging to different objects, but having to explicitly  
specify maps is to cumbersome (and error-prone) to consider, and it  
can be done in a consistent enough way to not cause mathematical  
correctness issues).

We didn't start out with callable symbolic expressions, one always  
had to turn them into functions first (or name variables explicitly  
via keyword arguments). This caused much more confusion (and  
inconvenience) than

sage: f = x^3-1
sage: f(10)
999

where at least everyone understands what's happening (even if they're  
not happy about it). There's also things like

plot(x^3-1, -2, 2)
integrate(x^3-1, -2, 2)

which, though no independent variable is specified, have (in my mind)  
very obvious intent. Making all other objects (e.g. polynomials,  
power series, etc.) have callable and non-callable counterparts would  
be an implementation headache as well.

> FWIW
>
> Robert Dodier


I just realized yours was the other email on this thread that I just  
responded to :). Don't take it as a personal argument, it's just that  
of all the emails in this thread you brought up the most interesting  
points to respond to.

- Robert


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

Reply via email to