I'm not sure if I understand correctly. If I include e or pi in the substitution (e.g. y(pi = pi)), they are seen as arguments for the rest of the session. However, if I query for type(e) or type(pi), I still get <class 'sage.functions.constants.E'>. This seems inconsistent to me. If this is caused by the interaction with maxima, I suppose that this behaviour will change with the changeover to Pynac. If this is the case, there is no point submitting a ticket. I'll just wait and avoid the subs(locals()) or subs(globals()) commands in the mean time.
Cheers, Stan Carl Witty wrote: > On Thu, Apr 9, 2009 at 12:22 AM, Stan Schymanski <schym...@gmail.com> wrote: > >> Dear all, >> >> I encountered some mysterious problems earlier when I used .subs(locals >> ()), where some global variables such as pi and e were lost (see. e.g. >> thread >> http://groups.google.com/group/sage-support/browse_thread/thread/0f1086c43611242a?). >> >> Now I found an example that demonstrates this a bit better: >> >> sage: var('a b c blah') >> sage: varsdict = dict(blah = exp(b)) >> sage: y = (1/blah*a - sin(pi*c)).subs(varsdict) >> sage: y.arguments() >> (a, b, c) >> >> But, doing the same thing using .subs(locals()) gives: >> >> sage: var('a b c') >> sage: blah = exp(b) >> sage: y = (1/blah*a - sin(pi*c)).subs(locals()) >> sage: y.arguments() >> (a, b, c, e, pi) >> >> Here, sage suddenly seas e and pi as variables, which leads to all >> sorts of problems when using fast_float or simplifying, or plotting. >> The original behaviour is only restored after restarting the notebook! >> E.g. using the previous approach again now gives: >> >> sage: var('a b c blah') >> sage: varsdict = dict(blah = exp(b)) >> sage: y = (1/blah*a - sin(pi*c)).subs(varsdict) >> sage: y.arguments() >> (a, b, c, e, pi) >> >> Shall I open a ticket for this or is it intended behaviour? >> > > I have a guess as to what is going on. Perhaps it's using maxima to > do the substitution, and so it tells maxima that every local variable > name is actually a symbolic variable? > > If this is the problem, I'm not sure how to fix it, though. > > Carl > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send 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 -~----------~----~----~----~------~----~------~--~---