It is not new. It looks like it has a docstring. You can see it if you type help(lambdify).
Aaron Meurer On Apr 28, 2010, at 12:10 PM, janwillem wrote: > Works great, thanks. As far as benchmarks go exactly as efficient as > the "write and import" method and so much more elegant. However, > cann't find documentation, is lambdify brand new? > This is what I tried: > flambdify = sympy.lambdify((X, F, B), Y) > and used as > y = flambdify(x, f, b) > > On Apr 28, 7:27 pm, Sebastian <basti...@gmail.com> wrote: >> On 04/28/2010 07:21 PM, janwillem wrote: >> >>> I have a function of a few variables that is the result of some >>> symbolic manipulations like differentiation and matrix operations. I >>> would like to do some Monte Carlo work on this to get the distribution >>> of the function result as a function of the distributions of the >>> inputs. However, the subs method (like /. in Mathematica) is much to >>> slow. Is there an elegant solution for that? >>> What came to my mind is writing the result to a file and then >>> importing that like for a more trivial case: >> >>> X, F, B = sympy.symbols('XFB') >>> Y = X/F - B >>> f = open('sympy_function.py' ,'w') >>> f.write('def fsympy(X,F,B):\n') >>> f.write(' return %s\n' % Y) >>> f.close() >>> from sympy_function import * >> >>> With numerical values for x, f and b: >>> y = fsympy(x, f, b) is 300 times faster than y = Y.subs({X:x, F:f, >>> B:b}) and only 10% slower than straightaway y = x/f -b >> >>> So that works but I do not consider it elegant. Something better? >> >> Take a look into lambdify - it basically does what you proposed without >> doing the file manipulation ;) >> >> Sebastian >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sympy" group. >> To post to this group, send email to sy...@googlegroups.com. >> To unsubscribe from this group, send email to >> sympy+unsubscr...@googlegroups.com. >> For more options, visit this group >> athttp://groups.google.com/group/sympy?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To post to this group, send email to sy...@googlegroups.com. > To unsubscribe from this group, send email to > sympy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sympy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sy...@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.