PythonQ 240-8XX Bedienungsanleitung Seite 8

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 37
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 7
c
! www.simula.no/˜hpl
Making float, int, compl ex arrays
>>> a = zeros(3)
>>> print a.dtype # a’s data type
float64
>>> a = zeros(3, int)
>>> print a
[0 0 0]
>>> print a.dtype
int32
>>> a = zeros(3, float32) # single precision
>>> print a
[0. 0. 0.]
>>> print a.dtype
float32
>>> a = zeros(3, complex)
>>> a
array([ 0.+0.j, 0.+0.j, 0.+0.j])
>>> a.dtype
dtype(’complex128’)
>>> given an array a, make a new array of same dimension
>>> and data type:
>>> x = zeros(a.shape, a.dtype)
Numerical Python – p. 242/728
Seitenansicht 7
1 2 3 4 5 6 7 8 9 10 11 12 13 ... 36 37

Kommentare zu diesen Handbüchern

Keine Kommentare