Hi,
> The problem is that, if I pass a dictionary, and a module, as a
> namespace, to sympy lambdify, then I can apparently overwrite the
> namespace of a function that has already been instantiated. I
> realize that's not very clear, but I hope this script helps to
> explain:
>
> n1 = {'f': lambda x:'first f',
> 'g': lambda x:'first g'}
> n2 = {'f': lambda x:'second f',
> 'g': lambda x:'second g'}
>
> f = sympy.Function('f')
> g = sympy.Function('g')
> x = sympy.Symbol('x')
>
> if1 = sympy.lambdify(x, f(x), modules=(n1, "sympy"))
> print 'f(x) before dict, string;', if1(1)
> if2 = sympy.lambdify(x, g(x), modules=(n2, "sympy"))
> print 'f(x) after dict, string;', if1(1)
>
> - gives this output:
>
> f(x) before dict, string; first f
> f(x) after dict, string; second f
In case anyone ends up following this thread, I posted a bugfix for
this on sympy-patches. I hope:
http://groups.google.com/group/sympy-patches/browse_thread/thread/cf2f122b3d36d7f0#
Cheers,
Matthew
--
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.