I don't know if this is a bug or not, but what I want is to evaluate a
lambdify'ed expression at a numpy.ndarray of points.

Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> from sympy import Symbol, Piecewise, lambdify
>>>
>>> t=Symbol('t')
>>> f=Piecewise((0, t<3), (t,(t<4)), (1,t>=4))
>>> fl = lambdify(t, f)
>>>
>>> print [fl(float(_t)) for _t in np.linspace(0,10,11)]
[0, 0, 0, 3.00000000000000, 1, 1, 1, 1, 1, 1, 1]
>>> print [fl(_t) for _t in np.linspace(0,10,11)]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 1, in <lambda>
  File "/home/jtaylo/code/virtualenv/nipy/lib/python2.5/site-packages/
sympy-0.6.3-py2.5.egg/sympy/functions/elementary/piecewise.py", line
69, in __new__
    " Relational or Number" % (ec[1], cond_type)
TypeError: Cond True is of type <type 'numpy.bool_'>, but must be a
bool, Relational or Number
>>>
>>> import numpy.version
>>> print numpy.version.version
1.2.0

>>> import sympy
>>> print sympy.__version__
0.6.3
>>>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to