Why not just make dummification an optional argument to lambdify? The user can set it if they desire, otherwise the old behavior happens.
Jason moorepants.info +01 530-601-9791 On Sun, Sep 1, 2013 at 3:02 PM, Gilbert Gede <gilbertg...@gmail.com> wrote: > Looks like in lambdify one of the checks for dummification is broken. I'll > open a PR in a minute here. > > The dummification was only supposed to happen on numerical translation > though, so modules='sympy' won't be fixed (or dictionaries). I don't know > whether lambdify should always dummify or not though. > > -Gilbert > > > On Sunday, September 1, 2013 9:45:18 AM UTC-7, Jason Moore wrote: > >> Matthew, >> >> This is definitely a bug. We should report in the ticketing system. >> >> The lines here: https://github.com/sympy/**sympy/blob/master/sympy/** >> utilities/lambdify.py#L279<https://github.com/sympy/sympy/blob/master/sympy/utilities/lambdify.py#L279>don't >> make a lot of sense to me. I'm not sure why the dummify is set to >> True only under those specific conditions. >> >> If dummify is overridden to always be true, the function seems to work as >> expected. >> >> Gilbert Gede made those changes. Maybe he will chime in as to why the >> code is as it is. I'll look into some fixes and some more tests too. >> >> >> Jason >> moorepants.info >> +01 530-601-9791 >> >> >> On Sat, Aug 31, 2013 at 5:45 PM, Matthew Brett <matthe...@gmail.com>wrote: >> >>> Hi, >>> >>> I was trying to debug a problem I was having with lambdify, and I got >>> stuck trying to understand the newish 'dummify' changes. >>> >>> So, it's nice that this works now: >>> >>> from sympy import symbols, lambdify, sin >>> from sympy.utilities.lambdify import implemented_function >>> >>> t = symbols('t') >>> x = sin >>> y = x(t) >>> f = lambdify(y, 2*y, modules=None) >>> # Evaluates OK >>> print(f(0)) >>> >>> But I'm not sure why this should not also work: >>> >>> f = lambdify(y, 2*y, modules='sympy') >>> # Error evaluating lambda >>> print(f(0)) >>> >>> In order for this to work, I believe the 'dummify' parameter to >>> 'lambdastr' has to be set to True from the call in 'lambdify', but >>> this only happens if the strings 'numpy', 'math' or 'mpmath' appear >>> first in the module list. For example these also fail: >>> >>> f = lambdify(y, 2*y, modules=numpy) >>> f = lambdify(y, 2*y, modules=dict(sin=math.sin)) >>> x = implemented_function('x', lambda x : x + 1) >>> y = x(t) >>> f = lambdify(y, 2*y, modules='sympy') >>> >>> Is it easy to explain why these should not work? >>> >>> Thanks a lot, >>> >>> Matthew >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "sympy" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to sympy+un...@**googlegroups.com. >>> To post to this group, send email to sy...@googlegroups.com. >>> >>> Visit this group at >>> http://groups.google.com/**group/sympy<http://groups.google.com/group/sympy> >>> . >>> For more options, visit >>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>> . >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sympy+unsubscr...@googlegroups.com. > To post to this group, send email to sympy@googlegroups.com. > Visit this group at http://groups.google.com/group/sympy. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.