[Numpy-discussion] Matlab Translation - sqrt elementwise

Miquel Poch miquel.poch at gmail.com
Tue Apr 17 14:58:43 EDT 2007


Hi,

I've found the next expression write it in Matlab,

Rtx   = sqrt(Rt);

Rtx is a matrix, and that's why I need sqrt() to operate elementwise. I've
read NumPy tutorial, and I know it's possible,

A set of this functions, has been provided wich optimize certain kinds of
calculations on arrays. Most of this functions, such as sin, cos and sqrt
are unary functions wich operate elementwise.  [Numerical Python, pg. 13]

but I don't know who to do it. The next error appear when I execute the
code,

''' exceptions.TypeError : only length-1 arrays can be converted to Python
scalars ''

Thanks in advance,
Mike <numpy-discussion at scipy.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070417/00f9509e/attachment.html>


More information about the NumPy-Discussion mailing list