PythonQ 240-8XX Manuel d'utilisateur Page 7

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 37
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 6
c
! www.simula.no/˜hpl
Making arrays
>>> from numpy import
*
>>> n = 4
>>> a = zeros(n) # one-dim. array of length n
>>> print a
[0. 0. 0. 0.]
>>> a
array([ 0., 0., 0., 0.])
>>> p = q = 2
>>> a = zeros((p,q,3)) # p
*
q
*
3three-dim.array
>>> print a
[[[ 0. 0. 0.]
[0. 0. 0.]]
[[ 0. 0. 0.]
[0. 0. 0.]]]
>>> a.shape # a’s dimension
(2, 2, 3)
Numerical Python – p. 241/728
Vue de la page 6
1 2 3 4 5 6 7 8 9 10 11 12 ... 36 37

Commentaires sur ces manuels

Pas de commentaire