[SciPy-user] I can't find unit step function.

David Warde-Farley david.warde.farley@utoronto...
Tue Mar 20 02:38:05 CDT 2007

On Tue, 2007-03-20 at 16:20 +0900, Hui Chang Moon wrote:
> Hello, users,
> Scipy has many convenient functions, so I can't find the function that
> I am willing to use.
> So, anybody help me find the unit step function.

That might be just a little too basic for a built-in. But you can easily
define it.

def step(x):
	if x == 0: return 0.5
	return x > 0 and 1 or 0

(Your idea of what constitutes 'the' unit step function may vary)



More information about the SciPy-user mailing list