I think there were concerns on adding additional arguments to lambdify. That was why I added the dummify flag to the lower-level lambdastr instead, and tried to keep lambdify's interface simple.
I think the logic could be re-written to be a little more robust - maybe not dummifying if a dictionary or 'sympy' is explicitly passed in or implemented functions are provided, and only dummifying if the numeric outputs are going to take precedence over the symbolic outputs? I guess I'm not completely convinced that there is a benefit for the user in having it as an argument (the 4th optional argument). It's a little simpler to program and read, but it's making the interface more complicated - and if the logic remains in there the code doesn't really end up being "simpler". I suppose the question is: Are there use cases where dummification is needed, and there are implemented functions or the desired module is 'sympy'? If so, we should add dummification as a flag. -Gilbert On Sunday, September 1, 2013 4:24:36 PM UTC-7, Matthew Brett wrote: > > Hi, > > On Sun, Sep 1, 2013 at 12:38 PM, Gilbert Gede > <[email protected]<javascript:>> > wrote: > > Check out this PR for a discussion of appropriateness of dummification: > > https://github.com/sympy/sympy/pull/1920 > > > > Here's the new PR with the correction: > > https://github.com/sympy/sympy/pull/2428 > > If I understand correctly, you are trying to guess whether the person > calling lambdify wants numerical implementations or not. > > I agree with your comment on the PR: "But I see your point about > symbols/expressions vs. sub_/big_expressions. But I would think with > lambdify, as it is intended for preparing for numerical evaluation, > that this wouldn't be a concern." : > https://github.com/sympy/sympy/pull/1920 > > At the moment you try to guess based on whether someone explicitly > passed 'sympy' as the modules argument, or the first argument to > modules (it's not the default). > > For example, it might be the case that someone passed 'sympy' as the > first argument, but 'numpy' as the second, and all the functions in > the expression are numpy functions. Or the user might pass 'sympy' > as the modules, and have an implemented function in the expression, so > clearly does want numerical implementation. > > So it seems to me the problem here is that you are having to use an > implicit heuristic to determine what the function does, and it would > be hard to guess how to change the behavior of the function without > reading to the code to work out the heuristic. > > I think Jason is right - 'dummify' should be an argument to lambdify; > if you really want the heuristic, it should be in the case where > 'dummify' is None. > > Cheers, > > 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.
