On Aug 19, 2009, at 1:59 PM, William Stein wrote:

>
>
> MATHEMATICA:
> In[1]:= u := 1 + k; u
> Out[1]= 1 + k
> In[2]:= k := 1;
> In[3]:= u
> Out[3]= 2
>
> MAPLE:
>> u := 1+k;
>                                       u := 1 + k
>> u;
>                                          1 + k
>> k := 1;
>                                         k := 1
>> u;
>                                            2
>
> Wow, that's pretty interesting.  So Maple and Mathematica also have
> the  (bizarre) semantics the user wants, but no other language I
> tested does, including Maxima.
>
> This would thus be a very useful thing to add to the Sage tutorial, as
> users coming over from Maple and Mathematica *should* expect this
> weird semantic, since it is what they learned and are used to.   We
> should have exactly this example to illustrate this subtle point.
>
> <flamebait> The computer scientist in me just can't believe Maple and
> Mathematica are designed that way.  It's just sad. </flamebait>


Note that it depends upon how you define u in Maple, if you instead  
define
u as
u = 1 + k

you'll get the same result as the others. So, you can have either  
result. In
one, you've defined an expression where u is the reference to it, and  
the other
is an equation. In Maple, if you update a variable in an expression,  
it will be
changed in all expressions that use that variable (once they're  
evaluated).
However, it won't change references to the variable in equations.

Cheers,

Tim.

---
Tim Lahey
PhD Candidate, Systems Design Engineering
University of Waterloo
http://www.linkedin.com/in/timlahey


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an 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