[Numpy-discussion] Piecewise functions.

Alan G Isaac aisaac at american.edu
Fri Sep 23 07:58:08 EDT 2005


On Fri, 23 Sep 2005, Andrea Riciputi apparently wrote: 
> What I really need is a way to prevent f1 and f2 from 
> acting on those values of the 'x' array for which the 
> functions are not defined. 

The example I posted works with an array, which I called d. 
If you must feed the array to the function, just move the 
list comprehension inside of f.  Of course, you may find
list comprehension too slow for your application.
Alan Isaac 






More information about the NumPy-Discussion mailing list