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

From OpenWetWare
Jump to: navigation, search
(Commands & Functions)
(Matrices and arrays)
 
(20 intermediate revisions by the same user 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 41: Line 65:
 
*Use of * results in element-wise multiplication
 
*Use of * results in element-wise multiplication
 
*Matrix multiplication achieved with dot()
 
*Matrix multiplication achieved with dot()
 +
 +
http://docs.scipy.org/doc/numpy/user/basics.rec.html
  
 
Array manipulation routines: 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
  
  
Line 61: Line 112:
  
 
http://docs.scipy.org/doc/numpy/reference/generated/numpy.matrix.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

Latest revision as of 05:23, 3 October 2013

http://wiki.scipy.org/NumPy_for_Matlab_Users

http://mathesaurus.sourceforge.net/matlab-numpy.html

https://pypi.python.org/pypi/numpy

http://wiki.scipy.org/Tentative_NumPy_Tutorial

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


http://www.engr.ucsb.edu/~shell/che210d/numpy.pdf

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

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/4151128/what-are-the-differences-between-numpy-arrays-and-matrices-which-one-should-i-u

http://stackoverflow.com/questions/3337301/numpy-matrix-to-array

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


http://www.python-course.eu/matrix_arithmetic.php

http://nbviewer.ipython.org/urls/raw.github.com/jrjohansson/scientific-python-lectures/master/Lecture-2-Numpy.ipynb

http://scienceoss.com/numpy-array-basics/

http://showmedo.com/videotutorials/video?name=10370040&fromSeriesID=1037

Pretty-printing: http://stackoverflow.com/questions/2891790/pretty-printing-of-numpy-array

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()

http://docs.scipy.org/doc/numpy/user/basics.rec.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

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


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