Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
authorAnoop Jacob Thomas<anoop@fossee.in>
Sun, 07 Nov 2010 18:36:59 +0530
changeset 398 36295bb91766
parent 397 4aea9ed09983
child 399 3c16961361cd
Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
dictionaries/quickref.tex
getting-started-with-arrays/quickref.tex
getting-started-with-for/quickref.tex
matrices/quickref.tex
other-type-of-plots/quickref.tex
savefig/quickref.tex
using python modules/quickref.tex
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dictionaries/quickref.tex	Sun Nov 07 18:36:59 2010 +0530
@@ -0,0 +1,20 @@
+Defining dictionary:\\
+{\ex \lstinline|    d = {'k1':'v1', 'k2':'v2'}|}
+
+Access value using key in dictionary:\\
+{\ex \lstinline|    print d['k1']|}
+
+Add key-value pair to dictionary:\\
+{\ex \lstinline|    d['k3'] = 'v3'|}
+
+Delete key-value from dictionary:\\
+{\ex \lstinline|    del d['k1']|}
+
+Check container-ship of key in dictionary:\\
+{\ex \lstinline|    'k2' in d|}
+
+List of keys in dictionary:\\
+{\ex \lstinline|    d.keys()|}
+
+List of values in dictionary:\\
+{\ex \lstinline|    d.values()|}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/getting-started-with-arrays/quickref.tex	Sun Nov 07 18:36:59 2010 +0530
@@ -0,0 +1,14 @@
+Creating an array:\\
+{\ex \lstinline|    a = array([[1,2,3,4],[5,6,7,8]])|}
+
+Finding shape of array:\\
+{\ex \lstinline|    a.shape|}
+
+Reshape an array:\\
+{\ex \lstinline|    a.reshape(4,2)|}
+
+Creating identity matrix:\\
+{\ex \lstinline|    identity(3)|}
+
+Creating matrix with all zeros:\\
+{\ex \lstinline|    z = zeros((4,2))|}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/getting-started-with-for/quickref.tex	Sun Nov 07 18:36:59 2010 +0530
@@ -0,0 +1,6 @@
+For loop:\\
+{\ex \lstinline|    for i in range(1,11,2):|}
+{\ex \lstinline|        s = s + i|}
+
+Range function:\\
+{\ex \lstinline|    range([start,]stop[,step])|}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/matrices/quickref.tex	Sun Nov 07 18:36:59 2010 +0530
@@ -0,0 +1,26 @@
+Matrix Multiplication:\\
+{\ex \lstinline|    c = dot(a,b)|}
+
+Transpose of a matrix:\\
+{\ex \lstinline|    m.T|}
+
+Inverse of a matrix:\\
+{\ex \lstinline|    im = inv(m)|}
+
+Frobenius norm of matrix:\\
+{\ex \lstinline|    norm(m)|}
+
+Inverse norm of matrix:\\
+{\ex \lstinline|    norm(m, ord=inf)|}
+
+Determinant of matrix:\\
+{\ex \lstinline|    det(m)|}
+
+Eigen values of matrix:\\
+{\ex \lstinline|    eigvals(m)|}
+
+Eigen vectors of matrix:\\
+{\ex \lstinline|    eig(m)[1]|}
+
+Singular Value Decomposition on matrix m:\\
+{\ex \lstinline|    svd(m)|}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/other-type-of-plots/quickref.tex	Sun Nov 07 18:36:59 2010 +0530
@@ -0,0 +1,11 @@
+Creating scatter plot:\\
+{\ex \lstinline|    scatter(x, y)|}
+
+Creating pie chart:\\
+{\ex \lstinline|    pie(p, labels=l)|}
+
+Creating bar chart:\\
+{\ex \lstinline|    bar(x, y)|}
+
+Creating log-log chart:\\
+{\ex \lstinline|    loglog(x, y)|}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/savefig/quickref.tex	Sun Nov 07 18:36:59 2010 +0530
@@ -0,0 +1,5 @@
+Saving a plot(png):\\
+{\ex \lstinline|    savefig('filename.png')|}
+
+Saving a plot(pdf):\\
+{\ex \lstinline|    savefig('filename.pdf')|}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/using python modules/quickref.tex	Sun Nov 07 18:36:59 2010 +0530
@@ -0,0 +1,16 @@
+Import all definitions to current name-space:\\
+{\ex \lstinline|    from scipy import *|}
+
+Import few definitions to current name-space:\\
+{\ex \lstinline|    from scipy import linspace, pi, sin|}
+
+Import a module as a new name-space:\\
+{\ex \lstinline|    import scipy|}
+
+Few standard python modules:\\
+{\ex \lstinline|    Math: math, random|}
+{\ex \lstinline|    Internet: urllib2, smtplib|}
+{\ex \lstinline|    System: sys|}
+{\ex \lstinline|    OS: os|}
+{\ex \lstinline|    Regular Expression: re|}
+{\ex \lstinline|    Compression: gzip, zipfile, tarfile|}