On Thu, Apr 17, 2008 at 03:59:32PM +0200, Gael Varoquaux wrote: > On Thu, Apr 17, 2008 at 03:58:31PM +0200, Ondrej Certik wrote: > > However, how about this syntax: > > > In [18]: f = Lambda(x, term, evalf=True) > > Or rather f = Lamdba(x, term, numerical=True) > > The reason I say this is that the keyword numerical could in the long run > be added to many functions in sympy (probably by making them call scipy > in the backend). This would thus be transparent to the user.
May be In [21]: sin(2) Out[21]: sin(2) In [22]: sin(2).evalf() Out[22]: 0.9092974268256816953960198659 An now, do you mean this? In [22]: sin(2, numerical=True) Out[22]: 0.9092974268256816953960198659 ? But this leads me to an other question. What is the (abstract, user level) difference between sin(2) and term = x + x*+2 f = Lambda(x, term) f(2) ? There should be no difference. So, when we discuss to get >>> f([0, 1, 2]) [0, 2, 6] then also I want so get >>> sin([0, 1, 2]) [0, 0.841, 0.909] So, I want to have many input type to a function: x : a sympy symbol 2.3+2j : a symbol number (no difference to a sympy symbol) 2.3+2j : a numeric number (complex) tuples, lists, numpy.arrays of them. And matrices? In [35]: M=Matrix([1,2],[3,4]) In [36]: M Out[36]: ⎡1 2⎤ ⎣3 4⎦ In [37]: exp(x) Out[37]: x ℯ In [38]: exp(M) --------------------------------------------------------------------------- <type 'exceptions.NotImplementedError'> Traceback (most recent call last) It seems to get more complex this topic. But we can compound to get this behaviour only with a Lambda Function. By, Friedrich --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---