On Thu, Oct 1, 2009 at 12:10 PM, Zachary Pincus wrote:
> Hello,
>
> a < b < c (or any equivalent expression) is python syntactic sugar for
> (a < b) and (b < c).
>
> Now, for numpy arrays, a < b gives an array with boolean True or False
> where the elements of a are less than those of b. So this g
Hello,
a < b < c (or any equivalent expression) is python syntactic sugar for
(a < b) and (b < c).
Now, for numpy arrays, a < b gives an array with boolean True or False
where the elements of a are less than those of b. So this gives us two
arrays that python now wants to "and" together. To
On Thu, Oct 1, 2009 at 9:55 AM, Dr. Phillip M. Feldman
wrote:
>
> I've defined the following one-line function that uses numpy.where:
>
> def sin_half_period(x): return where(0.0 <= x <= pi, sin(x), 0.0)
>
> When I try to use this function, I get an error message:
>
> In [4]: z=linspace(0,2*pi,9)
I've defined the following one-line function that uses numpy.where:
def sin_half_period(x): return where(0.0 <= x <= pi, sin(x), 0.0)
When I try to use this function, I get an error message:
In [4]: z=linspace(0,2*pi,9)
In [5]: sin_half_period(z)