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#L279don'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 <[email protected]>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 [email protected].
> To post to this group, send email to [email protected].
> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to