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?
Cheers,
Stan
--~--~---------~--~----~------------~-------~--~----~
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/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---