Thanks for the explanation.
I definitely don't like this shortcut:

sage: var('foo bar')
(foo, bar)
sage: E = foo+bar
sage: E(5)
foo + 5

why not "bar +5" ?

but I'll learn to live with it :)

        Yann

On Feb 26, 11:42 pm, Carl Witty <carl.wi...@gmail.com> wrote:
> On Thu, Feb 26, 2009 at 2:35 PM, Robert Bradshaw
>
>
>
> <rober...@math.washington.edu> wrote:
>
> > On Feb 26, 2009, at 2:28 PM, YannLC wrote:
>
> >> Forgive my stubborness, but you answered only half of my question :)
> >> do you think the following  is a sane behavior?
>
> >> sage: var('f x')
> >> (f, x)
> >> sage: f(x+3)
> >> x+3
>
> >> I would prefer a NotImplementedError...
>
> > This has come up many times, and it's unclear exactly what the best
> > behavior should be. What about
>
> > sage: var('x')
> > sage: f = x
> > sage: f(3)
> > 3
>
> To add a little more detail here: I'm not sure you're understanding
> what's going on in your example.
>
> Consider this:
> sage: E = (x+3)*sin(x)
> sage: E(5)
> 8*sin(5)
> sage: E.subs(x=5)
> 8*sin(5)
>
> So E(5) is treated as a shorthand for E.subs(x=5).
>
> Now if we consider:
> sage: var('f x')
> (f, x)
> sage: f(x+3)
> x + 3
> sage: f.subs(f=x+3)
> x + 3
>
> it's the exact same thing.
>
> This causes trouble in other situations, as well; if you wanted
> multiplication, but you left off the '*' symbol:
> sage: x(x+1)
> x + 1
> sage: x.subs(x=x+1)
> x + 1
>
> I've argued before that this shorthand should be removed because it's
> too confusing, but I haven't managed to convince enough people, so
> it's still there.  (The shorthand isn't there in the new, Pynac-based
> symbolics, so when we switch over to that system, this particular
> source of confusion will be gone.)
>
> Carl
--~--~---------~--~----~------------~-------~--~----~
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