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

Reply via email to