To achieve this with lambdify you should call cse() first, then lambdify each expression separately. We ought to build a wrapper to make this easier (or a cse=True flag to lambdify).
Aaron Meurer On Fri, Oct 14, 2016 at 11:06 AM, Björn Dahlgren <[email protected]> wrote: > > > On Friday, 14 October 2016 15:09:46 UTC+2, Albert Pető wrote: >> >> Hi, I plan to heavily use a function generated with lambdify from a sympy >> expression which has repeated occurences of some subexpressions. > > > This functionality is available in symengine: > https://github.com/symengine/symengine.py/blob/master/symengine/lib/symengine_wrapper.pyx#L2827 > (which you might want to consider if you are concerned about speed). If you > want to stay pure python and only use sympy you can look at the > source code there for how to achieve this (we are creating a closure). > > Best, > Björn > > -- > 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 https://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/45c5d1d6-b5ea-458d-92f4-096cd4b51b8d%40googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. -- 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 https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6Kw-S0g%2Bi5OQs_-ukgv13e%3D%2Bujhy0_DQrc6LyVVrwnVEw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
