On Wed, Apr 16, 2008 at 01:53:30PM +0200, Friedrich Hagedorn wrote: > > Many physicists use Mathematica to do numerical work, like you seem to be > > wanting to do. It is not its core job, but it does it. Same thing with > > sympy. We are just all suggesting it is not the best tool avalaible.
> Ok. But here we can use the advantage of Python: To use sympy for > symbolic calculation and then numpy for the numeric evaluation and > further numeric calculation (eg root-finding). +1. > In [35]: f = Lambda(x, term) > In [36]: f(x) > Out[36]: > 2 > x + x > In [37]: f(2) > Out[37]: 6 > And not: f(2).evalf()! This eval should be done with python math or > mpmath to be fast as possible. > In [45]: f([0, 1, 2, 3]) > Out[45]: [0, 2, 6, 12] > And not: map(f, [0,1,2,3])! This eval should be done in numpy with a dict > for operationnames (eg. numpy.arccos <-> sympy.acos). I don't agree here. You are putting too much magic, I think it should be: In [45]: f(array([0, 1, 2, 3]) Out[45]: array([0, 2, 6, 12]) Arrays and list are not the same things and we to keep list semantic, for example we want: >>> f = 2*x >>> F = lambdify(f, [x]) >>> F([0, 1, 2, 3]) [0, 1, 2, 3, 0, 1, 2, 3] [...] > Which variant, A or B, would you prefere? I like B because the object you > want to eval is the term. And the only information sympy have to know > is the order of the symbols. And further you dont need to create a > new variable name ("term" -> "f(x)"). A. (aka lambdify) is almost implemented, so let's stick with A. my 2 cents (I am not a sympy developer so this is all sweet talking. Gaƫl --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sympy?hl=en -~----------~----~----~----~------~----~------~--~---