I think you should use a Symbol for f in your expression, and then add {'f': mpf(...)} to the namespace dict used by lambdify.
Aaron Meurer On Dec 1, 2012, at 4:14 PM, Freddie Witherden <fred...@witherden.org> wrote: > Hi all, > > Consider (with mp.dps = 30): > > f = mp.mpf('0.1234123094834543252345098') > q = sy.Symbol('q') > x = f*q > > Now, running lambdastr over the expression we find: > > 'lambda q: (0.1234123094834543252345098*q)' > > which is curtailed by the fact that our mpf float will be interpreted as > a Python float. Often times (especially when q is of type mpf) this is > not sufficient. > > Hence, what is the best way to hack/fudge the lambdify mechanism into > either wrapping mpf constants suitably to yield: > > 'lambda q: (mp.mpf('constant')*q)' > > or better still having them constructed once (rather than per each > evaluation)? > > Polemically yours, Freddie. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@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.