[SciPy-user] Matlab to numpy

David Douard david.douard at logilab.fr
Thu Jun 22 08:09:09 EDT 2006


On Thu, Jun 22, 2006 at 01:59:45PM +0200, Nils Wagner wrote:
>  I try to convert a Matlab code into Numpy/Scipy
> 
> What is equaivalent to
> 
> np = 36
> t2 =rand(np,1)
> r2=rand(np,1)./max(abs(sin(t2)),abs(cos(t2)))
> 
> in numpy
> 
> np=36
> t2 = rand(np)
> r2 = rand(np)/...  ?

I would say, using numpy

from numpy import *
np = 36
t2 = rand(np)
r2 = rand(np)/maximum(absolute(sin(t2)),absolute(cos(t2)))


David

> 
> Nils
> 
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user

-- 
David Douard                             LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian : http://www.logilab.fr/formations
Développement logiciel sur mesure :      http://www.logilab.fr/services
Informatique scientifique :              http://www.logilab.fr/science
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20060622/df4da834/attachment.sig>


More information about the SciPy-User mailing list