On Tue, 05 Dec 2006 08:56:22 -0800, Joel B. Mohler  
<[EMAIL PROTECTED]> wrote:
> William, thanks for your kind hint for me to be quiet a bit.  I believe  
> you are
> right that I should be so.  After this e-mail and a few additions to the  
> wiki, I
> will be quiet on this topic.

No, don't be quiet!!

> However, I don't agree that the suggestion of using variables from the
> polynomial ring is doing what mathematica does.  Some Examples:
>
> Exhibit 1: My understanding is that you want f(1) to be 1 in sage, but
> mathematica is not so.
> In[1]:= f=x
> Out[1]= x
> In[2]:= f(1)
> Out[2]= x
>
> Exhibit 2:  Mathematica has a dummy variable.
> In[12]:= f[x_]:=Sin[x]
> In[13]:= f'[x]
> Out[13]= Cos[x]
> In[14]:= f'[y]
> Out[14]= Cos[y]
>
> Exhibit 3: Part of the expected second variable is the name of the  
> independent
> variable.
> In[6]:= Plot[Sin[x]]
> Plot::argmu: Plot called with 1 argument; 2 or more arguments are  
> expected.

I was also confused about this.

Maple and Mathematica have symbolic expressions, like Sin[x] * Cos[y],
(or sin(x)*cos(y)), which you *can not* evalaute in those systems!
You can only do a variant of "substitution".  This is what we should
do too, and doesn't require the preprocessor.  In order to define
a function to be evaluated, one should just use Python's def or lambda.

Example in Maple:

auth2-213:~/s/spkg/standard was$ maple
     |\^/|     Maple 10 (APPLE PPC OSX)
._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc.  
2005
  \  MAPLE  /  All rights reserved. Maple is a trademark of
  <____ ____>  Waterloo Maple Inc.
       |       Type ? for help.
> f = sin(x);
                                                          f = sin(x)
> f(2);
                                                             f(2)

> f;
                                                              f

> f := sin(x);
                                                         f := sin(x)

> f;
                                                            sin(x)

> integrate(f, x);
                                                           -cos(x)

> f(2);
                                                          sin(x)(2)

> subs(x=2,f);
                                                            sin(2)

Example in Mathematica:

auth2-213:~/s/spkg/standard was$ math
Mathematica 5.2 for Mac OS X
Copyright 1988-2005 Wolfram Research, Inc.
  -- Terminal graphics initialized --

In[1]:= f := Sin[x];

In[2]:= f[2];

In[3]:= f[2]

Out[3]= Sin[x][2]

In[4]:= Integrate[f, x];

In[5]:= Integrate[f,x]

Out[5]= -Cos[x]

OK, I forget how to subst in mathematica, but I have to go now.

Also, PARI has this same distinction too.

? f = x*y
%2 = y*x
? f(2,3)
   ***   unused characters: f(2,3)
                             ^-----
? subst(f,x,2)
%3
  = 2*y

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

Reply via email to