On Wed, 06 Dec 2006 13:24:00 -0800, alex clemesha <[EMAIL PROTECTED]>
wrote:
>> Again, I don't think these have to be competing notions. In mathematica
>> you
>> really can work entirely in either paradigm or mix and match.
>
I was confused, since there are (at least) three separate notions
of something like functions Mathematica:
1. A formal expression, e.g., y + Sin[Pi*x].
This can't be evaluated at a number, but one can use substitution,
and calculus, etc., with such functions.
In[32]:= f = Sin[x+y]
Out[32]= Sin[x + y]
In[33]:= f
Out[33]= Sin[x + y]
In[34]:= f /. {x -> 2, y -> 3}
Out[34]= Sin[5]
2. A Function of one more variables, e.g.,
f=Function[{x, y},Sin[x + y]]
These can be evaluated, and in many cases one can also do
calculus with them. It is explicit in defining the function
what the input variables are, and in what order.
In[29]:= f=Function[{x, y},Sin[x + y]]
Out[29]= Function[{x, y}, Sin[x + y]]
In[30]:= f
Out[30]= Function[{x, y}, Sin[x + y]]
In[31]:= f[2,3]
Out[31]= Sin[5]
3. A substitution rule (?), which I guess doesn't have
any analogue in Python. I was confused before and didn't know
about 2 (above) and thought 3 was the only way to define a function.
Calculus rules don't make sense for these, but they can be evaluated.
In[36]:= z[x_, y_] := Sin[x+y]
In[37]:= z[2,3]
Out[37]= Sin[5]
----
My impression is that we should implement analogues of (1) and (2)
for SAGE. I'm not sure if (3) has any place. I think the proposal
of Robert and Joel is compatible with (2), but I think (1) is
also very important (and one needs (2) in order to implement (1)
anyways).
----
> If we can actually achieve a lambda function that you can do calculus
> with, thatwould be idea. I have no idea how you would go about doing
> that though. Didyou have implementation details in mind?
There way to define
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
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/
-~----------~----~----~----~------~----~------~--~---