# Difference between revisions of "User:Jarle Pahr/NumPy"

64-bit installers: http://www.lfd.uci.edu/~gohlke/pythonlibs/

# Matrices and arrays

Data type objects: http://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html

Matrices:

• Strictly 2-dimensional
• Use of * results in matrix multiplication
• Element-wise multiplication achieved with multiply()

Arrays:

• Use of * results in element-wise multiplication
• Matrix multiplication achieved with dot()

Array manipulation routines: http://docs.scipy.org/doc/numpy/reference/routines.array-manipulation.html

Array creation routines: http://docs.scipy.org/doc/numpy/reference/routines.array-creation.html

# Commands & Functions

Create new array :

```np.array(object)
```

Example, 3x3 array:

```test = np.array([[1,2,3],[4,5,6],[7,8,9]])
```

Create matrix from array:

```matrix = np.matrix(arrayname)
```

Dimensions of matrix:

```matrixname.shape
```

Matrix indexing:

```a = np.mat([[1,2,3],[4,5,6],[7,8,9]]) #create 3x3 matrix
a[1,1] #returns 5
```