[MATRIX-SIG] -3**(-1/3.), sgn()
Timothy A. Hochberg
hochberg@wwa.com
Thu, 24 Jul 1997 11:20:39 -0500 (CDT)
On Thu, 24 Jul 1997, Jean-Bernard ADDOR wrote:
> I would like to write sgn(a)*abs(a)**(-1/3.) but the sgn function seems
> not to be defined in python (perhaps because it is not in c, but it is in
> fortran). I can use greater_equal. Do you have a better solution ?
For what it's worth, sgn(x) can be implemented as:
def sgn(x):
return greater_equal(x,0) - less_equal(x,0)
(or is that what you meant by use greater equal?)
____
/im
+------------------------------------------------+
|Tim Hochberg Research Assistant |
|hochberg <at> wwa.com University of Illinois |
| Electrical Engineering |
+------------------------------------------------+
_______________
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________