On 9/12/07, Robert Bradshaw <[EMAIL PROTECTED]> wrote:
> Letting x + sin == x + sin(x) was my way of justifying (x + sin)(5)
> == 5 + sin(5). I was thinking "sin" was a function of exactly one
> variable, it just doesn't know/have a name for that variable yet.

Personally, I think you're applying some of the very structured coercion
model thinking in this situation, which is I think the wrong approach
for symbol pushing and symbolic calculus.

> Perhaps this was a bad idea, but then it is unclear what (x+sin) is.
> For callable symbolic expressions I think it may be a bit clearer.

Currently it is the formal sum of a symbolic variable and an
unevaluated function.  This is meaningful in the world of
symbolic manipulation.

> sage: f(x) = x^2
> sage: f + sin
> x^2 + sin(x)  # because f.parent()(sin) = sin(x) ??

That's very reasonable and should be fixed:

sage: f(x) = x^2
sage: f + sin
x |--> sin(x) + x^2

Right now one gets the following, which is very lame (if you
agree, please add this to the trac ticket):

sage: f(x) = x^2
sage: f + sin
x |--> sin + x^2
sage: f(10)
100


> Also, what should (x+y+sin)(5) be? An error? 5+y+sin?

If

    ( x + sin)(5) is 5 + sin(5),

then the above should be 5 + y + sin(5).  The expression
x + y + sin is evaluated at 1 input, so since the variables
are (x,y), this is turned into (x+y+sin)(x=5).  Next, this
is evaluated term by term and the result is added.
    x(x=5) is 5
    y(x=5) is y
    sin (x=5) is sin(5), *if* we have the rule that calling
an unevaluated function with a named variable evaluates
the unevaluated function at the value of that variable.

>  What should
> sin.variables() return?

What it does now:

sage: sin.variables()
()

> I think it should be a tuple with one
> element, as it takes one argument...
> Or something special?

It has no variables right now, so why should it return any?  It's
an unevaluate function.

William

--~--~---------~--~----~------------~-------~--~----~
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://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to