Merged heads.
authorPuneeth Chaganti <punchagan@fossee.in>
Sun, 10 Oct 2010 13:44:51 +0530
changeset 267 31fc2f22ff30
parent 266 8018779e02b7 (current diff)
parent 261 c7f0069d698a (diff)
child 268 6548b2248b51
Merged heads.
dictionaries.rst
getting_started_with_arrays.rst
getting_started_with_for.rst
gettings_started_with_for.rst
other_type_of_plots.rst
other_types_of_plots.rst
savefig.rst
--- a/dictionaries.rst	Fri Oct 08 16:11:20 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-.. 8.4 LO: dictionaries (2)
-.. ------------------------
-.. * empty 
-.. * filled 
-.. * accessing via keys 
-.. * .values(), .keys() 
-.. * in 
-.. * iteration
-
-============
-Dictionaries
-============
-
-{{{ show the welcome slide }}}
-
-Welcome to the spoken tutorial on dictionaries.
-
-{{{ switch to next slide, outline slide }}}
-
-In this tutorial, we will see how to create empty dictionaries, learn
-about keys and values of dictionaries. Checking for elements and
-iterating over elements.
-
-{{{ switch to next slide on overview of dictionaries }}}
-
-A dictionary in general, is designed to look up meanings of
-words. Similarly, Python dictionary is also designed to look up for a
-specific key and retrieve the corresponding value. Dictionaries are
-data structures that provide key-value mappings.  Dictionaries are
-similar to lists except that instead of the values having integer
-indexes, dictionaries have keys or strings as indexes.
-
-Before we can proceed, start your IPython interpreter with the
-``-pylab`` option.
-
-{{{ start ipython interpreter by issuing command ipython -pylab }}}
-
-Let us start by creating an empty dictionary, type the following in
-your IPython interpreter.
-::
-
-    mt_dict = {}    
-
-Notice that unlike lists curly braces are used define ``dictionary``,
-
-{{{ move the mouse over curly braces to grab attention }}}
-
-Now let us see how to create a filled dictionary,
-::
-
-    extensions = {'jpg' : 'JPEG Image', 'py' : 'Python script', 'html' : 'Html document', 'pdf' : 'Portable Document Format'}
-
-Notice that each key-value pair is separated by a comma
-
-{{{ move the mouse over the commas to grab attention }}}
-
-and each key and value are separated using a colon.
-
-{{{ move the mouse over the colon one by one to grab attention }}}
-
-Here, we defined four entries in the dictionary extensions. The keys
-are
-
-{{{ spell the keys letter by letter }}}
-
-jpg, py, html, and pdf.
-
-Simply type,
-::
-
-    extensions
-
-in the interpreter to see the content of the dictionary. Notice that
-in dictionaries the order cannot be predicted and you can see that the
-values are not in the order that we entered in.
-
-Like in lists, the elements in a dictionary can be accessed using the
-index, here the index is the key. Try,
-::
-
-    print extensions['jpg']
-
-It printed JPEG Image. And now try,
-::
-
-    print extensions['zip']
-
-Well it gave us an error, saying that the key 'zip' is not in the
-dictionary.
-
-Pause here for some time and try few more keys. Also try jpg in
-capital letters.
-
-{{{ switch to next slide, adding and deleting keys and values in
-dictionaries }}}
-
-Well that was about creating dictionaries, now how do we add or delete
-items. We can add new items into dictionaries as,
-::
-
-    extensions['cpp'] = 'C++ code'
-
-and delete items using the ``del`` keyword as,
-::
-
-    del extension['pdf']
-
-Let us check the content of the dictionary now,
-::
-
-    extensions
-
-So the changes have been made. Now let us try one more thing,
-::
-
-    extensions['cpp'] = 'C++ source code'
-    extensions
-
-As you can see, it did not add a new thing nor gave an error, but it
-simply replaces the existing value with the new one.
-
-Now let us learn how to check if a particular key is present in the
-dictionary. For that we can use ``in``,
-::
-
-    'py' in extensions
-    'odt' in extensions
-
-So in short it will return ``True`` if the key is found in the
-dictionary, and will return ``False`` if key is not present. Note that
-we can check only for container-ship of keys in dictionaries and not
-values.
-
-{{{ switch to next slide, Retrieve keys and values }}}
-
-Now let us see how to retrieve the keys and values. We can use the
-method ``keys()`` for getting a list of the keys in a particular
-dictionary and the method ``values()`` for getting a list of
-values. Let us try them,
-::
-
-    extensions.keys()
-
-It returned the ``list`` of keys in the dictionary extensions. And now
-the other one,
-::
-
-    extensions.values()
-
-It returned the ``list`` of values in the dictionary.
-
-{{{ switch to next slide, problem statement for the next solved
-exercise }}}
-
-Now let us try to print the data in the dictionary. We can use ``for``
-loop to iterate.
-::
-
-    for each in extensions.keys():
-        print each, "-->", extensions[each]
-
-
-{{{ switch to next slide, recap }}}
-
-This brings us to the end of this tutorial, we learned dictionaries
-and saw how to create an empty dictionary, build a dictionary with
-some data in it, adding data, ``keys()`` and ``values()`` methods, and
-iterating over the dictionaries.
-
-{{{ switch to next slide, thank you slide }}}
-
-Thank you!
-
-..  Author: Anoop Jacob Thomas <anoop@fossee.in>
-    Reviewer 1:
-    Reviewer 2:
-    External reviewer:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dictionaries/questions.rst	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,102 @@
+Objective Questions
+-------------------
+
+.. A mininum of 8 questions here (along with answers)
+
+1. Container-ship of values can be checked in a python dictionary
+
+   a. True
+   #. False
+
+Answer: False
+
+2. Container-ship of only keys can be checked in a python dictionary
+
+   a. True
+   #. False
+
+Answer: True
+
+3. The value in a dictionary can be
+
+   a. String
+   #. Integer
+   #. Any data type
+   #. None
+
+Answer: Any data type
+
+4. Python lists can be made as a key in dictionaries.
+
+   a. True
+   #. False
+
+Answer: False
+
+5. Given a python dictionary ``x = {'a' : 1, 'b' : 2, 'c' : 3, 'd' :
+   4}``. When printed using ``print x`` will generate the output in
+   the order.  {key-value pair ``'a':1`` identified as a, ``'b':2``
+   identified as b and so on}
+
+   a. a, b, c, d
+   #. d, c, b, a
+   #. a, c, b, d
+   #. b, d, a, c
+   #. Cannot predict
+
+Answer: Cannot predict
+
+6. The python dictionary ``x = {'a' : ['a', 'b', 'c'], 'b' : (1, 2, 3),
+   1 : {1 : 'one', 2 : 'two'}, 10 : {10 : 'ten', 11 : 'eleven'}}`` is
+   invalid.
+
+   a. True
+   #. False
+
+Answer: False
+
+7. Consider the python dictionary ``x = {'a' : ['a','b','c'], 'b' :
+   (1, 2, 3), 1 : {1 : 'one', 2 : 'two'}, 10 : {10 : 'ten', 11 :
+   'eleven'}}``. And after applying the code below, what will be the
+   output of ``print x['a']``
+   ::
+
+      x['a'].extend(['d', 'e'])
+      x['a'][3] = x[10]
+
+   a. Code will result in error
+   #. ['a', 'b', 'c', {11: 'eleven', 10: 'ten'}, 'e']
+   #. {10 : 'ten', 11 : 'eleven'}
+   #. {10 : 'ten', 11 : 'eleven', 'a' : ['a', 'b', 'c']}
+   #. (1, 2, 3, ['a', 'b', 'c'])
+
+Answer: ['a', 'b', 'c', {11: 'eleven', 10: 'ten'}, 'e']
+
+8. Consider the python dictionary ``x = {'a' : ['a','b','c'], 'b' :
+   (1, 2, 3), 1 : {1 : 'one', 2 : 'two'}, 10 : {10 : 'ten', 11 :
+   'eleven'}}``. The code ``(1, 2, 3) in x.values()`` will return
+
+   a. True
+   #. False
+   #. Container-ship of values cannot be checked in dictionaries
+   #. The dictionary is invalid
+
+Answer: True
+
+Larger Questions
+----------------
+
+.. A minimum of 2 questions here (along with answers)
+
+1. Write a python script which can print the numbers from 1 to
+   999(both included) in words.
+
+2. Given the list of marks of students in a class, write a program to
+    find the duplicate marks. List the duplicate marks and also print
+    the number of duplicates for each.
+
+3. Given a list of words, find the anagrams in it and list them.
+    [meats, tap, steep, tames, hare, pets, had, apt, teams, dark,
+    dealer, once, rhea, cloud, step, steam, have, could, ounce, pest,
+    head, leader, cone, rare, rear, hear, pat, mates]
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dictionaries/script.rst	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,177 @@
+.. 8.4 LO: dictionaries (2)
+.. ------------------------
+.. * empty 
+.. * filled 
+.. * accessing via keys 
+.. * .values(), .keys() 
+.. * in 
+.. * iteration
+
+============
+Dictionaries
+============
+
+{{{ show the welcome slide }}}
+
+Welcome to the spoken tutorial on dictionaries.
+
+{{{ switch to next slide, outline slide }}}
+
+In this tutorial, we will see how to create empty dictionaries, learn
+about keys and values of dictionaries. Checking for elements and
+iterating over elements.
+
+{{{ switch to next slide on overview of dictionaries }}}
+
+A dictionary in general, is designed to look up meanings of
+words. Similarly, Python dictionary is also designed to look up for a
+specific key and retrieve the corresponding value. Dictionaries are
+data structures that provide key-value mappings.  Dictionaries are
+similar to lists except that instead of the values having integer
+indexes, dictionaries have keys or strings as indexes.
+
+Before we can proceed, start your IPython interpreter with the
+``-pylab`` option.
+
+{{{ start ipython interpreter by issuing command ipython -pylab }}}
+
+Let us start by creating an empty dictionary, type the following in
+your IPython interpreter.
+::
+
+    mt_dict = {}    
+
+Notice that unlike lists curly braces are used define ``dictionary``,
+
+{{{ move the mouse over curly braces to grab attention }}}
+
+Now let us see how to create a filled dictionary,
+::
+
+    extensions = {'jpg' : 'JPEG Image', 'py' : 'Python script', 'html' : 'Html document', 'pdf' : 'Portable Document Format'}
+
+Notice that each key-value pair is separated by a comma
+
+{{{ move the mouse over the commas to grab attention }}}
+
+and each key and value are separated using a colon.
+
+{{{ move the mouse over the colon one by one to grab attention }}}
+
+Here, we defined four entries in the dictionary extensions. The keys
+are
+
+{{{ spell the keys letter by letter }}}
+
+jpg, py, html, and pdf.
+
+Simply type,
+::
+
+    extensions
+
+in the interpreter to see the content of the dictionary. Notice that
+in dictionaries the order cannot be predicted and you can see that the
+values are not in the order that we entered in.
+
+Like in lists, the elements in a dictionary can be accessed using the
+index, here the index is the key. Try,
+::
+
+    print extensions['jpg']
+
+It printed JPEG Image. And now try,
+::
+
+    print extensions['zip']
+
+Well it gave us an error, saying that the key 'zip' is not in the
+dictionary.
+
+Pause here for some time and try few more keys. Also try jpg in
+capital letters.
+
+{{{ switch to next slide, adding and deleting keys and values in
+dictionaries }}}
+
+Well that was about creating dictionaries, now how do we add or delete
+items. We can add new items into dictionaries as,
+::
+
+    extensions['cpp'] = 'C++ code'
+
+and delete items using the ``del`` keyword as,
+::
+
+    del extension['pdf']
+
+Let us check the content of the dictionary now,
+::
+
+    extensions
+
+So the changes have been made. Now let us try one more thing,
+::
+
+    extensions['cpp'] = 'C++ source code'
+    extensions
+
+As you can see, it did not add a new thing nor gave an error, but it
+simply replaces the existing value with the new one.
+
+Now let us learn how to check if a particular key is present in the
+dictionary. For that we can use ``in``,
+::
+
+    'py' in extensions
+    'odt' in extensions
+
+So in short it will return ``True`` if the key is found in the
+dictionary, and will return ``False`` if key is not present. Note that
+we can check only for container-ship of keys in dictionaries and not
+values.
+
+{{{ switch to next slide, Retrieve keys and values }}}
+
+Now let us see how to retrieve the keys and values. We can use the
+method ``keys()`` for getting a list of the keys in a particular
+dictionary and the method ``values()`` for getting a list of
+values. Let us try them,
+::
+
+    extensions.keys()
+
+It returned the ``list`` of keys in the dictionary extensions. And now
+the other one,
+::
+
+    extensions.values()
+
+It returned the ``list`` of values in the dictionary.
+
+{{{ switch to next slide, problem statement for the next solved
+exercise }}}
+
+Now let us try to print the data in the dictionary. We can use ``for``
+loop to iterate.
+::
+
+    for each in extensions.keys():
+        print each, "-->", extensions[each]
+
+
+{{{ switch to next slide, recap }}}
+
+This brings us to the end of this tutorial, we learned dictionaries
+and saw how to create an empty dictionary, build a dictionary with
+some data in it, adding data, ``keys()`` and ``values()`` methods, and
+iterating over the dictionaries.
+
+{{{ switch to next slide, thank you slide }}}
+
+Thank you!
+
+..  Author: Anoop Jacob Thomas <anoop@fossee.in>
+    Reviewer 1:
+    Reviewer 2:
+    External reviewer:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/getting-started-with-arrays/questions.rst	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,132 @@
+Objective Questions
+-------------------
+
+.. A mininum of 8 questions here (along with answers)
+
+1. An array in Python is the same as a Python list
+
+   a. True
+   #. False
+
+Answer: False
+
+2. ``x = array([1, 2, 3], [5, 6, 7])`` is a valid statement
+
+   a. True
+   #. False
+
+Answer: False
+
+3. What will be the output of the following code,
+   ::
+
+      x = array([[1, 2, 3], ['a', 2, 'c']])
+      print x[0][0] + x[0][1] + x[0][2] 
+
+   a. 6
+   #. 123
+   #. a2c
+   #. Error as array takes only homogeneous elements
+
+Answer: 123
+      
+4. What will be the output of the following code,
+   ::
+
+	x = [[1, 2, 3], [4.1, 4.2, 4.3], ['6','7',8]]
+	y = array(x)
+	print y[-1][-2] + y[-1][-1] + y[-2][0] + y[0][-2]
+
+   a. 21.1
+   #. 12.5
+   #. 784.12
+   #. Error as array takes only homogeneous elements
+
+   .. 4.2 4.3 2 2
+
+Answer: 784.12
+
+5. What is the output of the following code,
+   ::
+
+      x = array([[1, 2, 3], ['a', 2, 'c']])
+      identity(x.shape)
+
+   a. Will create an identity matrix of shape (2, 3).
+   #. ``identity()`` function takes an integer as argument and a tuple
+      is passed.
+   #. Will return, array([[1,0,1],[0,1,0]])
+   #. Will return, array([[0,1,0],[0,1,0]])
+
+Answer: ``identity()`` function takes an integer as argument and a
+      	tuple is passed.
+
+6. ``ones_like()`` function?
+   
+   (A) Returns an array of ones with the same shape and type as a
+       given array.
+   (B) Return a new array of given shape and type, filled with ones.
+
+   Read the statements and answer,
+
+   a. Only statement A is correct.
+   #. Only statement B is correct.
+   #. Both statement A and B are correct.
+   #. Both statement A and B are incorrect.
+
+Answer: Only statement A is correct.
+
+7. ``zeros_like()`` function?
+
+   (A) Return a new array of given shape and type, filled with zeros.
+   (B) Returns an array of zeros with the same shape and type as a
+       given array.
+
+
+   Read the statements and answer,
+
+   a. Only statement A is correct.
+   #. Only statement B is correct.
+   #. Both statement A and B are correct.
+   #. Both statement A and B are incorrect.
+
+Answer: Only statement B is correct.
+
+8. What will be output of the following code snippet.
+   ::
+
+      x = linspace(1,10,10).reshape(5,2)
+      print (x[-3]+x[-4]).sum()
+
+   a. 10.0 
+   #. 18.0
+   #. 14.0
+   #. 16.44
+   #. Error
+
+Answer: 18
+
+Larger Questions
+----------------
+
+.. A minimum of 2 questions here (along with answers)
+
+1. Write a python script to create a 15x15 array of equally spaced 225
+   elements from 1 to 1000, add 5 to each of the diagonal elements and
+   find the sum of all odd rows of the array. Say for example the
+   array,
+   ::
+
+       x = array([[1, 2, 3],
+		  [4, 5, 6],
+		  [7, 8, 9]])
+
+   will give answer 40 ((1+5) + 2 + 3 + 7 + 8 + (9+5)).
+
+2. For any given array([a1, a2, a3, .. , an]) the Vandermonde matrix
+    will be [[1, a1, a1**2, .. , a1**(n-1)], [1, a2, a2**2, .. ,
+    a2**(n-1)], .. , [1, an, an**2, .. ,an**(n-1)]]. Write a python
+    script to generate the Vandermonde matrix and find the determinant
+    of the matrix for [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+    16, 17, 18, 19, 20].  [Hint: to find the determinant use the
+    function ``det()`` from ``linalg`` module.]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/getting-started-with-arrays/script.rst	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,242 @@
+.. 4.1 LO: getting started with arrays (2) [anoop] 
+.. ------------------------------------------------
+.. * why arrays 
+..   + speed - simply say 
+..   + array level operations 
+.. * creating arrays 
+..   + direct data 
+..   + list conversion 
+..   + homogeneous 
+..   + builtins - identitiy, zeros, 
+.. * array operations 
+..   + =+ - * /= 
+
+===========================
+Getting started with Arrays
+===========================
+
+{{{ show the welcome slide }}}
+
+Welcome to the spoken tutorial on getting started with arrays.
+
+{{{ switch to next slide, outline slide }}}
+
+In this tutorial, we will learn about arrays, how to convert a list
+into an array and also why an array is preferred over lists. And array
+operations.
+
+{{{ switch to next slide on overview of array }}}
+
+Arrays are homogeneous data structures, unlike lists, arrays cannot
+have heterogeneous data elements, that is, it can have only one type
+of data type, either all integers, or strings, or float, and not a
+mix.
+
+Arrays are really fast in mathematical operations when compared to
+lists, it is at least 80 to 100 times faster than lists.
+
+{{{ switch to the next slide, creating arrays }}}
+
+Now let us see how to create arrays.
+
+I am assuming that you have your IPython interpreter running with the
+``-pylab`` option, so that you have the required modules loaded.
+
+To create an array we will use the function ``array()`` as,
+::
+
+    a1 = array([1,2,3,4])
+
+Notice that here we created a one dimensional array. Also notice the
+object we passed to create an array. Now let us see how to create a
+two dimensional array. Pause here and try to do it yourself before
+looking at the solution.
+
+This is how we create two dimensional arrays.
+::
+
+    a2 = array([[1,2,3,4],[5,6,7,8]])
+
+Let us see an easy method of creating an array with elements 1 to 8.
+::
+
+    ar = arange(1,9)
+
+And it created a single dimensional array of elements from 1 to 8.
+::
+
+    print ar
+
+And how can we make it a two dimensional array of order 2 by 4. Pause
+here and try to do it yourself, try ``ar.tab`` and find a suitable
+method for that.
+
+We can use the function ``reshape()`` for that purpose and it can be
+done as,
+::
+
+    ar.reshape(2,4)
+    ar.reshape(4,2)
+    ar = ar.reshape(2,4)
+
+Now, let us see how to convert a list object to an array. As you have
+already seen, in both of the previous statements we have passed a
+list, so creating an array can be done so, first let us create a list
+``l1``
+::
+
+    l1 = [1,2,3,4]
+
+Now we can convert the list to an array as,
+::
+
+    a3 = array(l1)
+
+
+{{{ switch to the next slide, problem statement of unsolved exercise 1 }}}
+
+Create a three dimensional array of the order (2,2,4).
+
+{{{ switch to the next slide, shape of an array }}}
+
+To find the shape of an array we can use the object ``.shape``, let us
+check the shape of the arrays we have created so far,
+::
+
+    a1.shape
+
+``a1.shape`` object is a tuple, and since a1 is a single dimensional
+array, it returned a tuple (4,).
+
+{{{ switch to the next slide, unsolved exercise 2 }}}
+
+Find out the shape of the other two arrays that we have created.
+
+{{{ Array can have only a single type of data }}}
+
+Now let us try to create a new array with a mix of elements and see
+what will happen,
+::
+
+    a4 = array([1,2,3,'a string'])
+
+Well, we expected an error as previously I said that an array can have
+only homogeneous elements, but it didn't give an error. Let us check
+the values in the new array created. In your IPython terminal type,
+::
+
+    a4
+
+Did you notice it, 
+
+{{{ highlight all the array elements one by one using mouse 
+movements }}}
+
+all the elements have been implicitly type casted as string, though
+our first three elements were integers.
+
+{{{ switch to the next slide, identity & zeros methods }}}
+
+An identity matrix is a square matrix in which all the diagonal
+elements are one and rest of the elements zero. We can create an
+identity matrix using the method ``identity()``.
+
+The function ``identity()`` takes an integer argument,
+::
+
+    identity(3)
+
+As you can see the identity method returned a three by three square
+array with all the diagonal elements as one and the rest of the
+elements as zero.
+
+``zeros()`` function accepts a tuple, which is the order of the array
+we want to create, and it generates an array with all elements zero.
+
+{{{ switch to the next slide, problem statement of the solved exercise
+1 }}}
+
+Let us creates an array of the order four by five with all the
+elements zero. We can do it using the method zeros,
+::
+
+    zeros((4,5))
+
+Notice that we passed a tuple to the function zeros.
+
+{{{ switch to next slide, learning exercise }}}
+
+We learned two functions ``identity()`` and ``zeros()``, find out more
+about the functions ``zeros_like()``, ``ones()``, ``ones_like()``.
+
+{{{ switch to next slide, array operations }}}
+
+Try the following, first check the value of a1,
+::
+
+    a1
+
+``a1`` is a single dimensional array, and now try,
+::
+
+    a1 * 2
+
+It returned a new array with all the elements multiplied by 2.
+::
+
+    a1
+
+note that the value of a1 still remains the same.
+
+Similarly with addition,
+::
+
+    a1 + 2
+
+it returns a new array, with all the elements summed with two. But
+again notice that the value of a1 has not been changed.
+::
+
+    a1
+
+You may change the value of a1 by simply assigning the newly returned
+array as,
+::
+
+    a1 += 2
+
+Notice the change in elements of a,
+::
+
+    a
+
+We can use all the mathematical operations with arrays, Now let us try
+this
+::
+
+   a1 = array([1,2,3,4])
+   a2 = array([1,2,3,4])
+   a1 + a2
+
+Returns an array with element by element addition,
+::
+
+    a1 * a2
+
+Returns an array with element by element multiplication, notice that
+it does not perform matrix multiplication.
+
+{{{ switch to next slide, recap slide }}}
+
+So this brings us to the end of this tutorial, in this tutorial we
+covered basics of arrays, how to create an array, converting a list to
+an array, basic array operations etc.
+
+{{{ switch to next slide, thank you }}}
+
+Thank you!
+
+..  Author: Anoop Jacob Thomas <anoop@fossee.in>
+    Reviewer 1:
+    Reviewer 2:
+    External reviewer:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/getting-started-with-for/questions.rst	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,115 @@
+Objective Questions
+-------------------
+
+.. A mininum of 8 questions here (along with answers)
+
+1. In Python a block is represented by
+
+   a. Curly braces
+   #. Begin and End keywords
+   #. Indentation
+   #. Curly braces + Indentation
+   #. All of the above
+
+Answer: Indentation
+
+2. Indentation is not mandatory in Python
+
+   a. True
+   #. False
+
+Answer: False
+
+3. A ``for`` loop in Python,
+
+   a. is a simple iterator
+   #. is a condition based loop
+   #. can iterate only over integer list of elements
+   #. All of the above
+
+Answer: is a simple iterator
+
+4. ``range()`` function can generate negative numbers
+
+   a. True
+   #. False
+
+Answer: True
+
+5. ``range(a,b)`` function returns,
+
+   a. A tuple of elements from a to b including a and b
+   #. A tuple of elements from a to b excluding b
+   #. A list of elements from a to b including a and b
+   #. A list of elements from a to b excluding b
+
+Answer: A list of elements from a to b excluding b
+
+6. ``linspace(1,100,2)`` and ``range(1,100,2)`` produces the same output,
+
+   a. True
+   #. False
+
+Answer: False
+
+7. What is the output of the below code snippet?
+   ::
+
+     y = 1
+     for x in range(21):
+         y*=x
+     print y
+
+   a. Product of natural numbers up to 20(including)
+   #. Product of natural numbers up to 21(including)
+   #. Zero
+   #. Error
+
+Answer: Zero
+
+8. What is the output of the below code snippet?
+   ::
+
+    y = 1
+    for x in range(1,21):
+        y*=x
+    print y
+
+   a. Product of natural numbers up to 20(including)
+   #. Product of natural numbers up to 21(including)
+   #. Zero
+   #. Error
+
+Answer: Product of natural numbers up to 20(including)
+
+9. What is the output of the below code snippet?
+   ::
+
+    y = 1
+    for x in range(1,21)
+        y*=x
+    print y
+
+   a. Product of natural numbers up to 20(including)
+   #. Product of natural numbers up to 21(including)
+   #. Zero
+   #. Error
+
+Answer: Error
+
+Larger Questions
+----------------
+
+.. A minimum of 2 questions here (along with answers)
+
+1. Write a python script to calculate the sum of the first 1000
+    natural numbers?
+
+2. Write a python script to find out prime numbers up to 500.
+    [`hint`: a number ``A`` which is divisible by only ``1`` and ``A``
+    is a prime number.]
+
+3. Write a python script to find out the difference between the
+    square of sum of first 100 natural numbers and sum of squares of
+    first 100 natural numbers.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/getting-started-with-for/script.rst	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,273 @@
+.. 3.2 LO: getting started with =for= (2) [anoop] 
+.. -----------------------------------------------
+.. * blocks in python 
+..   + (indentation) 
+.. * blocks in ipython 
+..   + ... prompt 
+..   + hitting enter 
+.. * =for= with a list 
+.. * =range= function 
+
+=============================
+Getting started with for loop
+=============================
+
+{{{ show welcome slide }}}
+
+Hello and welcome to the tutorial getting started with ``for`` loop. 
+
+{{{ switch to next slide, outline slide }}}
+
+In this tutorial we will learn about ``for`` loops in python, and also
+learn how to write blocks of code in Python.
+
+.. #[Nishanth]: Instead of saying basics of indenting code,
+                say How to define code blocks in Python
+
+{{{ switch to next slide, about whitespaces }}}
+
+In Python whitespace is significant, and the blocks are visually
+separated.
+
+.. #[nishanth]: Simply tell how blocks are defined in python.
+                The details like braces are not used and its
+                advantages like neat code can be told after completely
+                explaining the indentation
+
+.. #[Amit]: Do you want to do that here. May be its better to talk about 
+   this after some initiation into the idea of blocks. 
+
+The best practice is to indent the code using four spaces.
+
+.. #[Nishanth]: Even this detail may be skipped. Simply say use 4 spaces
+                for indentation. Do that while typing so that they can
+                actually see what is being typed.
+
+Now let us move straight into ``for`` loop.
+
+{{{ switch to next slide, problem statement of exercise 1 }}}
+
+
+Write a for loop which iterates through a list of numbers and find the
+square root of each number.
+::
+
+    numbers are 1369, 7225, 3364, 7056, 5625, 729, 7056, 576, 2916
+
+.. #[nishanth]: making new list with square roots induces extra complication
+                like appending which has no use case here
+
+.. #[Nishanth]: The problem focuses more on square root and creation
+                of list. The problem must be simple and focusing on 
+                nothing more but the indentation and for loop.
+                May be change the problem to print squares than to
+                print square roots.
+
+For the problem, first we need to create a ``list`` of numbers and
+then iterate over the list and find the square root of each element in
+it. And let us create a script, rather than typing it out in the
+interpreter itself. Create a script called list_roots.py and type the
+following.
+
+{{{ open the text editor and paste the following code there }}}
+::
+
+    numbers = [1369, 7225, 3364, 7056, 5625, 729, 7056, 576, 2916]
+    for each in numbers:
+        print "Square root of", each, "is", sqrt(each)
+    print "This is not in for loop!"
+
+..  numbers = [1, 12, 3, 4, 21, 17]
+    for each in numbers:
+        print each, each * each
+
+.. #[nishanth]: I don't see a use case to append the sq_root to
+                square_roots. It is only complicating stuff.
+                Simply iterate and print.
+
+{{{ save the script }}}
+
+Now save the script, and run it from your IPython interpreter. I
+assume that you have started your IPython interpreter using ``-pylab``
+option.
+
+Run the script as,
+::
+
+    %run -i list_roots.py
+
+.. #[Nishanth]: you don't have to use the -i option here
+
+{{{ run the script }}}
+
+So that was easy! All what we did was iterate over the list element by
+element and then use the element for calculation. Note that here we
+used two variables. One the variable ``numbers``, which is a list,
+another one ``each``, which is the element of list under consideration
+in each cycle of the ``for`` loop. The variable names can be chosen by
+you.
+
+.. #[Nishanth]: The details like we didn't have to find the length
+                are relevant for people who have programmed in C or
+                other languages earlier. But for a newbie it is more
+                of confusing extra info. That part may be skipped.
+                Simply go ahead and focus on the syntax of for loop.
+                And how the variable name is used inside the for loop.
+                If you modify the question to only print, the extra 
+                variable sq_root can also be avoided. let it be more
+                about "each", "numbers" and "for". no other new names.
+
+{{{ show the script which was created }}}
+
+Note that the lines after ``for`` statement, is indented using four
+spaces.
+
+{{{ highlight the line after for statement }}}
+
+It means that line is part of the for loop. And it is a block of code,
+although it is only a single statement in the block. And the fourth
+line or the immediate line after the ``for`` block is not indented,
+
+{{{ highlight the fourth line - the line just after for loop }}}
+
+it means that it is not part of the ``for`` loop and the lines after
+that doesn't fall in the scope of the ``for`` loop. Thus each block is
+separated by the indentation level. Thus marking the importance of
+white-spaces in Python.
+
+{{{ switch to the slide which shows the problem statement of the first
+problem to be tried out }}}
+
+Now a question for you to try, from the given numbers make a list of
+perfect squares and a list of those which are not. The numbers are,
+::
+    
+    7225, 3268, 3364, 2966, 7056, 5625, 729, 5547, 7056, 576, 2916
+
+{{{ switch to next slide, problem statement of second problem in
+solved exercise}}}
+
+Now let us try a simple one, to print the square root of numbers in
+the list. And this time let us do it right in the IPython
+interpreter. 
+
+{{{ switch focus to the IPython interpreter }}}
+
+So let us start with making a list. Type the following
+::
+
+    numbers = [1369, 7225, 3364, 7056, 5625, 729, 7056, 576, 2916]
+    for each in numbers:
+
+and now you will notice that, as soon as you press the return key
+after for statement, the prompt changes to four dots and the cursor is
+not right after the four dots but there are four spaces from the
+dots. Please note that IPython automatically indents the block. The
+four dots tell you that you are inside a block. Now type the rest of
+the ``for`` loop,
+
+.. #[Nishanth]: Tell that IPython does auto indentation.
+
+::
+
+        print "Square root of", each, "is", sqrt(each)
+
+Now we have finished the statements in the block, and still the
+interpreter is showing four dots, which means you are still inside the
+block. To exit from the block press return key or the enter key twice
+without entering anything else. It printed the square root of each
+number in the list, and that is executed in a ``for`` loop.
+
+Now, let us find the cube of all the numbers from one to ten. But this
+time let us try it in the vanilla version of Python interpreter.
+
+Start the vanilla version of Python interpreter by issuing the command
+``python`` in your terminal.
+
+{{{ open the python interpreter in the terminal using the command
+python to start the vanilla Python interpreter }}}
+
+Start with,
+::
+    
+    for i in range(1,11):
+
+and press enter once, and we will see that this time it shows four
+dots, but the cursor is close to the dots, so we have to indent the
+block. The vanilla version of Python interpreter does not indent the
+code automatically. So enter four spaces there and then type the
+following
+::
+    
+        print i, "cube is", i**3
+
+Now when we hit enter, we still see the four dots, to get out of the
+block, hit enter once again
+
+.. #[Nishanth]: Here also the overhead on print can be reduced.
+                Think of a simple print statement. This statement
+                will be confusing for a newbie.
+                We can focus more on indentation in python.
+
+.. #[nishanth]: Not sure if you must use range here. You can 
+                define a list of numbers and iterate on it.
+                Then say this list can also be generated using
+                the range function and hence introduce range.
+
+Okay! so the main thing here we learned is how to use Python
+interpreter and IPython interpreter to specify blocks. But while we
+were generating the multiplication table we used something new,
+``range()`` function. ``range()`` is an inbuilt function in Python
+which can be used to generate a ``list`` of integers from a starting
+number to an ending number. Note that the ending number that you
+specify will not be included in the ``list``.
+
+.. #[Nishanth]: Show some examples of range without the step argument
+                May be give an exercise with negative numbers as arguments
+
+Now, let us print all the odd numbers from 1 to 50. Let us do it in
+our IPython interpreter for ease of use.
+
+{{{ switch to next slide, problem statement of the next problem in
+solved exercises }}}
+
+{{{ switch focus to ipython interpreter }}}
+
+The problem can be solved by just using the ``range()`` function.
+
+It can be solved as,
+::
+
+    print range(1,51,2)
+
+This time we passed three parameters to ``range()`` function unlike
+the previous case where we passed only two parameters. The first two
+parameters are the same in both the cases. The first parameter is the
+starting number of the sequence and the second parameter is the end of
+the range. Note that the sequence doesn't include the ending
+number. The third parameter is for stepping through the sequence. Here
+we gave two which means we are skipping every alternate element.
+
+{{{ switch to next slide, recap slide }}}
+
+Thus we come to the end of this tutorial. We learned about blocks in
+Python, indentation, blocks in IPython, for loop, iterating over a
+list and then the ``range()`` function.
+
+.. #[Amit]: There does seem to too much overhead of details. Should
+            the first example be done using script is it necessary. 
+	    Do add some things in evolutionary manner. Like introducing 
+	    range as a list and doing a very very simple for loop.Like
+	    iterating over [1,2,3] .Before getting into a problem.
+	    And club details about problem in one paragraph and syntactic details
+	    in other.
+
+{{{ switch to next slide, thank you slide }}}
+
+Thank you!
+
+..  Author: Anoop Jacob Thomas <anoop@fossee.in>
+    Reviewer 1: Nishanth
+    Reviewer 2: Amit Sethi
+    External reviewer:
+
--- a/getting_started_with_arrays.rst	Fri Oct 08 16:11:20 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,213 +0,0 @@
-.. 4.1 LO: getting started with arrays (2) [anoop] 
-.. ------------------------------------------------
-.. * why arrays 
-..   + speed - simply say 
-..   + array level operations 
-.. * creating arrays 
-..   + direct data 
-..   + list conversion 
-..   + homogeneous 
-..   + builtins - identitiy, zeros, 
-.. * array operations 
-..   + =+ - * /= 
-
-===========================
-Getting started with Arrays
-===========================
-
-{{{ show the welcome slide }}}
-
-Welcome to the spoken tutorial on getting started with arrays.
-
-{{{ switch to next slide, outline slide }}}
-
-In this tutorial, we will learn about arrays, how to convert a list
-into an array and also why an array is preferred over lists. And array
-operations.
-
-{{{ switch to next slide on overview of array }}}
-
-Arrays are homogeneous data structures, unlike lists, arrays cannot
-have heterogeneous data elements, that is, it can have only one type
-of data type, either all integers, or strings, or float, and not a
-mix.
-
-Arrays are really fast in mathematical operations when compared to
-lists, it is at least 80 to 100 times faster than lists.
-
-{{{ switch to the next slide, creating arrays }}}
-
-I am assuming that you have your IPython interpreter running with the
-``-pylab`` option, so that you have the required modules loaded.
-
-To create an array we will use the function ``array()`` as,
-::
-
-    a1 = array([1,2,3,4])
-
-Notice that here we created a one dimensional array. Also notice the
-object we passed to create an array. Now let us see how to create a
-two dimensional array.
-::
-
-    a2 = array([[1,2,3,4],[5,6,7,8]])
-
-Now, let us see how to convert a list object to an array. As you have
-already seen, in both of the previous statements we have passed a
-list, so creating an array can be done so, first let us create a list
-``l1``
-::
-
-    l1 = [1,2,3,4]
-
-Now we can convert the list to an array as,
-::
-
-    a3 = array(l1)
-
-
-{{{ switch to the next slide, problem statement of unsolved exercise 1 }}}
-
-Create a three dimensional array of the order (2,2,4).
-
-{{{ switch to the next slide, shape of an array }}}
-
-To find the shape of an array we can use the object ``.shape``, let us
-check the shape of the arrays we have created so far,
-::
-
-    a1.shape
-
-``a1.shape`` object is a tuple, and since a1 is a single dimensional
-array, it returned a tuple (4,).
-
-{{{ switch to the next slide, unsolved exercise 2 }}}
-
-Find out the shape of the other two arrays that we have created.
-
-{{{ Array can have only a single type of data }}}
-
-Now let us try to create a new array with a mix of elements and see
-what will happen,
-::
-
-    a4 = array([1,2,3,'a string'])
-
-Well, we expected an error as previously I said that an array can have
-only homogeneous elements, but it didn't give an error. Let us check
-the values in the new array created. In your IPython terminal type,
-::
-
-    a4
-
-Did you notice it, 
-
-{{{ highlight all the array elements one by one using mouse 
-movements }}}
-
-all the elements have been implicitly type casted as string, though
-our first three elements were integers.
-
-{{{ switch to the next slide, identity & zeros methods }}}
-
-An identity matrix is a square matrix in which all the diagonal
-elements are one and rest of the elements zero. We can create an
-identity matrix using the method ``identity()``.
-
-The function ``identity()`` takes an integer argument,
-::
-
-    identity(3)
-
-As you can see the identity method returned a three by three square
-array with all the diagonal elements as one and the rest of the
-elements as zero.
-
-``zeros()`` function accepts a tuple, which is the order of the array
-we want to create, and it generates an array with all elements zero.
-
-{{{ switch to the next slide, problem statement of the solved exercise
-1 }}}
-
-Let us creates an array of the order four by five with all the
-elements zero. We can do it using the method zeros,
-::
-
-    zeros((4,5))
-
-Notice that we passed a tuple to the function zeros.
-
-{{{ switch to next slide, learning exercise }}}
-
-We learned two functions ``identity()`` and ``zeros()``, find out more
-about the functions ``zeros_like()``, ``ones()``, ``ones_like()``.
-
-{{{ switch to next slide, array operations }}}
-
-Try the following, first check the value of a1,
-::
-
-    a1
-
-``a1`` is a single dimensional array, and now try,
-::
-
-    a1 * 2
-
-It returned a new array with all the elements multiplied by 2.
-::
-
-    a1
-
-note that the value of a1 still remains the same.
-
-Similarly with addition,
-::
-
-    a1 + 2
-
-it returns a new array, with all the elements summed with two. But
-again notice that the value of a1 has not been changed.
-::
-
-    a1
-
-You may change the value of a1 by simply assigning the newly returned
-array as,
-::
-
-    a1 += 2
-
-Notice the change in elements of a,
-::
-
-    a
-
-We can use all the mathematical operations with arrays, Now let us try
-this
-::
-
-   a1 = array([1,2,3,4])
-   a2 = array([1,2,3,4])
-   a1 + a2
-
-Returns an array with element by element addition,
-::
-
-    a1 * a2
-
-Returns an array with element by element multiplication, notice that
-it does not perform matrix multiplication.
-
-{{{ switch to next slide, recap slide }}}
-
-So this brings us to the end of this tutorial, in this tutorial we covered basics of arrays, how to create an array, converting a list to an array, basic array operations etc.
-
-{{{ switch to next slide, thank you }}}
-
-Thank you!
-
-..  Author: Anoop Jacob Thomas <anoop@fossee.in>
-    Reviewer 1:
-    Reviewer 2:
-    External reviewer:
--- a/getting_started_with_for.rst	Fri Oct 08 16:11:20 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,272 +0,0 @@
-.. 3.2 LO: getting started with =for= (2) [anoop] 
-.. -----------------------------------------------
-.. * blocks in python 
-..   + (indentation) 
-.. * blocks in ipython 
-..   + ... prompt 
-..   + hitting enter 
-.. * =for= with a list 
-.. * =range= function 
-
-=============================
-Getting started with for loop
-=============================
-
-{{{ show welcome slide }}}
-
-Hello and welcome to the tutorial getting started with ``for`` loop. 
-
-{{{ switch to next slide, outline slide }}}
-
-In this tutorial we will learn about ``for`` loops in python, and also
-learn how to write blocks of code in Python.
-
-.. #[Nishanth]: Instead of saying basics of indenting code,
-                say How to define code blocks in Python
-
-{{{ switch to next slide, about whitespaces }}}
-
-In Python whitespace is significant, and the blocks are visually
-separated.
-
-.. #[nishanth]: Simply tell how blocks are defined in python.
-                The details like braces are not used and its
-                advantages like neat code can be told after completely
-                explaining the indentation
-
-.. #[Amit]: Do you want to do that here. May be its better to talk about 
-   this after some initiation into the idea of blocks. 
-
-The best practice is to indent the code using four spaces.
-
-.. #[Nishanth]: Even this detail may be skipped. Simply say use 4 spaces
-                for indentation. Do that while typing so that they can
-                actually see what is being typed.
-
-Now let us move straight into ``for`` loop.
-
-{{{ switch to next slide, problem statement of exercise 1 }}}
-
-
-Write a for loop which iterates through a list of numbers and find the
-square root of each number.
-::
-
-    numbers are 1369, 7225, 3364, 7056, 5625, 729, 7056, 576, 2916
-
-.. #[nishanth]: making new list with square roots induces extra complication
-                like appending which has no use case here
-
-.. #[Nishanth]: The problem focuses more on square root and creation
-                of list. The problem must be simple and focusing on 
-                nothing more but the indentation and for loop.
-                May be change the problem to print squares than to
-                print square roots.
-
-For the problem, first we need to create a ``list`` of numbers and
-then iterate over the list and find the square root of each element in
-it. And let us create a script, rather than typing it out in the
-interpreter itself. Create a script called list_roots.py and type the
-following.
-
-{{{ open the text editor and paste the following code there }}}
-::
-
-    numbers = [1369, 7225, 3364, 7056, 5625, 729, 7056, 576, 2916]
-    for each in numbers:
-        print "Square root of", each, "is", sqrt(each)
-    print "This is not in for loop!"
-
-..  numbers = [1, 12, 3, 4, 21, 17]
-    for each in numbers:
-        print each, each * each
-
-.. #[nishanth]: I don't see a use case to append the sq_root to
-                square_roots. It is only complicating stuff.
-                Simply iterate and print.
-
-{{{ save the script }}}
-
-Now save the script, and run it from your IPython interpreter. I
-assume that you have started your IPython interpreter using ``-pylab``
-option.
-
-Run the script as,
-::
-
-    %run -i list_roots.py
-
-.. #[Nishanth]: you don't have to use the -i option here
-
-{{{ run the script }}}
-
-So that was easy! All what we did was iterate over the list element by
-element and then use the element for calculation. Note that here we
-used two variables. One the variable ``numbers``, which is a list,
-another one ``each``, which is the element of list under consideration
-in each cycle of the ``for`` loop. The variable names can be chosen by
-you.
-
-.. #[Nishanth]: The details like we didn't have to find the length
-                are relevant for people who have programmed in C or
-                other languages earlier. But for a newbie it is more
-                of confusing extra info. That part may be skipped.
-                Simply go ahead and focus on the syntax of for loop.
-                And how the variable name is used inside the for loop.
-                If you modify the question to only print, the extra 
-                variable sq_root can also be avoided. let it be more
-                about "each", "numbers" and "for". no other new names.
-
-{{{ show the script which was created }}}
-
-Note that the lines after ``for`` statement, is indented using four
-spaces.
-
-{{{ highlight the line after for statement }}}
-
-It means that line is part of the for loop. And it is a block of code,
-although it is only a single statement in the block. And the fourth
-line or the immediate line after the ``for`` block is not indented,
-
-{{{ highlight the fourth line - the line just after for loop }}}
-
-it means that it is not part of the ``for`` loop and the lines after
-that doesn't fall in the scope of the ``for`` loop. Thus each block is
-separated by the indentation level. Thus marking the importance of
-white-spaces in Python.
-
-{{{ switch to the slide which shows the problem statement of the first
-problem to be tried out }}}
-
-Now a question for you to try, from the given numbers make a list of
-perfect squares and a list of those which are not. The numbers are,
-::
-    
-    7225, 3268, 3364, 2966, 7056, 5625, 729, 5547, 7056, 576, 2916
-
-{{{ switch to next slide, problem statement of second problem in
-solved exercise}}}
-
-Now let us try a simple one, to print the square root of numbers in
-the list. And this time let us do it right in the IPython
-interpreter. 
-
-{{{ switch focus to the IPython interpreter }}}
-
-So let us start with making a list. Type the following
-::
-
-    numbers = [1369, 7225, 3364, 7056, 5625, 729, 7056, 576, 2916]
-    for each in numbers:
-
-and now you will notice that, as soon as you press the return key
-after for statement, the prompt changes to four dots and the cursor is
-not right after the four dots but there are four spaces from the
-dots. Please note that IPython automatically indents the block. The
-four dots tell you that you are inside a block. Now type the rest of
-the ``for`` loop,
-
-.. #[Nishanth]: Tell that IPython does auto indentation.
-
-::
-
-        print "Square root of", each, "is", sqrt(each)
-
-Now we have finished the statements in the block, and still the
-interpreter is showing four dots, which means you are still inside the
-block. To exit from the block press return key or the enter key twice
-without entering anything else. It printed the square root of each
-number in the list, and that is executed in a ``for`` loop.
-
-Now, let us find the cube of all the numbers from one to ten. But this
-time let us try it in the vanilla version of Python interpreter.
-
-Start the vanilla version of Python interpreter by issuing the command
-``python`` in your terminal.
-
-{{{ open the python interpreter in the terminal using the command
-python to start the vanilla Python interpreter }}}
-
-Start with,
-::
-    
-    for i in range(1,11):
-
-and press enter once, and we will see that this time it shows four
-dots, but the cursor is close to the dots, so we have to indent the
-block. The vanilla version of Python interpreter does not indent the
-code automatically. So enter four spaces there and then type the
-following
-::
-    
-        print i, "cube is", i**3
-
-Now when we hit enter, we still see the four dots, to get out of the
-block, hit enter once again
-
-.. #[Nishanth]: Here also the overhead on print can be reduced.
-                Think of a simple print statement. This statement
-                will be confusing for a newbie.
-                We can focus more on indentation in python.
-
-.. #[nishanth]: Not sure if you must use range here. You can 
-                define a list of numbers and iterate on it.
-                Then say this list can also be generated using
-                the range function and hence introduce range.
-
-Okay! so the main thing here we learned is how to use Python
-interpreter and IPython interpreter to specify blocks. But while we
-were generating the multiplication table we used something new,
-``range()`` function. ``range()`` is an inbuilt function in Python
-which can be used to generate a ``list`` of integers from a starting
-number to an ending number. Note that the ending number that you
-specify will not be included in the ``list``.
-
-.. #[Nishanth]: Show some examples of range without the step argument
-                May be give an exercise with negative numbers as arguments
-
-Now, let us print all the odd numbers from 1 to 50. Let us do it in
-our IPython interpreter for ease of use.
-
-{{{ switch to next slide, problem statement of the next problem in
-solved exercises }}}
-
-{{{ switch focus to ipython interpreter }}}
-
-The problem can be solved by just using the ``range()`` function.
-
-It can be solved as,
-::
-
-    print range(1,51,2)
-
-This time we passed three parameters to ``range()`` function unlike
-the previous case where we passed only two parameters. The first two
-parameters are the same in both the cases. The first parameter is the
-starting number of the sequence and the second parameter is the end of
-the range. Note that the sequence doesn't include the ending
-number. The third parameter is for stepping through the sequence. Here
-we gave two which means we are skipping every alternate element.
-
-{{{ switch to next slide, recap slide }}}
-
-Thus we come to the end of this tutorial. We learned about blocks in
-Python, indentation, blocks in IPython, for loop, iterating over a
-list and then the ``range()`` function.
-
-.. #[Amit]: There does seem to too much overhead of details. Should
-            the first example be done using script is it necessary. 
-	    Do add some things in evolutionary manner. Like introducing 
-	    range as a list and doing a very very simple for loop.Like
-	    iterating over [1,2,3] .Before getting into a problem.
-	    And club details about problem in one paragraph and syntactic details
-	    in other.
-
-{{{ switch to next slide, thank you slide }}}
-
-Thank you!
-
-..  Author: Anoop Jacob Thomas <anoop@fossee.in>
-    Reviewer 1: Nishanth
-    Reviewer 2: Amit Sethi
-    External reviewer:
--- a/gettings_started_with_for.rst	Fri Oct 08 16:11:20 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,217 +0,0 @@
-.. 3.2 LO: getting started with =for= (2) [anoop] 
-.. -----------------------------------------------
-.. * blocks in python 
-..   + (indentation) 
-.. * blocks in ipython 
-..   + ... prompt 
-..   + hitting enter 
-.. * =for= with a list 
-.. * =range= function 
-
-=============================
-Getting started with for loop
-=============================
-
-{{{ show welcome slide }}}
-
-Hello and welcome to the tutorial getting started with ``for`` loop. 
-
-{{{ switch to next slide, outline slide }}}
-
-In this tutorial we will see ``for`` loops in python, and also cover
-the basics of indenting code in python.
-
-{{{ switch to next slide, about whitespaces }}}
-
-In Python whitespace is significant, and the blocks are visually
-separated rather than using braces or any other mechanisms for
-defining blocks. And by this method Python forces the programmers to
-stick on to one way of writing or beautifying the code rather than
-debating over where to place the braces. This way it produces uniform
-code than obscure or unreadable code.
-
-A block may be defined by a suitable indentation level which can be
-either be a tab or few spaces. And the best practice is to indent the
-code using four spaces.
-
-Now let us move straight into ``for`` loop.
-
-{{{ switch to next slide,  problem statement of exercise 1 }}}
-
-Write a for loop which iterates through a list of numbers and find the
-square root of each number. Also make a new list with the square roots
-and print it at the end.
-::
-
-    numbers are 1369, 7225, 3364, 7056, 5625, 729, 7056, 576, 2916
-
-For the problem, first we need to create a ``list`` of numbers and
-then iterate over the list and find the square root of each element in
-it. And let us create a script, rather than typing it out in the
-interpreter itself. Create a script called list_roots.py and type the
-following.
-
-{{{ open the text editor and paste the following code there }}}
-::
-
-    numbers = [1369, 7225, 3364, 7056, 5625, 729, 7056, 576, 2916]
-    square_roots = []
-    for each in numbers:
-        sq_root = sqrt(each)
-        print "Square root of", each, "is", sq_root
-        square_roots.append(sq_root)
-    print 
-    print square_roots
-
-{{{ save the script }}}
-
-Now save the script, and run it from your IPython interpreter. I
-assume that you have started your IPython interpreter using ``-pylab``
-option.
-
-Run the script as,
-::
-
-    %run -i list_roots.py
-
-{{{ run the script }}}
-
-So that was easy! We didn't have to find the length of the string nor
-address of each element of the list one by one. All what we did was
-iterate over the list element by element and then use the element for
-calculation. Note that here we used three variables. One the variable
-``numbers``, which is a list, another one ``each``, which is the
-element of list under consideration in each cycle of the ``for`` loop,
-and then a variable ``sq_root`` for storing the square root in each
-cycle of the ``for`` loop. The variable names can be chosen by you.
-
-{{{ show the script which was created }}}
-
-Note that three lines after ``for`` statement, are indented using four
-spaces.
-
-{{{ highlight the threee lines after for statement }}}
-
-It means that those three lines are part of the for loop. And it is
-called a block of statements. And the seventh line or the immediate
-line after the third line in the ``for`` loop is not indented, 
-
-{{{ highlight the seventh line - the line just after for loop }}}
-
-it means that it is not part of the ``for`` loop and the lines after
-that doesn't fall in the scope of the ``for`` loop. Thus each block is
-separated by the indentation level. Thus marking the importance of
-white-spaces in Python.
-
-{{{ switch to the slide which shows the problem statement of the first
-problem to be tried out }}}
-
-Now a question for you to try, from the given numbers make a list of
-perfect squares and a list of those which are not. The numbers are,
-::
-    
-    7225, 3268, 3364, 2966, 7056, 5625, 729, 5547, 7056, 576, 2916
-
-{{{ switch to next slide, problem statement of second problem in
-solved exercie}}}
-
-Now let us try a simple one, to print the square root of numbers in
-the list. And this time let us do it right in the IPython
-interpreter. 
-
-{{{ switch focus to the IPython interpreter }}}
-
-So let us start with making a list. Type the following
-::
-
-    numbers = [1369, 7225, 3364, 7056, 5625, 729, 7056, 576, 2916]
-    for each in numbers:
-
-and now you will notice that, as soon as you press the return key
-after for statement, the prompt changes to four dots and the cursor is
-not right after the four dots but there are four spaces from the
-dots. The four dots tell you that you are inside a block. Now type the
-rest of the ``for`` loop,
-::
-
-        sq_root = sqrt(each)
-        print "Square root of", each, "is", sq_root
-
-Now we have finished the statements in the block, and still the
-interpreter is showing four dots, which means you are still inside the
-block. To exit from the block press return key or the enter key twice
-without entering anything else. It printed the square root of each
-number in the list, and that is executed in a ``for`` loop.
-
-Now, let us generate the multiplication table of 10 from one to
-ten. But this time let us try it in the vanilla version of Python
-interpreter.
-
-Start the vanilla version of Python interpreter by issuing the command
-``python`` in your terminal.
-
-{{{ open the python interpreter in the terminal using the command
-python to start the vanilla Python interpreter }}}
-
-Start with,
-::
-    
-    for i in range(1,11):
-
-and press enter once, and we will see that this time it shows four
-dots, but the cursor is close to the dots, so we have to intend the
-block. So enter four spaces there and then type the following
-::
-    
-    
-        print "10 *",i,"=",i*10
-
-Now when we hit enter, we still see the four dots, to get out of the
-block type enter once.
-
-Okay! so the main thing here we learned is how to use Python
-interpreter and IPython interpreter to specify blocks. But while we
-were generating the multiplication table we used something new,
-``range()`` function. ``range()`` is an inbuilt function in Python
-which can be used to generate a ``list`` of integers from a starting
-range to an ending range. Note that the ending number that you specify
-will not be included in the ``list``.
-
-Now, let us print all the odd numbers from 1 to 50. Let us do it in
-our IPython interpreter for ease of use.
-
-{{{ switch focus to ipython interpreter }}}
-
-{{{ switch to next slide, problem statement of the next problem in
-solved exercises }}}
-
-Print the list of odd numbers from 1 to 50. It will be better if
-you can try it out yourself.
-
-It is a very trivial problem and can be solved as,
-::
-
-    print range(1,51,2)
-
-This time we passed three parameters to ``range()`` function unlike
-the previous case where we passed only two parameters. The first two
-parameters are the same in both the cases. The first parameter is the
-starting number of the sequence and the second parameter is the end of
-the range. Note that the sequence doesn't include the ending
-number. The third parameter is for stepping through the sequence. Here
-we gave two which means we are skipping every alternate element.
-
-{{{ switch to next slide, recap slide }}}
-
-Thus we come to the end of this tutorial. We learned about blocks in
-Python, indentation, blocks in IPython, for loop, iterating over a
-list and then the ``range()`` function.
-
-{{{ switch to next slide, thank you slide }}}
-
-Thank you!
-
-..  Author: Anoop Jacob Thomas <anoop@fossee.in>
-    Reviewer 1:
-    Reviewer 2:
-    External reviewer:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/matrices/questions.rst	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,32 @@
+Objective Questions
+-------------------
+
+.. A mininum of 8 questions here (along with answers)
+
+
+Larger Questions
+----------------
+
+.. A minimum of 2 questions here (along with answers)
+
+1. Consider an array [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].  A fold and add
+   operation consist of two phases, a right fold and add and a left
+   fold and add.
+
+   Say in first fold and add, we take the right fold of the array and
+   add it to the left like,
+
+   [1+10, 2+9, 3+8, 4+7, 5+6, 6, 7, 8, 9, 10]
+
+   and it becomes
+
+   [11, 11, 11, 11, 11, 6, 7, 8, 9, 10]
+
+   and in the second fold and add, we take the left fold of the new
+   array and add it to the right and it becomes,
+
+   [11, 11, 11, 11, 11, 17, 18, 19, 20, 21].
+
+   What will be the array after 22 such operations starting with [1,
+   2, 3, 4, 5, 6, 7, 8, 9, 10]
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/matrices/script.rst	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,265 @@
+.. 4.3 LO: Matrices (3) [anoop] 
+.. -----------------------------
+.. * creating matrices 
+..   + direct data 
+..   + list conversion 
+..   + builtins - identitiy, zeros, 
+.. * matrix operations 
+..   + + - * / 
+..   + dot 
+..   + inv 
+..   + det 
+..   + eig 
+..   + norm 
+..   + svd 
+
+========
+Matrices
+========
+{{{ show the welcome slide }}}
+
+Welcome to the spoken tutorial on Matrices.
+
+{{{ switch to next slide, outline slide }}}
+
+In this tutorial we will learn about matrices, creating matrices and
+matrix operations.
+
+{{{ creating a matrix }}}
+
+All matrix operations are done using arrays. Thus all the operations
+on arrays are valid on matrices also. A matrix may be created as,
+::
+
+    m1 = matrix([1,2,3,4])
+
+Using the tuple ``m1.shape`` we can find out the shape or size of the
+matrix,
+::
+
+    m1.shape
+
+Since it is a one row four column matrix it returned a tuple, one by
+four.
+
+A list can be converted to a matrix as follows,
+::
+
+    l1 = [[1,2,3,4],[5,6,7,8]]
+    m2 = matrix(l1)
+
+Note that all matrix operations are done using arrays, so a matrix may
+also be created as
+::
+
+    m3 = array([[5,6,7,8],[9,10,11,12]])
+
+{{{ switch to next slide, matrix operations }}}
+
+We can do matrix addition and subtraction as,
+::
+
+    m3 + m2
+
+does element by element addition, thus matrix addition.
+
+Similarly,
+::
+
+    m3 - m2
+
+it does matrix subtraction, that is element by element
+subtraction. Now let us try,
+::
+
+    m3 * m2
+
+Note that in arrays ``array(A) star array(B)`` does element wise
+multiplication and not matrix multiplication, but unlike arrays, the
+operation ``matrix(A) star matrix(B)`` does matrix multiplication and
+not element wise multiplication. And in this case since the sizes are
+not compatible for multiplication it returned an error.
+
+And element wise multiplication in matrices are done using the
+function ``multiply()``
+::
+
+    multiply(m3,m2)
+
+Now let us see an example for matrix multiplication. For doing matrix
+multiplication we need to have two matrices of the order n by m and m
+by r and the resulting matrix will be of the order n by r. Thus let us
+first create two matrices which are compatible for multiplication.
+::
+
+    m1.shape
+
+matrix m1 is of the shape one by four, let us create another one of
+the order four by two,
+::
+
+    m4 = matrix([[1,2],[3,4],[5,6],[7,8]])
+    m1 * m4
+
+thus unlike in array object ``star`` can be used for matrix multiplication
+in matrix object.
+
+{{{ switch to next slide, recall from arrays }}}
+
+As we already saw in arrays, the functions ``identity()``,
+``zeros()``, ``zeros_like()``, ``ones()``, ``ones_like()`` may also be
+used with matrices.
+
+{{{ switch to next slide, matrix operations }}}
+
+To find out the transpose of a matrix we can do,
+::
+
+    print m4
+    m4.T
+
+Matrix name dot capital T will give the transpose of a matrix
+
+{{{ switch to next slide, Euclidean norm of inverse of matrix }}}
+
+Now let us try to find out the Euclidean norm of inverse of a 4 by 4
+matrix, the matrix being,
+::
+
+    m5 = matrix(arange(1,17).reshape(4,4))
+    print m5
+
+The inverse of a matrix A, A raise to minus one is also called the
+reciprocal matrix such that A multiplied by A inverse will give 1. The
+Euclidean norm or the Frobenius norm of a matrix is defined as square
+root of sum of squares of elements in the matrix. Pause here and try
+to solve the problem yourself, the inverse of a matrix can be found
+using the function ``inv(A)``.
+
+And here is the solution, first let us find the inverse of matrix m5.
+::
+
+    im5 = inv(m5)
+
+And the euclidean norm of the matrix ``im5`` can be found out as,
+::
+
+    sum = 0
+    for each in array(im5.flatten())[0]:
+        sum += each * each
+    print sqrt(sum)
+
+{{{ switch to next slide, infinity norm }}}
+
+Now try to find out the infinity norm of the matrix im5. The infinity
+norm of a matrix is defined as the maximum value of sum of the
+absolute of elements in each row. Pause here and try to solve the
+problem yourself.
+
+The solution for the problem is,
+::
+
+    sum_rows = []
+    for i in im5:
+        sum_rows.append(abs(i).sum())
+    print max(sum_rows)
+
+{{{ switch to slide the ``norm()`` method }}}
+
+Well! to find the Euclidean norm and Infinity norm we have an even easier
+method, and let us see that now.
+
+The norm of a matrix can be found out using the method
+``norm()``. Inorder to find out the Euclidean norm of the matrix im5,
+we do,
+::
+
+    norm(im5)
+
+And to find out the Infinity norm of the matrix im5, we do,
+::
+
+    norm(im5,ord=inf)
+
+This is easier when compared to the code we wrote. Do ``norm``
+question mark to read up more about ord and the possible type of norms
+the norm function produces.
+
+{{{ switch to next slide, determinant }}}
+
+Now let us find out the determinant of a the matrix m5. 
+
+The determinant of a square matrix can be obtained using the function
+``det()`` and the determinant of m5 can be found out as,
+::
+
+    det(m5)
+
+{{{ switch to next slide, eigen vectors and eigen values }}}
+
+The eigen values and eigen vector of a square matrix can be computed
+using the function ``eig()`` and ``eigvals()``.
+
+Let us find out the eigen values and eigen vectors of the matrix
+m5. We can do it as,
+::
+
+    eig(m5)
+
+Note that it returned a tuple of two matrices. The first element in
+the tuple are the eigen values and the second element in the tuple are
+the eigen vectors. Thus the eigen values are,
+::
+
+    eig(m5)[0]
+
+and the eigen vectors are,
+::
+
+    eig(m5)[1]
+
+The eigen values can also be computed using the function ``eigvals()`` as,
+::
+
+    eigvals(m5)
+
+{{{ switch to next slide, singular value decomposition }}}
+
+Now let us learn how to do the singular value decomposition or S V D
+of a matrix.
+
+Suppose M is an m×n matrix whose entries come from the field K, which
+is either the field of real numbers or the field of complex
+numbers. Then there exists a factorization of the form
+
+    M = U\Sigma V star
+
+where U is an (m by m) unitary matrix over K, the matrix \Sigma is an
+(m by n) diagonal matrix with nonnegative real numbers on the
+diagonal, and V*, an (n by n) unitary matrix over K, denotes the
+conjugate transpose of V. Such a factorization is called the
+singular-value decomposition of M.
+
+The SVD of matrix m5 can be found as
+::
+
+    svd(m5)
+
+Notice that it returned a tuple of 3 elements. The first one U the
+next one Sigma and the third one V star.
+    
+{{{ switch to next slide, recap slide }}}
+
+So this brings us to the end of this tutorial. In this tutorial, we
+learned about matrices, creating matrices, matrix operations, inverse
+of matrices, determinant, norm, eigen values and vectors and singular
+value decomposition of matrices.
+
+{{{ switch to next slide, thank you }}}
+
+Thank you!
+
+..  Author: Anoop Jacob Thomas <anoop@fossee.in>
+    Reviewer 1:
+    Reviewer 2:
+    External reviewer:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/other-type-of-plots/script.rst	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,220 @@
+.. 2.4 LO: other types of plots (3) [anoop] 
+.. -----------------------------------------
+.. * scatter 
+.. * pie chart 
+.. * bar chart 
+.. * log 
+.. * illustration of other plots, matplotlib help
+
+===================
+Other type of plots
+===================
+
+{{{ show the first slide }}}
+
+Hello and welcome to the tutorial other type of plots.
+
+{{{ show the outline slide }}}
+
+In this tutorial we will cover scatter plot, pie chart, bar chart and
+log plot. We will also see few other plots and also introduce you to
+the matplotlib help.
+
+
+Let us start with scatter plot. 
+
+{{{ switch to the next slide }}}
+
+In a scatter plot, the data is displayed as a collection of points,
+each having the value of one variable determining the position on the
+horizontal axis and the value of the other variable determining the
+position on the vertical axis. This kind of plot is also called a
+scatter chart, scatter diagram and scatter graph.
+
+Before we proceed further get your IPython interpreter running with
+the ``-pylab`` option. Start your IPython interpreter as
+::
+
+    ipython -pylab
+
+{{{ open the ipython interpreter in the terminal using the command
+ipython -pylab }}}
+
+{{{ switch to the next slide having the problem statement of first
+exercise }}}
+
+Now, let us plot a scatter plot showing the percentage profit of company A
+from the year 2000-2010. The data for the same is available in the
+file ``company-a-data.txt``. 
+
+{{{ open the file company-a-data.txt and show the content }}}
+
+The data file has two lines with a set of values in each line, the
+first line representing years and the second line representing the
+profit percentages.
+
+{{{ close the file and switch to the terminal }}}
+
+To product the scatter plot first we need to load the data from the
+file using ``loadtxt``. We learned in one of the previous sessions,
+and it can be done as ::
+
+    year,profit = loadtxt('/home/fossee/other-plot/company-a-data.txt',dtype=type(int()))
+
+Now in-order to generate the scatter graph we will use the function 
+``scatter()`` 
+::
+
+	scatter(year,profit)
+
+Notice that we passed two arguments to ``scatter()`` function, first
+one the values in x-coordinate, year, and the other the values in
+y-coordinate, the profit percentage.
+
+{{{ switch to the next slide which has the problem statement of
+problem to be tried out }}}
+
+Now here is a question for you to try out, plot the same data with red
+diamonds. 
+
+**Clue** - *try scatter? in your ipython interpreter* 
+
+.. scatter(year,profit,color='r',marker='d')
+
+Now let us move on to pie chart.
+
+{{{ switch to the slide which says about pie chart }}}
+
+A pie chart or a circle graph is a circular chart divided into
+sectors, illustrating proportion.
+
+{{{ switch to the slide showing the problem statement of second
+exercise question }}}
+
+Plot a pie chart representing the profit percentage of company A, with
+the same data from file ``company-a-data.txt``. So let us reuse the
+data we have loaded from the file previously.
+
+We can plot the pie chart using the function ``pie()``.
+::
+
+   pie(profit,labels=year)
+
+Notice that we passed two arguments to the function ``pie()``. The
+first one the values and the next one the set of labels to be used in
+the pie chart.
+
+{{{ switch to the next slide which has the problem statement of
+problem to be tried out }}}
+
+Now here is a question for you to try out, plot a pie chart with the
+same data with colors for each wedges as white, red, black, magenta,
+yellow, blue, green, cyan, yellow, magenta and blue respectively.
+
+**Clue** - *try pie? in your ipython interpreter* 
+
+.. pie(t,labels=s,colors=('w','r','k','m','y','b','g','c','y','m','b'))
+
+{{{ switch to the slide which says about bar chart }}}
+
+Now let us move on to bar chart. A bar chart or bar graph is a chart
+with rectangular bars with lengths proportional to the values that
+they represent.
+
+{{{ switch to the slide showing the problem statement of third
+exercise question }}}
+
+Plot a bar chart representing the profit percentage of company A, with
+the same data from file ``company-a-data.txt``. 
+
+So let us reuse the data we have loaded from the file previously.
+
+We can plot the bar chart using the function ``bar()``.
+::
+
+   bar(year,profit)
+
+Note that the function ``bar()`` needs at least two arguments one the
+values in x-coordinate and the other values in y-coordinate which is
+used to determine the height of the bars.
+
+{{{ switch to the next slide which has the problem statement of
+problem to be tried out }}}
+
+Now here is a question for you to try, plot a bar chart which is not
+filled and which is hatched with 45\ :sup:`o` slanting lines as shown
+in the image in the slide.
+
+**Clue** - *try bar? in your ipython interpreter* 
+
+.. bar(year,profit,fill=False,hatch='/')
+
+{{{ switch to the slide which says about bar chart }}}
+
+Now let us move on to log-log plot. A log-log graph or log-log plot is
+a two-dimensional graph of numerical data that uses logarithmic scales
+on both the horizontal and vertical axes. Because of the nonlinear
+scaling of the axes, a function of the form y = ax\ :sup:`b` will
+appear as a straight line on a log-log graph
+
+{{{ switch to the slide showing the problem statement of fourth
+exercise question }}}
+
+
+Plot a `log-log` chart of y=5*x\ :sup:`3` for x from 1-20.
+
+Before we actually plot let us calculate the points needed for
+that. And it could be done as,
+::
+
+    x = linspace(1,20,100)
+    y = 5*x**3
+
+Now we can plot the log-log chart using ``loglog()`` function,
+::
+
+    loglog(x,y)
+
+To understand the difference between a normal ``plot`` and a ``log-log
+plot`` let us create another plot using the function ``plot``.
+::
+
+    figure(2)
+    plot(x,y)
+
+{{{ show both the plots side by side }}}
+
+So that was ``log-log() plot``.
+
+{{{ switch to the next slide which says: "How to get help on
+matplotlib online"}}}
+
+Now we will see few more plots and also see how to access help of
+matplotlib over the internet.
+
+Help about matplotlib can be obtained from
+matplotlib.sourceforge.net/contents.html
+
+.. #[[Anoop: I am not so sure how to do the rest of it, so I guess we
+   can just browse through the side and tell them few. What is your
+   opinion??]]
+
+Now let us see few plots from
+matplotlib.sourceforge.net/users/screenshots.html
+
+{{{ browse through the site quickly }}}
+
+{{{ switch to recap slide }}}
+
+Now we have come to the end of this tutorial. We have covered scatter
+plot, pie chart, bar chart, log-log plot and also saw few other plots
+and covered how to access the matplotlib online help.
+
+{{{ switch to the thank you slide }}}
+
+Thank you!
+
+..  Author: Anoop Jacob Thomas <anoop@fossee.in>
+    Reviewer 1:
+    Reviewer 2:
+    External reviewer:
--- a/other_type_of_plots.rst	Fri Oct 08 16:11:20 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,220 +0,0 @@
-.. 2.4 LO: other types of plots (3) [anoop] 
-.. -----------------------------------------
-.. * scatter 
-.. * pie chart 
-.. * bar chart 
-.. * log 
-.. * illustration of other plots, matplotlib help
-
-===================
-Other type of plots
-===================
-
-{{{ show the first slide }}}
-
-Hello and welcome to the tutorial other type of plots.
-
-{{{ show the outline slide }}}
-
-In this tutorial we will cover scatter plot, pie chart, bar chart and
-log plot. We will also see few other plots and also introduce you to
-the matplotlib help.
-
-
-Let us start with scatter plot. 
-
-{{{ switch to the next slide }}}
-
-In a scatter plot, the data is displayed as a collection of points,
-each having the value of one variable determining the position on the
-horizontal axis and the value of the other variable determining the
-position on the vertical axis. This kind of plot is also called a
-scatter chart, scatter diagram and scatter graph.
-
-Before we proceed further get your IPython interpreter running with
-the ``-pylab`` option. Start your IPython interpreter as
-::
-
-    ipython -pylab
-
-{{{ open the ipython interpreter in the terminal using the command
-ipython -pylab }}}
-
-{{{ switch to the next slide having the problem statement of first
-exercise }}}
-
-Now, let us plot a scatter plot showing the percentage profit of company A
-from the year 2000-2010. The data for the same is available in the
-file ``company-a-data.txt``. 
-
-{{{ open the file company-a-data.txt and show the content }}}
-
-The data file has two lines with a set of values in each line, the
-first line representing years and the second line representing the
-profit percentages.
-
-{{{ close the file and switch to the terminal }}}
-
-To product the scatter plot first we need to load the data from the
-file using ``loadtxt``. We learned in one of the previous sessions,
-and it can be done as ::
-
-    year,profit = loadtxt('/home/fossee/other-plot/company-a-data.txt',dtype=type(int()))
-
-Now in-order to generate the scatter graph we will use the function 
-``scatter()`` 
-::
-
-	scatter(year,profit)
-
-Notice that we passed two arguments to ``scatter()`` function, first
-one the values in x-coordinate, year, and the other the values in
-y-coordinate, the profit percentage.
-
-{{{ switch to the next slide which has the problem statement of
-problem to be tried out }}}
-
-Now here is a question for you to try out, plot the same data with red
-diamonds. 
-
-**Clue** - *try scatter? in your ipython interpreter* 
-
-.. scatter(year,profit,color='r',marker='d')
-
-Now let us move on to pie chart.
-
-{{{ switch to the slide which says about pie chart }}}
-
-A pie chart or a circle graph is a circular chart divided into
-sectors, illustrating proportion.
-
-{{{ switch to the slide showing the problem statement of second
-exercise question }}}
-
-Plot a pie chart representing the profit percentage of company A, with
-the same data from file ``company-a-data.txt``. So let us reuse the
-data we have loaded from the file previously.
-
-We can plot the pie chart using the function ``pie()``.
-::
-
-   pie(profit,labels=year)
-
-Notice that we passed two arguments to the function ``pie()``. The
-first one the values and the next one the set of labels to be used in
-the pie chart.
-
-{{{ switch to the next slide which has the problem statement of
-problem to be tried out }}}
-
-Now here is a question for you to try out, plot a pie chart with the
-same data with colors for each wedges as white, red, black, magenta,
-yellow, blue, green, cyan, yellow, magenta and blue respectively.
-
-**Clue** - *try pie? in your ipython interpreter* 
-
-.. pie(t,labels=s,colors=('w','r','k','m','y','b','g','c','y','m','b'))
-
-{{{ switch to the slide which says about bar chart }}}
-
-Now let us move on to bar chart. A bar chart or bar graph is a chart
-with rectangular bars with lengths proportional to the values that
-they represent.
-
-{{{ switch to the slide showing the problem statement of third
-exercise question }}}
-
-Plot a bar chart representing the profit percentage of company A, with
-the same data from file ``company-a-data.txt``. 
-
-So let us reuse the data we have loaded from the file previously.
-
-We can plot the bar chart using the function ``bar()``.
-::
-
-   bar(year,profit)
-
-Note that the function ``bar()`` needs at least two arguments one the
-values in x-coordinate and the other values in y-coordinate which is
-used to determine the height of the bars.
-
-{{{ switch to the next slide which has the problem statement of
-problem to be tried out }}}
-
-Now here is a question for you to try, plot a bar chart which is not
-filled and which is hatched with 45\ :sup:`o` slanting lines as shown
-in the image in the slide.
-
-**Clue** - *try bar? in your ipython interpreter* 
-
-.. bar(year,profit,fill=False,hatch='/')
-
-{{{ switch to the slide which says about bar chart }}}
-
-Now let us move on to log-log plot. A log-log graph or log-log plot is
-a two-dimensional graph of numerical data that uses logarithmic scales
-on both the horizontal and vertical axes. Because of the nonlinear
-scaling of the axes, a function of the form y = ax\ :sup:`b` will
-appear as a straight line on a log-log graph
-
-{{{ switch to the slide showing the problem statement of fourth
-exercise question }}}
-
-
-Plot a `log-log` chart of y=5*x\ :sup:`3` for x from 1-20.
-
-Before we actually plot let us calculate the points needed for
-that. And it could be done as,
-::
-
-    x = linspace(1,20,100)
-    y = 5*x**3
-
-Now we can plot the log-log chart using ``loglog()`` function,
-::
-
-    loglog(x,y)
-
-To understand the difference between a normal ``plot`` and a ``log-log
-plot`` let us create another plot using the function ``plot``.
-::
-
-    figure(2)
-    plot(x,y)
-
-{{{ show both the plots side by side }}}
-
-So that was ``log-log() plot``.
-
-{{{ switch to the next slide which says: "How to get help on
-matplotlib online"}}}
-
-Now we will see few more plots and also see how to access help of
-matplotlib over the internet.
-
-Help about matplotlib can be obtained from
-matplotlib.sourceforge.net/contents.html
-
-.. #[[Anoop: I am not so sure how to do the rest of it, so I guess we
-   can just browse through the side and tell them few. What is your
-   opinion??]]
-
-Now let us see few plots from
-matplotlib.sourceforge.net/users/screenshots.html
-
-{{{ browse through the site quickly }}}
-
-{{{ switch to recap slide }}}
-
-Now we have come to the end of this tutorial. We have covered scatter
-plot, pie chart, bar chart, log-log plot and also saw few other plots
-and covered how to access the matplotlib online help.
-
-{{{ switch to the thank you slide }}}
-
-Thank you!
-
-..  Author: Anoop Jacob Thomas <anoop@fossee.in>
-    Reviewer 1:
-    Reviewer 2:
-    External reviewer:
--- a/other_types_of_plots.rst	Fri Oct 08 16:11:20 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,220 +0,0 @@
-.. 2.4 LO: other types of plots (3) [anoop] 
-.. -----------------------------------------
-.. * scatter 
-.. * pie chart 
-.. * bar chart 
-.. * log 
-.. * illustration of other plots, matplotlib help
-
-===================
-Other type of plots
-===================
-
-{{{ show the first slide }}}
-
-Hello and welcome to the tutorial other type of plots.
-
-{{{ show the outline slide }}}
-
-In this tutorial we will cover scatter plot, pie chart, bar chart and
-log plot. We will also see few other plots and also introduce you to
-the matplotlib help.
-
-
-Let us start with scatter plot. 
-
-{{{ switch to the next slide }}}
-
-In a scatter plot, the data is displayed as a collection of points,
-each having the value of one variable determining the position on the
-horizontal axis and the value of the other variable determining the
-position on the vertical axis. This kind of plot is also called a
-scatter chart, scatter diagram and scatter graph.
-
-Before we proceed further get your IPython interpreter running with
-the ``-pylab`` option. Start your IPython interpreter as
-::
-
-    ipython -pylab
-
-{{{ open the ipython interpreter in the terminal using the command
-ipython -pylab }}}
-
-{{{ switch to the next slide having the problem statement of first
-exercise }}}
-
-Now, let us plot a scatter plot showing the percentage profit of company A
-from the year 2000-2010. The data for the same is available in the
-file ``company-a-data.txt``. 
-
-{{{ open the file company-a-data.txt and show the content }}}
-
-The data file has two lines with a set of values in each line, the
-first line representing years and the second line representing the
-profit percentages.
-
-{{{ close the file and switch to the terminal }}}
-
-To product the scatter plot first we need to load the data from the
-file using ``loadtxt``. We learned in one of the previous sessions,
-and it can be done as ::
-
-    year,profit = loadtxt('/home/fossee/other-plot/company-a-data.txt',dtype=type(int()))
-
-Now in-order to generate the scatter graph we will use the function 
-``scatter()`` 
-::
-
-	scatter(year,profit)
-
-Notice that we passed two arguments to ``scatter()`` function, first
-one the values in x-coordinate, year, and the other the values in
-y-coordinate, the profit percentage.
-
-{{{ switch to the next slide which has the problem statement of
-problem to be tried out }}}
-
-Now here is a question for you to try out, plot the same data with red
-diamonds. 
-
-**Clue** - *try scatter? in your ipython interpreter* 
-
-.. scatter(year,profit,color='r',marker='d')
-
-Now let us move on to pie chart.
-
-{{{ switch to the slide which says about pie chart }}}
-
-A pie chart or a circle graph is a circular chart divided into
-sectors, illustrating proportion.
-
-{{{ switch to the slide showing the problem statement of second
-exercise question }}}
-
-Plot a pie chart representing the profit percentage of company A, with
-the same data from file ``company-a-data.txt``. So let us reuse the
-data we have loaded from the file previously.
-
-We can plot the pie chart using the function ``pie()``.
-::
-
-   pie(profit,labels=year)
-
-Notice that we passed two arguments to the function ``pie()``. The
-first one the values and the next one the set of labels to be used in
-the pie chart.
-
-{{{ switch to the next slide which has the problem statement of
-problem to be tried out }}}
-
-Now here is a question for you to try out, plot a pie chart with the
-same data with colors for each wedges as white, red, black, magenta,
-yellow, blue, green, cyan, yellow, magenta and blue respectively.
-
-**Clue** - *try pie? in your ipython interpreter* 
-
-.. pie(t,labels=s,colors=('w','r','k','m','y','b','g','c','y','m','b'))
-
-{{{ switch to the slide which says about bar chart }}}
-
-Now let us move on to bar chart. A bar chart or bar graph is a chart
-with rectangular bars with lengths proportional to the values that
-they represent.
-
-{{{ switch to the slide showing the problem statement of third
-exercise question }}}
-
-Plot a bar chart representing the profit percentage of company A, with
-the same data from file ``company-a-data.txt``. 
-
-So let us reuse the data we have loaded from the file previously.
-
-We can plot the bar chart using the function ``bar()``.
-::
-
-   bar(year,profit)
-
-Note that the function ``bar()`` needs at least two arguments one the
-values in x-coordinate and the other values in y-coordinate which is
-used to determine the height of the bars.
-
-{{{ switch to the next slide which has the problem statement of
-problem to be tried out }}}
-
-Now here is a question for you to try, plot a bar chart which is not
-filled and which is hatched with 45\ :sup:`o` slanting lines as shown
-in the image in the slide.
-
-**Clue** - *try bar? in your ipython interpreter* 
-
-.. bar(year,profit,fill=False,hatch='/')
-
-{{{ switch to the slide which says about bar chart }}}
-
-Now let us move on to log-log plot. A log-log graph or log-log plot is
-a two-dimensional graph of numerical data that uses logarithmic scales
-on both the horizontal and vertical axes. Because of the nonlinear
-scaling of the axes, a function of the form y = ax\ :sup:`b` will
-appear as a straight line on a log-log graph
-
-{{{ switch to the slide showing the problem statement of fourth
-exercise question }}}
-
-
-Plot a `log-log` chart of y=5*x\ :sup:`3` for x from 1-20.
-
-Before we actually plot let us calculate the points needed for
-that. And it could be done as,
-::
-
-    x = linspace(1,20,100)
-    y = 5*x**3
-
-Now we can plot the log-log chart using ``loglog()`` function,
-::
-
-    loglog(x,y)
-
-To understand the difference between a normal ``plot`` and a ``log-log
-plot`` let us create another plot using the function ``plot``.
-::
-
-    figure(2)
-    plot(x,y)
-
-{{{ show both the plots side by side }}}
-
-So that was ``log-log() plot``.
-
-{{{ switch to the next slide which says: "How to get help on
-matplotlib online"}}}
-
-Now we will see few more plots and also see how to access help of
-matplotlib over the internet.
-
-Help about matplotlib can be obtained from
-matplotlib.sourceforge.net/contents.html
-
-.. #[[Anoop: I am not so sure how to do the rest of it, so I guess we
-   can just browse through the side and tell them few. What is your
-   opinion??]]
-
-Now let us see few plots from
-matplotlib.sourceforge.net/users/screenshots.html
-
-{{{ browse through the site quickly }}}
-
-{{{ switch to recap slide }}}
-
-Now we have come to the end of this tutorial. We have covered scatter
-plot, pie chart, bar chart, log-log plot and also saw few other plots
-and covered how to access the matplotlib online help.
-
-{{{ switch to the thank you slide }}}
-
-Thank you!
-
-..  Author: Anoop Jacob Thomas <anoop@fossee.in>
-    Reviewer 1:
-    Reviewer 2:
-    External reviewer:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plotting_using_sage/questions.rst	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,90 @@
+Objective Questions
+-------------------
+
+ 1. If ``a = [1, 1, 2, 3, 3, 5, 5, 8]``. What is set(a)
+
+   a. set([1, 1, 2, 3, 3, 5, 5, 8])
+   #. set([1, 2, 3, 5, 8])
+   #. set([1, 2, 3, 3, 5, 5])
+   #. Error
+
+   Answer: set([1, 2, 3, 5, 8])
+
+ 2. ``a = set([1, 3, 5])``. How do you find the length of a?
+
+   Answer: len(a)
+
+ 3. ``a = set([1, 3, 5])``. What does a[2] produce?
+
+   a. 1
+   #. 3
+   #. 5
+   #. Error
+
+   Answer: Error
+
+ 4. ``odd = set([1, 3, 5, 7, 9])`` and ``squares = set([1, 4, 9, 16])``. What
+    is the value of ``odd | squares``?
+
+   Answer: set([1, 3, 4, 5, 7, 9, 16])
+
+ 5. ``odd = set([1, 3, 5, 7, 9])`` and ``squares = set([1, 4, 9, 16])``. What
+    is the value of ``odd - squares``?
+
+   Answer: set([3, 5, 7])
+
+ 6. ``odd = set([1, 3, 5, 7, 9])`` and ``squares = set([1, 4, 9, 16])``. What
+    is the value of ``odd ^ squares``?
+
+   Answer: set([3, 4, 5, 7, 16])
+
+ 7. ``odd = set([1, 3, 5, 7, 9])`` and ``squares = set([1, 4, 9, 16])``. What
+    does ``odd * squares`` give?
+
+   a. set([1, 12, 45, 112, 9])
+   #. set([1, 3, 4, 5, 7, 9, 16])
+   #. set([])
+   #. Error
+
+   Answer: Error
+
+ 8. ``a = set([1, 2, 3, 4])`` and ``b = set([5, 6, 7, 8])``. What is ``a + b``
+
+   a. set([1, 2, 3, 4, 5, 6, 7, 8])
+   #. set([6, 8, 10, 12])
+   #. set([5, 12, 21, 32])
+   #. Error
+
+ 9. ``a`` is a set. how do you check if if a varaible ``b`` exists in ``a``?
+
+   Answer: b in a
+
+ 10. ``a`` and ``b`` are two sets. What is ``a ^ b == (a - b) | (b - a)``?
+
+   a. True
+   #. False
+
+   Answer: False
+
+
+Larger Questions
+----------------
+
+ 1. Given that mat_marks is a list of maths marks of a class. Find out the
+    no.of duplicates marks in the list.
+
+   Answer::
+
+     unique_marks = set(mat_marks)
+     no_of_duplicates = len(mat_marks) - len(unique_marks)
+
+ 2. Given that mat_marks is a list of maths marks of a class. Find how many
+    duplicates of each mark exist.
+
+   Answer::
+
+     marks_set = set(mat_marks)
+     for mark in marks_set:
+         occurences = mat_marks.count(mark)
+         print occurences - 1, "duplicates of", mark, "exist"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plotting_using_sage/quickref.tex	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,11 @@
+Creating a tuple:\\
+{\ex \lstinline|    t = (1, "hello", 2.5)|}
+
+Accessing elements of tuples:\\
+{\ex \lstinline|    t[index] Ex: t[2]|}
+
+Accessing slices of tuples:\\
+{\ex \lstinline|    t[start:stop:step]|}
+
+Swapping values:\\
+{\ex \lstinline|    a, b = b, a|}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plotting_using_sage/script.rst	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,257 @@
+.. Objectives
+.. ----------
+
+.. A - Students and teachers from Science and engineering backgrounds
+   B -
+   C - 
+   D - 
+
+.. Prerequisites
+.. -------------
+
+..   1. Getting started with lists
+     
+.. Author              : Nishanth Amuluru
+   Internal Reviewer   : 
+   External Reviewer   :
+   Checklist OK?       : <put date stamp here, if OK> [2010-10-05]
+
+Script
+------
+
+Hello friends, welcome to the tutorial on "Plotting using SAGE".
+
+{{{ Show the outline slide }}}
+
+In this tutorial we shall look at 
+ 
+ * 2D plotting in SAGE
+ * 3D plotting in SAGE
+
+We shall first create a symbolic variable ``x``
+::
+
+    x = var('x')
+
+We shall plot the function ``sin(x) - cos(x) ^ 2`` in the range (-5, 5).
+::
+
+    plot(sin(x) - cos(x) ^ 2, (x, -5, 5))
+
+As we can see, the plot is shown.
+
+``plot`` command takes the symbolic function as the first argument and the
+range as the second argument.
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 1 %% Define a variable ``y`` and plot the function ``y^2 + 5y - 7`` in the
+        range (-3, 3)
+
+{{{ continue from paused state }}}
+
+::
+
+    y = var('y')
+    plot(y^2 + 5*y -7, (y, -3, 3))
+
+We have seen that plot command plots the given function on a linear range.
+
+What if the x and y values are functions of another variable.
+For instance, lets plot the trajectory of a projectile.
+
+A projectile was thrown at 50 m/s^2 and at an angle of 45 degrees from the 
+ground. We shall plot the trajectory of the particle for 5 seconds.
+
+These types of plots can be drawn using the parametric_plot function.
+We first define the time variable.
+::
+
+    t = var('t')
+
+Then we define the x and y as functions of t.
+::
+
+    f_x = 50 * cos(pi/4)
+    f_y = 50 * sin(pi/4) * t - 1/2 * 9.81 * t^2 )
+
+We then call the ``parametric_plot`` function as
+::
+
+    parametric_plot((f_x, f_y), (t, 0, 5))
+
+And we can see the trajectory of the projectile.
+
+The ``parametric_plot`` funciton takes a tuple of two functions as the first
+argument and the range over which the independent variable varies as the second
+argument.
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 2 %% A particle is thrown into the air at 10 m/s^2 and at angle of 60 degrees
+        from the top of a 100 m tower. Plot the trajectory of the particle.
+
+{{{ continue from paused state }}}
+
+::
+
+    t = var('t')
+    f_x = 10 * cos(pi/3) * t
+    f_y = 100 + 10 * sin(pi/3) * t - 1/2 * 9.81 * t^2
+    parametric_plot((f_x, f_y), (t,0,5))
+
+Now we shall look at how to plot a set of points.
+
+We have the ``line`` function to acheive this.
+
+We shall plot sin(x) at few points and join them.
+
+First we need the set of points.
+::
+
+    points = [ (x, sin(x)) for x in srange(-2*float(pi), 2*float(pi), 0.75) ]
+
+``srange`` takes a start, a stop and a step argument and returns a list of
+point. We generate list of tuples in which the first value is ``x`` and second
+is ``sin(x)``.
+
+::
+
+    line(points)
+
+plots the points and joins them with a line.
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 3 %% Plot the cosine function using line function.
+
+{{{ continue from paused state }}}
+
+::
+
+    points = [ (x, cos(x)) for x in srange(-2*float(pi), 2*float(pi), 0.75) ]
+    line(points)
+
+The ``line`` function behaves like the plot command in matplotlib. The
+difference is that ``plot`` command takes two sequences while line command
+expects a sequence of co-ordinates.
+
+As we can see, the axes limits are set by SAGE. Often we would want to set them
+ourselves. Moreover, the plot is shown here since the last command that is
+executed produces a plot. 
+
+Let us try this example
+::
+
+    plot(cos(x), (x,0,2*pi))
+    # Does the plot show up??
+
+As we can see here, the plot is not shown since the last command does not
+produce a plot.
+
+The actual way of showing a plot is to use the ``show`` command.
+
+::
+
+    p1 = plot(cos(x), (x,0,2*pi))
+    show(p1)
+    # What happens now??
+
+As we can see the plot is shown since we used it with ``show`` command.
+
+``show`` command is also used set the axes limits.
+
+::
+
+    p1 = plot(cos(x), (x,0,2*pi))
+    show(p1, xmin=0, xmax=2*pi, ymin=-1.2, ymax=1.2)
+
+As we can see, we just have to pass the right keyword arguments to the ``show``
+command to set the axes limits.
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 4 %% Plot the cosine function in the range (-2pi, 2pi) and set the x-axis
+        limits to (-5, 5) and y-axis limits to (-2, 2) respectively.
+
+{{{ continue from paused state }}}
+
+::
+
+    p1 = plot(cos(x), (x, 0, 2*pi))
+    show(p1, xmin=-5, xmax=5, ymin=-2, ymax=2)
+
+The ``show`` command can also be used to show multiple plots.
+::
+
+    p1 = plot(cos(x), (x, 0, 2*pi))
+    p2 = plot(sin(x), (x, 0, 2*pi))
+    show(p1+p2)
+
+As we can see, we can add the plots and use them in the ``show`` command.
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 5 %% Plot sin(x) and sin(2*x) in the range (0, 2pi)
+
+{{{ continue from paused state }}}
+
+::
+
+    p1 = plot(sin(x), (x, 0, 2*pi))
+    p2 = plot(sin(2*x), (x, 0, 2*pi))
+    show(p1+p2)
+
+Now we shall look at 3D plotting in SAGE.
+
+We have the ``plot3d`` function that takes a function in terms of two 
+independent variables and the range over which they vary.
+
+::
+
+    x, y = var('x y')
+    plot3d(x^2 + y^2, (x, 0, 2), (y, 0, 2))
+
+We get a 3D plot which can be rotated and zoomed using the mouse.
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 6 %% Plot the function sin(x)^2 + cos(y)^2 for x in range (0,2) and y in
+        range (-2, 2)
+
+{{{ continue from paused state }}}
+
+::
+
+    x, y = var("x y")
+    plot3d( sin(x)^2 + cos(y)^2, (x, 0, 2), (y, -2, 2))
+
+``parametric_plot3d`` function plots the surface in which x, y and z are
+functions of another variable.
+
+::
+
+   u, v = var("u v")
+   f_x = u
+   f_y = v
+   f_z = u^2 + v^2
+   parametric_plot3d((f_x, f_y, f_z), (u, 0, 2), (v, 0, 2))
+
+{{{ Show summary slide }}}
+
+This brings us to the end of the tutorial.
+we have learnt
+
+ * How to draw 2D plots using plot comand
+ * How to use the parametric_plot and line functions
+ * How to use show command for multiple plots and setting axes limits
+ * How to draw 3D plots
+
+{{{ Show the "sponsored by FOSSEE" slide }}}
+
+#[Nishanth]: Will add this line after all of us fix on one.
+This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India
+
+Hope you have enjoyed and found it useful.
+Thankyou
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plotting_using_sage/slides.tex	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,106 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%Tutorial slides on Python.
+%
+% Author: FOSSEE 
+% Copyright (c) 2009, FOSSEE, IIT Bombay
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\documentclass[14pt,compress]{beamer}
+%\documentclass[draft]{beamer}
+%\documentclass[compress,handout]{beamer}
+%\usepackage{pgfpages} 
+%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
+
+% Modified from: generic-ornate-15min-45min.de.tex
+\mode<presentation>
+{
+  \usetheme{Warsaw}
+  \useoutertheme{infolines}
+  \setbeamercovered{transparent}
+}
+
+\usepackage[english]{babel}
+\usepackage[latin1]{inputenc}
+%\usepackage{times}
+\usepackage[T1]{fontenc}
+
+\usepackage{ae,aecompl}
+\usepackage{mathpazo,courier,euler}
+\usepackage[scaled=.95]{helvet}
+
+\definecolor{darkgreen}{rgb}{0,0.5,0}
+
+\usepackage{listings}
+\lstset{language=Python,
+    basicstyle=\ttfamily\bfseries,
+    commentstyle=\color{red}\itshape,
+  stringstyle=\color{darkgreen},
+  showstringspaces=false,
+  keywordstyle=\color{blue}\bfseries}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Macros
+\setbeamercolor{emphbar}{bg=blue!20, fg=black}
+\newcommand{\emphbar}[1]
+{\begin{beamercolorbox}[rounded=true]{emphbar} 
+      {#1}
+ \end{beamercolorbox}
+}
+\newcounter{time}
+\setcounter{time}{0}
+\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
+
+\newcommand{\typ}[1]{\lstinline{#1}}
+
+\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
+
+% Title page
+\title{Your Title Here}
+
+\author[FOSSEE] {FOSSEE}
+
+\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
+\date{}
+
+% DOCUMENT STARTS
+\begin{document}
+
+\begin{frame}
+  \maketitle
+\end{frame}
+
+\begin{frame}[fragile]
+  \frametitle{Outline}
+  \begin{itemize}
+    \item 
+  \end{itemize}
+\end{frame}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%              All other slides here.                  %%
+%% The same slides will be used in a classroom setting. %% 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\begin{frame}[fragile]
+  \frametitle{Summary}
+  \begin{itemize}
+    \item 
+  \end{itemize}
+\end{frame}
+
+\begin{frame}
+  \frametitle{Thank you!}  
+  \begin{block}{}
+  \begin{center}
+  This spoken tutorial has been produced by the
+  \textcolor{blue}{FOSSEE} team, which is funded by the 
+  \end{center}
+  \begin{center}
+    \textcolor{blue}{National Mission on Education through \\
+      Information \& Communication Technology \\ 
+      MHRD, Govt. of India}.
+  \end{center}  
+  \end{block}
+\end{frame}
+
+\end{document}
--- a/savefig.rst	Fri Oct 08 16:11:20 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-=======
-Savefig
-=======
-
-Hello and welcome to the tutorial. In this tutorial you will learn how
-to save plots using Python.
-
-Start your IPython interpreter with the command ::
-
-  ipython -pylab
-
-It will start your IPython interpreter with the required python
-modules for plotting and saving your plots.
-
-{{{ Open ipython }}}
-
-Now let us plot something, let us plot a sine wave from minus 3 pi to
-3 pi. Let us start by calculating the required points for the plot. It
-can be done using linspace as, ::
-
-  x = linspace(-3*pi,3*pi,100)
-
-We have stored required points in x. Now let us plot the points using
-the statement ::
-
-  plot(x,sin(x))
-
-{{{ Keep the plot open }}}
-
-Done! we have made a very basic sine plot, now let us see how to save
-the plot for future use so that you can embed the plot in your
-reports.
-
-{{{ Switch the focus to IPython interpreter window }}}
-
-For saving the plot, we will use savefig function, and it has to be
-done with the plot window open. The statement is, ::
-
-  savefig('/home/fossee/sine.png')
-
-Notice that ``savefig`` function takes one argument which is a string
-which is the filename. The last 3 characters after the ``.`` in the
-filename is the extension or type of the file which determines the
-format in which you want to save.
-
-{{{ Highlight the /home/fossee part using mouse movements }}}
-
-Also, note that we gave the full path or the absolute path to which we
-want to save the file.
-
-{{{ Highlight the .png part using mouse movements }}}
-
-Here I have used an extension ``.png`` which means i want to save the
-image as a PNG file.
-
-Now let us locate ``sine.png`` file saved. We saved the file to
-``/home/fossee`` so let us navigate to ``/home/fossee`` using the
-file browser.
-
-{{{ Open the browser, navigate to /home/fossee and highlight the file
-sine.png }}}
-
-Yes, the file ``sine.png`` is here and let us check the it.
-
-{{{ Open the file sine.png and show it for two-three seconds and then
-close it and return to IPython interpreter, make sure the plot window
-is still open, also don't close the file browser window }}}
-
-So in-order to save a plot, we use ``savefig`` function. ``savefig``
-can save the plot in many formats, such as pdf - portable document
-format, ps - post script, eps - encapsulated post script, svg -
-scalable vector graphics, png - portable network graphics which
-support transparency etc.
-
-#[slide must give the extensions for the files - Anoop]
-
-Let us now try to save the plot in eps format. ``eps`` stands for
-encapsulated post script, and it can be embedded in your latex
-documents.
-
-{{{ Switch focus to the already open plot window }}}
-
-We still have the old sine plot with us, and now let us save the plot
-as ``sine.eps``.
-
-{{{ Switch focus to IPython interpreter }}}
-
-Now, We will save the plot using the function ``savefig`` ::
-
-  savefig('/home/fossee/sine.eps')
-
-{{{ Switch focus to file browser window }}}
-
-Now let us go to ``/home/fossee`` and see the new file created.
-
-{{{ Highlight the file sine.eps with a single mouse click for 2
-seconds and then double click and open the file }}}
-
-Yes! the new file ``sine.eps`` is here.
-
-Now you may try saving the same in pdf, ps, svg formats.
-
-Let us review what we have learned in this session! We have learned to
-save plots in different formats using the function ``savefig()``.
-
-Thank you!
-
-..  Author: Anoop Jacob Thomas <anoop@fossee.in>
-    Reviewer 1:
-    Reviewer 2:
-    External reviewer:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/savefig/questions.rst	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,118 @@
+Objective Questions
+-------------------
+
+.. A mininum of 8 questions here (along with answers)
+
+
+1. What argument can be used with savefig to increase the resolution
+   of the plot while saving a plot.
+
+   a. fname
+   #. transparency
+   #. dpi
+   #. format
+
+Answer: dpi
+
+2. The fname argument of savefig has to be always absolute path.
+
+   a. True
+   #. False
+
+Answer: False
+
+3. You are right now in the directory `/home/fossee`, from the
+   following which one is the correct one in-order to save the plot as
+   svg with the filename `plot` to the directory `/home/fossee/sine/`
+
+   a. savefig('/sine/plot.svg')
+   #. savefig('sine/plot.svg')
+   #. savefig('home/fossee/sine/plot.svg')
+   #. All of these
+   #. None of the above
+
+Answer: savefig('sine/plot.svg')
+
+4. Which is the best image format to be used with Latex documents
+   which savefig supports?
+
+   a. SVG - Scalable Vector Graphics
+   #. EPS - Encapsulated Post Script
+   #. PS - Post Script
+   #. PNG - Portable Network Graphics
+   #. None of the above
+
+Answer: EPS - Encapsulated Post Script
+
+5. ``savefig('sine.png')`` saves the plot in,
+
+   a. The root directory ``/`` (on GNU/Linux, Unix based systems)
+      ``c:\`` (on windows).
+   #. Will result in an error as full path is not supplied.
+   #. The current working directory.
+   #. Predefined directory like ``/documents``.
+
+Answer: The current working directory.
+
+6. Study the following code and tell what will happen,
+   ::
+      savefig('cosine.png',facecolor='blue')
+
+   a. Will generate an error as plot statements are missing
+   #. Will generate an error as full path is not specified
+   #. Create a file ``cosine.png`` with blue background at the current
+      working directory.
+   #. Create a file ``cosine.png`` with blue background at a
+      predefined directory like ``/documents``.
+
+Answer: Create a file ``cosine.png`` with blue background at the
+	current working directory.
+
+7. How to save the below plot as ``sine_green_border.png`` with green
+   color border/edge in the current working directory.  The plot is given
+   as,
+   ::
+	x = linspace(-5*pi,5*pi,200)
+	plot(x,sin(x),linewidth=2)
+	legend(['sin(x)'])
+
+   a. ``savefig('sine_green_border.png',bordercolor='green')``
+   #. ``savefig('sine_green_border.png',facecolor='green')``
+   #. ``savefig('sine_green_border.png',edgecolor='green')``
+   #. ``savefig('/sine_green_border.png',bordercolor='green')``
+
+Answer: savefig('sine_green_border.png',edgecolor='green')
+
+8. Given the below code snippet, what does it do?
+   ::
+	x = linspace(-5*pi,5*pi,200)
+	plot(x,sin(x),linewidth=2)
+	legend(['sin(x)'])
+    	savefig('sine.png',format='pdf',papertype='a4')
+
+   a. Save the sine plot in file sine.png as a pdf file in page-size
+      A4 and saves it into the current working directory
+   #. Save the sine plot in file sine.png.pdf in page-size A4 into the
+      current working directory.
+   #. Save the sine plot in a file sine.png in png format with
+      page-size A4 in the current working directory overriding the
+      format argument
+   #. Error in filename and format mismatch.
+
+Answer: Save the sine plot in file sine.png as a pdf file in page-size
+	A4 and saves it into the current working directory
+
+Larger Questions
+----------------
+
+.. A minimum of 2 questions here (along with answers)
+
+1. Plot a cosine plot from -2pi to 2pi in green color taking 300
+   points. Title the plot as 'Cosine plot' and the legend plot with
+   'cos(x)'. And save the plot as a pdf file with the filename
+   cosine_plot.
+
+2. Plot tan(x) where x varies from -4pi to 4pi in red color taking 600
+   points. Title the plot as 'Tan plot' and the legend plot with
+   'tan(x)'. And save the plot as a svg file with the filename
+   tangent_plot.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/savefig/script.rst	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,118 @@
+.. 2.5 LO: saving plots (2) 
+.. -------------------------
+.. * Outline 
+..   + basic savefig 
+..   + png, pdf, ps, eps, svg 
+..   + going to OS and looking at the file 
+
+=======
+Savefig
+=======
+
+Hello and welcome to the tutorial. In this tutorial you will learn how
+to save plots using Python.
+
+Start your IPython interpreter with the command ::
+
+  ipython -pylab
+
+It will start your IPython interpreter with the required python
+modules for plotting and saving your plots.
+
+{{{ Open ipython }}}
+
+Now let us plot something, let us plot a sine wave from minus 3 pi to
+3 pi. Let us start by calculating the required points for the plot. It
+can be done using linspace as, ::
+
+  x = linspace(-3*pi,3*pi,100)
+
+We have stored required points in x. Now let us plot the points using
+the statement ::
+
+  plot(x,sin(x))
+
+{{{ Keep the plot open }}}
+
+Done! we have made a very basic sine plot, now let us see how to save
+the plot for future use so that you can embed the plot in your
+reports.
+
+{{{ Switch the focus to IPython interpreter window }}}
+
+For saving the plot, we will use savefig function, and it has to be
+done with the plot window open. The statement is, ::
+
+  savefig('/home/fossee/sine.png')
+
+Notice that ``savefig`` function takes one argument which is a string
+which is the filename. The last 3 characters after the ``.`` in the
+filename is the extension or type of the file which determines the
+format in which you want to save.
+
+{{{ Highlight the /home/fossee part using mouse movements }}}
+
+Also, note that we gave the full path or the absolute path to which we
+want to save the file.
+
+{{{ Highlight the .png part using mouse movements }}}
+
+Here I have used an extension ``.png`` which means i want to save the
+image as a PNG file.
+
+Now let us locate ``sine.png`` file saved. We saved the file to
+``/home/fossee`` so let us navigate to ``/home/fossee`` using the
+file browser.
+
+{{{ Open the browser, navigate to /home/fossee and highlight the file
+sine.png }}}
+
+Yes, the file ``sine.png`` is here and let us check it.
+
+{{{ Open the file sine.png and show it for two-three seconds and then
+close it and return to IPython interpreter, make sure the plot window
+is still open, also don't close the file browser window }}}
+
+So in-order to save a plot, we use ``savefig`` function. ``savefig``
+can save the plot in many formats, such as pdf - portable document
+format, ps - post script, eps - encapsulated post script, svg -
+scalable vector graphics, png - portable network graphics which
+support transparency etc.
+
+.. #[[slide must give the extensions for the files - Anoop]]
+
+Let us now try to save the plot in eps format. ``eps`` stands for
+encapsulated post script, and it can be embedded in your latex
+documents.
+
+{{{ Switch focus to the already open plot window }}}
+
+We still have the sine plot with us, and now let us save the plot as
+``sine.eps``.
+
+{{{ Switch focus to IPython interpreter }}}
+
+Now, We will save the plot using the function ``savefig`` ::
+
+  savefig('/home/fossee/sine.eps')
+
+{{{ Switch focus to file browser window }}}
+
+Now let us go to ``/home/fossee`` and see the new file created.
+
+{{{ Highlight the file sine.eps with a single mouse click for 2
+seconds and then double click and open the file }}}
+
+Yes! the new file ``sine.eps`` is here.
+
+Now you may try saving the same in pdf, ps, svg formats.
+
+Let us review what we have learned in this session! We have learned to
+save plots in different formats using the function ``savefig()``.
+
+Thank you!
+
+..  Author: Anoop Jacob Thomas <anoop@fossee.in>
+    Reviewer 1:
+    Reviewer 2:
+    External reviewer:
Binary file using python modules/four_plot.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/using python modules/four_plot.py	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,11 @@
+x=linspace(-5*pi, 5*pi, 500)
+plot(x, x, 'b')
+plot(x, -x, 'b')
+plot(x, sin(x), 'g', linewidth=2)
+plot(x, x*sin(x), 'r', linewidth=3)
+legend(['x', '-x', 'sin(x)', 'xsin(x)'])
+annotate('origin', xy = (0, 0))
+title('Four Plot')
+xlim(-5*pi, 5*pi)
+ylim(-5*pi, 5*pi)
+#show()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/using python modules/questions.rst	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,120 @@
+Objective Questions
+-------------------
+
+.. A mininum of 8 questions here (along with answers)
+
+1. What will be output of the following code snippet,
+   ::
+
+	from math import sqrt
+        
+	def sqrt(i):
+       	    return i
+	       
+        print sqrt(49)
+
+   a. 7.0
+   #. 7
+   #. 49
+   #. 49.0
+   #. Error
+
+Answer: 49
+
+2. What will be the output of the following code snippet,
+   ::
+
+        import math
+        
+        def sqrt(i):
+            x = math.sqrt(i)
+	    if int(x) == x:
+	        return int(x)
+	    else:
+	        return x
+
+        print math.sqrt(50), sqrt(50), math.sqrt(49), sqrt(49)
+
+   a. 7.0710678118654755 7 7 7
+   #. 7.0710678118654755 7 7.0 7
+   #. 7 7 7 7
+   #. 7.0710678118654755 7.0710678118654755 7.0 7
+
+Answer: 7.0710678118654755, 7.0710678118654755, 7.0, 7
+
+3. ``from math import *`` and ``import math`` does the same,
+
+   a. True
+   #. False
+
+Answer: False
+
+4. Which among these libraries is part of python standard library,
+
+   a. Mayavi
+   #. scipy
+   #. matplotlib
+   #. urllib2
+
+Answer: urllib2
+
+5. ``pylab.plot(x,sin(x))`` can be used in a script with ``from pylab
+   import *``
+
+   a. True
+   #. False
+
+Answer: False
+
+6. Which among this is correct,
+
+   a. from scipy import plot
+   #. from numpy import plot
+   #. from matplotlib import plot
+   #. from pylab import plot
+   #. None of the above
+
+Answer: from pylab import plot
+
+7. Functions ``xlim()`` and ``ylim()`` can be imported to the current
+   name-space as,
+
+   a. from pylab import xlim, ylim
+   #. import pylab
+   #. from scipy import xlim, ylim
+   #. import scipy
+
+Answer: from pylab import xlim, ylim
+
+8. ``scipy.linspace(-5*scipy.pi, 5*scipy.pi, 500)``
+
+   a. creates an array of 500 equally spaced elements from -5*scipy.pi
+      to 5*scipy.pi(excluded)
+   #. creates an array of 500 equally spaced elements from
+      -5*scipy.pi(excluded) to 5*scipy.pi(included)
+   #. creates an array of 500 equally spaced elements from -5*scipy.pi
+      to 5*scipy.pi, both end points included
+   #. created an array of 500 equally spaced elements from -5*scipy.pi
+      to 5*scipy.pi, both end points excluded.
+   #. None of the above
+
+Answer: creates an array of 500 equally spaced elements from
+	-5*scipy.pi to 5*scipy.pi, both end points included
+
+
+Larger Questions
+----------------
+
+.. A minimum of 2 questions here (along with answers)
+
+1. Write a python script to plot a red colour tan plot between -pi to
+   pi, with x limits from -pi to pi. Label the figure appropriately
+   and with a legend 'tan(x)' and title 'tangent plot'. Label the axes
+   x as 'x' and y as 'tan(x)'. Make sure the script can be executed as
+   a python script.
+
+2. Write a python script to plot a parabola of the form y^2=4ax with a
+   = 0.5(a is the directrix), plot the line in green color add the
+   legend as 'y^2=4ax' and title as 'parabola'. For x from -20 to 20
+   with 100 equidistant points. Make sure the script can be executed
+   as a python script. [`Hint`: Use parametric equations]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/using python modules/script.rst	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,227 @@
+.. 9.3 LO: using python modules (3)
+.. ---------------------------------
+.. * executing python scripts from command line
+.. * import
+.. * scipy
+.. * pylab
+.. * sys
+.. * STDLIB modules show off
+
+====================
+Using Python modules
+====================
+{{{ show the welcome slide }}}
+
+Welcome to the spoken tutorial on using python modules.
+
+{{{ switch to next slide, outline slide }}}
+
+In this tutorial, we will see how to run python scripts from command
+line, importing modules, importing scipy and pylab modules.
+
+{{{ switch to next slide on executing python scripts from command line }}}
+
+Let us create a simple python script to print hello world. Open your
+text editor and type the following,
+
+{{{ open the text editor and type the following }}}
+::
+
+    print "Hello world!"
+    print
+
+and save the script as hello.py,
+
+{{{ save the script as hello.py }}}
+
+Till now we saw how to run a script using the IPython interpreter
+using the
+::
+
+    %run -i hello.py
+
+option, but that is not the correct way of running a python
+script. 
+
+The correct method is to run it using the Python interpreter. Open the
+terminal and navigate to the directory where hello.py is,
+
+{{{ open terminal and navigate to directory where hello.py was saved }}}
+
+now run the Python script as,
+::
+
+    python hello.py
+
+It executed the script and we got the output ``Hello World!``.
+
+{{{ highlight ``python filename`` syntax on slide while narrating }}}
+
+The syntax is python space filename.
+
+Now recall the four plot problem where we plotted four plots in a single
+figure. Let us run that script from command line.
+
+If you don't have the script, 
+
+{{{ open the four_plot.py file in text editor }}}
+
+just pause here and create a python script with the following lines
+and save it as four_plot.py.
+
+Now let us run four_plot.py as a python script.
+::
+
+    python four_plot.py
+
+Oops! even though it was supposed to work, it didn't. It gave an error
+``linspace()`` is not defined, which means that the function
+``linspace()`` is not available in the current name-space.
+
+But if you try to run the same script using ``%run -i four_plot.py``
+in your IPython interpreter started with the option ``-pylab`` it will
+work, because the ``-pylab`` option does some work for us by importing
+the required modules to our name-space when ipython interpreter
+starts. And thus we don't have to explicitly import modules.
+
+So now let us try to fix the problem and run the script in command
+line,
+
+add the following line as the first line in the script,
+{{{ add the line as first line in four_plot.py and save }}}
+::
+
+    from scipy import *
+
+Now let us run the script again,
+::
+
+    python four_plot.py
+
+Now it gave another error plot not defined, let us edit the file again
+and add the line below the line we just added,
+{{{ add the line as second line in four_plot.py and save }}}
+::
+
+    from pylab import *
+
+And run the script,
+::
+
+    python four_plot.py
+
+Yes! it worked. So what did we do?
+
+We actually imported the required modules using the keyword ``import``.
+It could have also be done as,
+
+{{{ highlight the following in slide and say it loud }}}
+::
+
+    from scipy import linspace
+
+instead of,
+::
+
+    from scipy import *
+
+So in practice it is always good to use function names instead of
+asterisk or star. As if we use asterisk to import from a particular
+module then it will replace any existing functions with the same name
+in our name-space.
+
+So let us modify four_plot.py as,
+{{{ delete the first two lines and add the following }}}
+::
+
+    from scipy import linspace, pi, sin
+    from pylab import plot, legend, annotate, title, show
+    from pylab import xlim, ylim
+
+{{{ switch to next slide }}}
+it could also be done as,
+
+..     import scipy
+..     import pylab
+..     x = scipy.linspace(-5*scipy.pi, 5*scipy.pi, 500)
+..     pylab.plot(x, x, 'b')
+..     pylab.plot(x, -x, 'b')
+..     pylab.plot(x, scipy.sin(x), 'g', linewidth=2)
+..     pylab.plot(x, x*scipy.sin(x), 'r', linewidth=3)
+..     pylab.legend(['x', '-x', 'sin(x)', 'xsin(x)'])
+..     pylab.annotate('origin', xy = (0, 0))
+..     pylab.xlim(-5*scipy.pi, 5*scipy.pi)
+..     pylab.ylim(-5*scipy.pi, 5*scipy.pi)
+
+
+Notice that we use ``scipy.pi`` instead of just ``pi`` as in the
+previous method, and the functions are called as ``pylab.plot()`` and
+``pylab.annotate()`` and not as ``plot()`` and ``annotate()``.
+
+{{{ switch to next slide, problem statement }}}
+
+Write a script to plot a sine wave from minus two pi to two pi.
+
+Pause here and try to solve the problem yourself before looking at the
+solution.
+
+It can solved as,
+
+{{{ open sine.py and show it }}}
+
+the first line we import the required functions ``linspace()`` and
+``sin()`` and constant ``pi`` from the module scipy. the second and
+third line we import the functions ``plot()``, ``legend()``,
+``show()``, ``title()``, ``xlabel()`` and ``ylabel()``. And the rest
+the code to generate the plot.
+
+We can run it as,
+{{{ now switch focus to terminal and run the script }}}
+::
+
+    python sine.py
+
+{{{ switch to next slide, What is a module? }}}
+
+So till now we have been learning about importing modules, now what is
+a module?
+
+A module is simply a file containing Python definitions and
+statements. Definitions from a module can be imported into other
+modules or into the main module.
+
+{{{ switch to next slide, Python standard library }}}
+
+Python has a very rich standard library of modules
+
+Python's standard library is very extensive, offering a wide range of
+facilities. Some of the standard modules are,
+
+for Math: math, random
+for Internet access: urllib2, smtplib
+for System, Command line arguments: sys
+for Operating system interface: os
+for regular expressions: re
+for compression: gzip, zipfile, tarfile
+And there are lot more.
+
+Find more information at Python Library reference,
+``http://docs.python.org/library/``
+
+The modules pylab, scipy, Mayavi are not part of the standard python
+library.
+
+{{{ switch to next slide, recap }}}
+
+This brings us to the end of this tutorial, in this tutorial we
+learned running scripts from command line, learned about modules, saw
+the python standard library.
+
+{{{ switch to next slide, thank you slide }}}
+
+Thank you!
+
+..  Author: Anoop Jacob Thomas <anoop@fossee.in>
+    Reviewer 1:
+    Reviewer 2:
+    External reviewer:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/using python modules/sine.py	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,11 @@
+from scipy import linspace, pi, sin
+from pylab import plot, legend, show, title
+from pylab import xlabel, ylabel
+
+x = linspace(-2*pi,2*pi,100)
+plot(x,sin(x))
+legend(['sin(x)'])
+title('Sine plot')
+xlabel('x')
+ylabel('sin(x)')
+show()
--- a/using_sage_to_teach.rst	Fri Oct 08 16:11:20 2010 +0530
+++ b/using_sage_to_teach.rst	Sun Oct 10 13:44:51 2010 +0530
@@ -11,6 +11,14 @@
  * How to use SAGE worksheets for collaborative learning
  * How to use typesetting in sage for neater outputs
 
+2D
+ * plot
+ * parametric_plot
+ * polygon
+ * line
+3D
+ * plot3d
+ * parametric_plot3d
 {{{ Pause here and try out the following exercises }}}
 
 %% 2 %% change the label on y-axis to "y" and save the lines of code
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/using_sage_to_teach/questions.rst	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,90 @@
+Objective Questions
+-------------------
+
+ 1. If ``a = [1, 1, 2, 3, 3, 5, 5, 8]``. What is set(a)
+
+   a. set([1, 1, 2, 3, 3, 5, 5, 8])
+   #. set([1, 2, 3, 5, 8])
+   #. set([1, 2, 3, 3, 5, 5])
+   #. Error
+
+   Answer: set([1, 2, 3, 5, 8])
+
+ 2. ``a = set([1, 3, 5])``. How do you find the length of a?
+
+   Answer: len(a)
+
+ 3. ``a = set([1, 3, 5])``. What does a[2] produce?
+
+   a. 1
+   #. 3
+   #. 5
+   #. Error
+
+   Answer: Error
+
+ 4. ``odd = set([1, 3, 5, 7, 9])`` and ``squares = set([1, 4, 9, 16])``. What
+    is the value of ``odd | squares``?
+
+   Answer: set([1, 3, 4, 5, 7, 9, 16])
+
+ 5. ``odd = set([1, 3, 5, 7, 9])`` and ``squares = set([1, 4, 9, 16])``. What
+    is the value of ``odd - squares``?
+
+   Answer: set([3, 5, 7])
+
+ 6. ``odd = set([1, 3, 5, 7, 9])`` and ``squares = set([1, 4, 9, 16])``. What
+    is the value of ``odd ^ squares``?
+
+   Answer: set([3, 4, 5, 7, 16])
+
+ 7. ``odd = set([1, 3, 5, 7, 9])`` and ``squares = set([1, 4, 9, 16])``. What
+    does ``odd * squares`` give?
+
+   a. set([1, 12, 45, 112, 9])
+   #. set([1, 3, 4, 5, 7, 9, 16])
+   #. set([])
+   #. Error
+
+   Answer: Error
+
+ 8. ``a = set([1, 2, 3, 4])`` and ``b = set([5, 6, 7, 8])``. What is ``a + b``
+
+   a. set([1, 2, 3, 4, 5, 6, 7, 8])
+   #. set([6, 8, 10, 12])
+   #. set([5, 12, 21, 32])
+   #. Error
+
+ 9. ``a`` is a set. how do you check if if a varaible ``b`` exists in ``a``?
+
+   Answer: b in a
+
+ 10. ``a`` and ``b`` are two sets. What is ``a ^ b == (a - b) | (b - a)``?
+
+   a. True
+   #. False
+
+   Answer: False
+
+
+Larger Questions
+----------------
+
+ 1. Given that mat_marks is a list of maths marks of a class. Find out the
+    no.of duplicates marks in the list.
+
+   Answer::
+
+     unique_marks = set(mat_marks)
+     no_of_duplicates = len(mat_marks) - len(unique_marks)
+
+ 2. Given that mat_marks is a list of maths marks of a class. Find how many
+    duplicates of each mark exist.
+
+   Answer::
+
+     marks_set = set(mat_marks)
+     for mark in marks_set:
+         occurences = mat_marks.count(mark)
+         print occurences - 1, "duplicates of", mark, "exist"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/using_sage_to_teach/quickref.tex	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,11 @@
+Creating a tuple:\\
+{\ex \lstinline|    t = (1, "hello", 2.5)|}
+
+Accessing elements of tuples:\\
+{\ex \lstinline|    t[index] Ex: t[2]|}
+
+Accessing slices of tuples:\\
+{\ex \lstinline|    t[start:stop:step]|}
+
+Swapping values:\\
+{\ex \lstinline|    a, b = b, a|}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/using_sage_to_teach/script.rst	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,181 @@
+.. Objectives
+.. ----------
+
+.. A - Students and teachers from Science and engineering backgrounds
+   B - 
+   C - 
+   D - 
+
+.. Prerequisites
+.. -------------
+
+..   1. Getting started with lists
+     
+.. Author              : Nishanth Amuluru
+   Internal Reviewer   : 
+   External Reviewer   :
+   Checklist OK?       : <put date stamp here, if OK> [2010-10-05]
+
+Script
+------
+
+Hello friends and welcome to the tutorial on "Using SAGE to teach"
+
+{{{ Show the slide containing title }}}
+
+{{{ Show the slide containing the outline slide }}}
+
+In this tutorial, we shall learn
+
+ * How to use the "@interact" feature of SAGE for better demonstration
+ * How to use SAGE for collaborative learning
+
+Let us look at a typical example of demonstrating a damped oscillation.
+::
+
+    t = var('t')
+    p1 = plot( e^(-t) * sin(2*t), (t, 0, 15))
+    show(p1)
+
+Now let us reduce the damping factor
+::
+
+    t = var('t')
+    p1 = plot( e^(-t/2) * sin(2*t), (t, 0, 15))
+    show(p1)
+
+Now if we want to reduce the damping factor even more, we would be using
+e^(-t/3). We can observe that every time we have to change, all we do is change
+something very small and re evaluate the cell.
+
+This process can be automated using the ``@interact`` feature of SAGE.
+
+::
+
+    @interact
+    def plot_damped(n=1):
+        t = var('t')
+        p1 = plot( e^(-t/n) * sin(2*t), (t, 0, 20))
+        show(p1)
+
+We can see that the function is evaluated and the plot is shown. We can also
+see that there is a field to enter the value of ``n`` and it is currently set
+to ``1``. Let us change it to 2 and hit enter.
+
+We see that the new plot with reduced damping factor is shown. Similarly we can
+change ``n`` to any desired value and hit enter and the function will be
+evaluated. 
+
+This is a very handy tool while demonstrating or teaching.
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 1 %% Plot the sine curve and vary its frequency using the ``@interact``
+
+{{{ continue from paused state }}}
+
+::
+
+    @interact
+    def sine_plot(n=1):
+        x = var('x')
+        p2 = plot(sin(n*x), (x, 0, 2*pi))
+        show(p2)
+
+Often we would want to vary a parameter over range instead of taking it as an
+input from the user. For instance we do not want the user to give ``n`` as 0
+for the damping oscillation we discussed. In such cases we use a range of
+values as the default argument.
+::
+
+    @interact
+    def plot_damped(n=(1..10)):
+        t = var('t')
+        p1 = plot( e^(-t/n) * sin(2*t), (t, 0, 20))
+        show(p1)
+
+We get similar plot but the only difference is the input widget. Here it is a
+slider unlike an input field. We can see that as the slider is moved, the
+function is evaluated and plotted accordingly.
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 2 %% Take a string as input from user and circular shift it to the left and
+        vary the shift length using a slider
+
+{{{ continue from paused state }}}
+
+::
+
+    @interact
+    def str_shift(s="MADAM", shift=(0..8)):
+        shift_len = shift % len(s)
+        chars = list(s)
+        shifted_chars = chars[shift_len:] + chars[:shift_len]
+        print "Actual String:", s
+        print "Shifted String:", "".join(shifted_chars)
+
+Sometimes we want the user to have only a given set of options. We use a list
+of items as the default argument in such situations.
+::
+
+    @interact
+    def str_shift(s="STRING", shift=(0..8), direction=["Left", "Right"]):
+        shift_len = shift % len(s)
+        chars = list(s)
+        if direction == "Right":
+            shifted_chars = chars[-shift_len:] + chars[:-shift_len]
+        else:
+            shifted_chars = chars[shift_len:] + chars[:shift_len]
+        print "Actual String:", s
+        print "Shifted String:", "".join(shifted_chars)
+
+We can see that buttons are displayed which enables us to select from a given
+set of options.
+
+We have learnt how to use the ``@interact`` feature of SAGE for better
+demonstration. We shall look at how to use SAGE worksheets for collaborative
+learning.
+
+The first feature we shall see is the ``publish`` feature. Open a worksheet and
+in the top right, we can see a button called ``publish``. Click on that and we
+get a confirmation page with an option for re publishing.
+
+For now lets forget that opion and simply publish by cliking ``yes``. The
+worksheet is now published. 
+
+Now lets signout and go to the sage notebook home. We see link to browse
+published worksheets. Lets click on it and we can see the worksheet. This does
+not require login and anyone can view the worksheet.
+
+Alternatively, if one wants to edit the sheet, there is a link on top left
+corner that enables the user to download a copy of the sheet onto their home.
+This way they can edit a copy of the worksheet.
+
+We have learnt how to publish the worksheets to enable users to edit a copy.
+Next, we shall look at how to enable users to edit the actual worksheet itself.
+
+Let us open the worksheet and we see a link called ``share`` on the top right
+corner of the worksheet. Click the link and we get a box where we can type the
+usernames of users whom we want to share the worksheet with. We can even
+specify multiple users by seperating their names using commas. Once we have
+shared the worksheet, the worksheet appears on the home of shared users.
+
+{{{ Show summary slide }}}
+
+This brings us to the end of the tutorial.
+we have learnt
+
+ * How to user interactive feaures of SAGE
+ * How to publish our work
+ * How to edit a copy of one of the published worksheets
+ * How to share the worksheets with fellow users
+
+{{{ Show the "sponsored by FOSSEE" slide }}}
+
+#[Nishanth]: Will add this line after all of us fix on one.
+This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India
+
+Hope you have enjoyed and found it useful.
+Thankyou
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/using_sage_to_teach/slides.tex	Sun Oct 10 13:44:51 2010 +0530
@@ -0,0 +1,106 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%Tutorial slides on Python.
+%
+% Author: FOSSEE 
+% Copyright (c) 2009, FOSSEE, IIT Bombay
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\documentclass[14pt,compress]{beamer}
+%\documentclass[draft]{beamer}
+%\documentclass[compress,handout]{beamer}
+%\usepackage{pgfpages} 
+%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
+
+% Modified from: generic-ornate-15min-45min.de.tex
+\mode<presentation>
+{
+  \usetheme{Warsaw}
+  \useoutertheme{infolines}
+  \setbeamercovered{transparent}
+}
+
+\usepackage[english]{babel}
+\usepackage[latin1]{inputenc}
+%\usepackage{times}
+\usepackage[T1]{fontenc}
+
+\usepackage{ae,aecompl}
+\usepackage{mathpazo,courier,euler}
+\usepackage[scaled=.95]{helvet}
+
+\definecolor{darkgreen}{rgb}{0,0.5,0}
+
+\usepackage{listings}
+\lstset{language=Python,
+    basicstyle=\ttfamily\bfseries,
+    commentstyle=\color{red}\itshape,
+  stringstyle=\color{darkgreen},
+  showstringspaces=false,
+  keywordstyle=\color{blue}\bfseries}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Macros
+\setbeamercolor{emphbar}{bg=blue!20, fg=black}
+\newcommand{\emphbar}[1]
+{\begin{beamercolorbox}[rounded=true]{emphbar} 
+      {#1}
+ \end{beamercolorbox}
+}
+\newcounter{time}
+\setcounter{time}{0}
+\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
+
+\newcommand{\typ}[1]{\lstinline{#1}}
+
+\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
+
+% Title page
+\title{Your Title Here}
+
+\author[FOSSEE] {FOSSEE}
+
+\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
+\date{}
+
+% DOCUMENT STARTS
+\begin{document}
+
+\begin{frame}
+  \maketitle
+\end{frame}
+
+\begin{frame}[fragile]
+  \frametitle{Outline}
+  \begin{itemize}
+    \item 
+  \end{itemize}
+\end{frame}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%              All other slides here.                  %%
+%% The same slides will be used in a classroom setting. %% 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\begin{frame}[fragile]
+  \frametitle{Summary}
+  \begin{itemize}
+    \item 
+  \end{itemize}
+\end{frame}
+
+\begin{frame}
+  \frametitle{Thank you!}  
+  \begin{block}{}
+  \begin{center}
+  This spoken tutorial has been produced by the
+  \textcolor{blue}{FOSSEE} team, which is funded by the 
+  \end{center}
+  \begin{center}
+    \textcolor{blue}{National Mission on Education through \\
+      Information \& Communication Technology \\ 
+      MHRD, Govt. of India}.
+  \end{center}  
+  \end{block}
+\end{frame}
+
+\end{document}