On Jun 17, 2009, at 3:05 AM, Utpal Sarkar wrote:

> Thanks for the replies.
> I noticed something funny: if you call x = var("X") in some scope, it
> is X that is injected into the global scope, not x. In fact I thought
> that the argument was merely a print name.

var("X") is what makes the variable, there's nothing special about  
assignment. For example, if I wrote

sage: x = var("X") + 1

then x would have the value X + 1, and as a side effect, X would be  
injected into the global scope. This seems like a surprising artifact  
to many people, and is certainly not like anything Python does. Was  
there a strong justification for doing this?

>
>
> On Jun 17, 1:49 am, Dan Drake <dr...@kaist.edu> wrote:
>> I ran into the problem discussed in this thread just the other  
>> day, and
>> my solution was to use sage.symbolic.ring. How does this solution
>> compare to the others posted in this thread? Here's (basically)  
>> what I
>> did:
>>
>>     from sage.symbolic.ring import var as symbvar
>>
>>     def foo(n, k):
>>         t = symbvar('t')
>>         return exp(t^k).series(t, n+1).coefficient(t, n)*factorial(n)
>>
>> Comments?
>>
>> Dan
>>
>> --
>> ---  Dan Drake <dr...@kaist.edu>
>> -----  KAIST Department of Mathematical Sciences
>> -------  http://mathsci.kaist.ac.kr/~drake
>>
>>  signature.asc
>> < 1KViewDownload
> >


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to