PythonQ 240-8XX Manuel d'utilisateur Page 14

  • 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 13
c
! www.simula.no/˜hpl
Array initialization from a Python f u n ction
>>> def myfunc(i, j):
... return (i+1)
*
(j+4-i)
...
>>> # make 3x6 array where a[i,j] = myfunc(i,j):
>>> a = fromfunction(myfunc, (3,6))
>>> a
array([[ 4., 5., 6., 7., 8., 9.],
[6., 8.,10.,12.,14.,16.],
[6., 9.,12.,15.,18.,21.]])
Numerical Python – p. 248/728
Vue de la page 13
1 2 ... 9 10 11 12 13 14 15 16 17 18 19 ... 36 37

Commentaires sur ces manuels

Pas de commentaire