Ah thanks-- always comforting to know I'm not the first person to complain... =) And the broadcasting argument makes the current design less mystifying.
In my case, I have a sympy equation that I lambdify to a function that I then want to plot. I wind up with something like this: xx=linspace(...) f=lambdify(x,exp,"numpy") y=f(xx) plot(xx,y) That snippet of code worked fine until it ran on an expression that simplified to a constant. I could solve the problem by placing special handling around y before plot, but that feels inelegant. I understand the broadcasting argument from a numpy centric view, but is that the model that lambdify should follow? I feel as though in numpyland you're more likely to know the shape of your function, and thus would know from the outset whether y needed to be reshaped. In sympyland, the function itself is a variable, so special handling of y becomes necessary boilerplate. Of course, I've explicitly told lambdify to create a "numpy" function, so it's not unreasonable that it behave in the numpy way. Maybe this is a place for a keyword argument? Maybe I'm giving too much weight to my own particular use case, but is this a discussion worth reopening? On Saturday, March 2, 2013 12:21:20 AM UTC-8, Aaron Meurer wrote: > > See https://code.google.com/p/sympy/issues/detail?id=2543 for some > discussion on this. > > Aaron Meurer > > On Fri, Mar 1, 2013 at 8:53 PM, G B <[email protected] <javascript:>> > wrote: > > This is kind of a degenerate case, but personally I think it should > behave > > differently than it does currently. > > > > f1=lambdify(x,2*x,"numpy") > > f2=lambdify(x,S(1),"numpy") > > > > f1(array([1,2,3]) --> [2,4,6] > > f2(array([1,2,3]) --> [1] > > > > I feel that f2 should return [1,1,1] in that situation. Am I > > misinterpreting that? > > > > Cheers-- > > Greg > > > > > > > > > > -- > > 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] <javascript:>. > > To post to this group, send email to [email protected]<javascript:>. > > > Visit this group at http://groups.google.com/group/sympy?hl=en. > > 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
