Hi, On Tue, Oct 29, 2019 at 04:49:03PM -0700, Michael Jung wrote: > I'd like to use symbolic expressions in the source code to compute taylor > expansions of predefined functions. But this affects the use of variables > named the same way on the level of the user. Is there a safe way to use the > framework of symbolic calculus without affecting the variables globally?
Indeed, we have: sage: a = 2 sage: a 2 sage: b = var('a') sage: b a sage: a a because the `var` function do two things simultaneously: - return the symbol a - let the Python name a point to the symbol a The trick is to use SR.var instead, that only returns something but does not play with the namespace: sage: a = 2 sage: a 2 sage: b = SR.var('a') sage: b a sage: a 2 Let me take the opportunity to promote the use of https://ask.sagemath.org/questions/ for such questions, since it benefits to more users (in particular it is well indexed by search engines). Ciao, Thierry > > Thanks in advance! :) > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sage-devel/dd3f5b1f-b9c4-437b-bcc1-809720da8d1b%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/20191030094658.7lbfzpdqouulxmtx%40metelu.net.