# User:Jarle Pahr/NumPy

(Difference between revisions)
 Revision as of 07:03, 23 August 2013 (view source) (→Matrices and arrays)← Previous diff Current revision (08:23, 3 October 2013) (view source) (→Matrices and arrays) (26 intermediate revisions not shown.) Line 1: Line 1: http://wiki.scipy.org/NumPy_for_Matlab_Users http://wiki.scipy.org/NumPy_for_Matlab_Users + http://mathesaurus.sourceforge.net/matlab-numpy.html https://pypi.python.org/pypi/numpy https://pypi.python.org/pypi/numpy Line 13: Line 14: http://physics.nmt.edu/~raymond/software/python_notes/paper003.html http://physics.nmt.edu/~raymond/software/python_notes/paper003.html + + + http://casaguides.nrao.edu/index.php?title=NumpyBasics + + =Tutorials etc= + + http://www.iiserpune.ac.in/~farhat/courses/idc205/lab2.pdf + + Advanced numpy: http://scipy-lectures.github.io/advanced/advanced_numpy/ + + =String operations= + + http://docs.scipy.org/doc/numpy/reference/routines.char.html + + http://stackoverflow.com/questions/1759208/write-a-data-string-to-a-numpy-character-array =Matrices and arrays= =Matrices and arrays= + + http://scipy-lectures.github.io/intro/numpy/array_object.html + + http://pages.physics.cornell.edu/~myers/teaching/ComputationalMethods/python/arrays.html http://stackoverflow.com/questions/12024820/danger-of-mixing-numpy-matrix-and-array http://stackoverflow.com/questions/12024820/danger-of-mixing-numpy-matrix-and-array Line 21: Line 41: http://stackoverflow.com/questions/3337301/numpy-matrix-to-array http://stackoverflow.com/questions/3337301/numpy-matrix-to-array + + Data type objects: http://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html Line 30: Line 52: http://showmedo.com/videotutorials/video?name=10370040&fromSeriesID=1037 http://showmedo.com/videotutorials/video?name=10370040&fromSeriesID=1037 + + Pretty-printing: http://stackoverflow.com/questions/2891790/pretty-printing-of-numpy-array Matrices: Matrices: Line 42: Line 66: *Matrix multiplication achieved with dot() *Matrix multiplication achieved with dot() + http://docs.scipy.org/doc/numpy/user/basics.rec.html - http://docs.scipy.org/doc/numpy/reference/routines.array-manipulation.html + 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 + + http://stackoverflow.com/questions/6999617/how-to-assign-a-string-value-to-an-array-in-numpy + + http://stackoverflow.com/questions/9476797/how-do-i-create-character-arrays-in-numpy =Commands & Functions= =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: Dimensions of matrix: - matrixname.shape + matrixname.shape + + + Matrix indexing: + + a = np.mat([[1,2,3],[4,5,6],[7,8,9]]) #create 3x3 matrix + a[1,1] #returns 5 + + + http://docs.scipy.org/doc/numpy/reference/generated/numpy.zeros.html + + http://docs.scipy.org/doc/numpy/reference/generated/numpy.resize.html + + http://docs.scipy.org/doc/numpy/reference/generated/numpy.concatenate.html + + http://docs.scipy.org/doc/numpy/reference/generated/numpy.hstack.html + + http://docs.scipy.org/doc/numpy/reference/generated/numpy.matrix.html + + + + =Applications= + + ==Gauss-Jordan elimination== + + + http://zeronteproject.tk/contents/content.php?topic=Software&postid=34 + + http://codepad.org/td12rb3X + + http://bender.astro.sunysb.edu/classes/phy688_spring2013/examples/gauss.py + + http://codepad.org/td12rb3X + + https://gist.github.com/num3ric/1357315

## Current revision

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
```