summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dictionaries/quickref.tex20
-rw-r--r--getting-started-with-arrays/quickref.tex14
-rw-r--r--getting-started-with-for/quickref.tex6
-rw-r--r--matrices/quickref.tex26
-rw-r--r--other-type-of-plots/quickref.tex11
-rw-r--r--savefig/quickref.tex5
-rw-r--r--using python modules/quickref.tex16
7 files changed, 98 insertions, 0 deletions
diff --git a/dictionaries/quickref.tex b/dictionaries/quickref.tex
new file mode 100644
index 0000000..40c2256
--- /dev/null
+++ b/dictionaries/quickref.tex
@@ -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()|}
diff --git a/getting-started-with-arrays/quickref.tex b/getting-started-with-arrays/quickref.tex
new file mode 100644
index 0000000..10714c4
--- /dev/null
+++ b/getting-started-with-arrays/quickref.tex
@@ -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))|}
diff --git a/getting-started-with-for/quickref.tex b/getting-started-with-for/quickref.tex
new file mode 100644
index 0000000..d106d6d
--- /dev/null
+++ b/getting-started-with-for/quickref.tex
@@ -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])|}
diff --git a/matrices/quickref.tex b/matrices/quickref.tex
new file mode 100644
index 0000000..8e831bb
--- /dev/null
+++ b/matrices/quickref.tex
@@ -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)|}
diff --git a/other-type-of-plots/quickref.tex b/other-type-of-plots/quickref.tex
new file mode 100644
index 0000000..275c226
--- /dev/null
+++ b/other-type-of-plots/quickref.tex
@@ -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)|}
diff --git a/savefig/quickref.tex b/savefig/quickref.tex
new file mode 100644
index 0000000..e485ae0
--- /dev/null
+++ b/savefig/quickref.tex
@@ -0,0 +1,5 @@
+Saving a plot(png):\\
+{\ex \lstinline| savefig('filename.png')|}
+
+Saving a plot(pdf):\\
+{\ex \lstinline| savefig('filename.pdf')|}
diff --git a/using python modules/quickref.tex b/using python modules/quickref.tex
new file mode 100644
index 0000000..cfa992a
--- /dev/null
+++ b/using python modules/quickref.tex
@@ -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|}