On Thu, Aug 6, 2009 at 2:12 PM, Gabriel<[email protected]> wrote: > > > > On Aug 6, 3:35 pm, "Aaron S. Meurer" <[email protected]> wrote: >> Yes, you should avoid using the names I, E, S, N, C, or O (uppercase >> only) for Symbols because they are predefined by SymPy. >> Seehttp://docs.sympy.org/gotchas.html#id2 >> >> By the way, you can use the mnemonic COSINE to remember these. >> > True, but this does seem like a bug as unlike redefining this > variables and getting strange behaviour I am using a method that is > not protecting these names for its own local use (I shouldn't need to > worry about how the internal code for .subs works when I pass it > arguments) > > This even breaks local names spaces, unlike: > >>>> import sympy > >>>> N = 3 >>>> sympy.N(N) > 3.00000000 > > which works fine, if I do > >>>> (1 + x).subs(dict(N=3)) > > things break, so the behaviour is non local and a different issue than > the name spacing problems described in the gotcha's.
I think you found a bug: http://code.google.com/p/sympy/issues/detail?id=1581 just use: In [3]: (1 + x).subs({N: 3}) Out[3]: 1 + x This works for me. e.g. don't use dict(), it doesn't always work. Ondrej --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" group. 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/sympy?hl=en -~----------~----~----~----~------~----~------~--~---
