merged the heads
authornishanth
Fri, 17 Sep 2010 14:33:35 +0530
changeset 152 084840c966f3
parent 151 4032df8f6227 (diff)
parent 39 011a7acff998 (current diff)
child 153 22521a1d6841
merged the heads
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgtags	Fri Sep 17 14:33:35 2010 +0530
@@ -0,0 +1,1 @@
+2eac725a57663f408cd18346f30bdf82f556e1f1 vWO-ID
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/accessing-pieces-arrays.rst	Fri Sep 17 14:33:35 2010 +0530
@@ -0,0 +1,339 @@
+========
+ Script
+========
+
+
+{{{ Screen shows welcome slide }}}
+
+Welcome to the tutorial on accessing pieces of arrays
+
+{{{ Show the outline for this tutorial }}} 
+
+In this tutorial we shall learn to access individual elements of
+arrays, get rows and columns and other chunks of arrays using
+slicing and striding. 
+
+{{{ switch back to the terminal }}}
+
+As usual, we start IPython, using 
+::
+
+  ipython -pylab 
+
+Let us have two arrays, A and C, as the sample arrays that we will
+use to work through this tutorial. 
+
+::
+
+  A = array([12, 23, 34, 45, 56])
+
+  C = array([[11, 12, 13, 14, 15],
+             [21, 22, 23, 24, 25],
+             [31, 32, 33, 34, 35],
+             [41, 42, 43, 44, 45],
+             [51, 52, 53, 54, 55]])
+
+Pause the video here and make sure you have the arrays A and C,
+typed in correctly.
+
+Let us begin with the most elementary thing, accessing individual
+elements. Also, let us first do it with the one-dimensional array
+A, and then do the same thing with the two-dimensional array. 
+
+To access, the element 34 in A, we say, 
+
+::
+
+  A[1]
+
+Like lists, indexing starts from 0 in arrays, too. So, 34, the
+third element has the index 2. 
+
+Now, let us access the element 34 from C. To do this, we say
+::
+
+  C[2, 3]
+
+34 is in the third row and the fourth column, and since indexing
+begins from zero, the row index is 2 and column index is 3. 
+
+Now, that we have accessed one element of the array, let us change
+it. We shall change the 34 to -34 in both A and C. To do this, we
+simply assign the new value after accessing the element. 
+::
+
+  A[2] = -34
+  C[2, 3] = -34
+
+Now that we have accessed and changed a single element, let us
+access and change more than one element at a time; first rows and
+then columns.
+
+Let us access one row of C, say the third row. We do it by saying, 
+::
+
+  C[2] 
+
+How do we access the last row of C? We could say,
+::
+
+  C[4] 
+
+for the fifth row, or as with lists, use negative indexing and say
+::
+
+  C[-1]
+
+Now, we could change the last row into all zeros, using either 
+::
+
+  C[-1] = [0, 0, 0, 0, 0]
+
+or 
+
+::
+  
+  C[-1] = 0
+
+Now, how do we access one column of C? As with accessing
+individual elements, the column is the second parameter to be
+specified (after the comma). The first parameter, is now replaced
+with a ``:`` to say, that we want all the elements of that
+dimension, instead of one particular element. We access the third
+column by
+
+::
+  
+  C[:, 2]
+
+%%1%% Pause the video here and change the last column of C to
+zeroes and then resume the video.
+
+::
+  
+  C[:, -1] = 0
+
+Since A is one dimensional, rows and columns of A don't make much
+sense. It has just one row and 
+::
+
+  A[:] 
+
+gives the whole of A. 
+
+%%2%% Pause the video here and change ``A`` to ``[11, 12, 13, 14, 15]``
+and then resume the video. 
+
+To change A, we say
+::
+
+  A[:] = [11, 12, 13, 14, 15]
+
+Now, that we know how to access, rows and columns of an array, we
+shall learn how to access other pieces of an array. For this
+purpose, we will be using image arrays. 
+
+To read an image into an array, we use the ``imread`` command. We
+shall use the image ``squares.png`` present in ``/home/fossee``. We
+shall first navigate to that path in the OS and see what the image
+contains. 
+
+{{{ switch to the browser and show the image }}}
+
+{{{ switch back to the ipython terminal }}}
+
+Let us now read the data in ``squares.png`` into the array ``I``. 
+::
+
+  I = imread('/home/fossee/squares.png')
+
+We can see the contents of the image, using the command
+``imshow``. We say, 
+::
+
+  imshow(I) 
+
+to see what has been read into ``I``.
+
+To see that ``I`` is really, just an array, we say, 
+::
+
+  I 
+
+at the prompt, and see that an array is displayed. 
+
+To check the dimensions of any array, we can use the method
+shape. We say
+::
+
+  I.shape 
+
+to get the dimensions of the image. As we can see, ``squares.png``
+has the dimensions of 300x300. 
+
+Our goal for this part of the tutorial would be to get the
+top-left quadrant of the image. To do this, we need to access, a
+few of the rows and a few of the columns of the array. 
+
+To access, the third column of C, we said, ``C[:, 2]``. Essentially,
+we are accessing all the rows in column three of C. Now, let us
+modify this to access only the first three rows, of column three
+of C. 
+
+We say, 
+::
+
+  C[0:3, 2]
+
+to get the elements of rows indexed from 0 to 3, 3 not included
+and column indexed 2. Note that, the index before the colon is
+included and the index after it is not included, in the slice that
+we have obtained. This is very similar to the ``range`` function,
+where ``range`` returns a list, in which the upper limit or stop
+value is not included.
+
+Now, if we wish to access the elements of row with index 2, and in
+columns indexed 0 to 2 (included), we say, 
+::
+
+  C[2, 0:3]
+
+E%% %% Pause the video here, and first, obtain the elements [22,
+23] from C. Then, obtain the elements [11, 21, 31, 41] from
+C. Finally, obtain the elements [21, 31, 41, 0]. Then, resume the
+video.
+::
+
+  C[1, 1:3] 
+
+gives the elements [22, 23]
+::
+
+  C[0:4, 0]
+
+gives the elements [11, 21, 31, 41]
+::
+
+  C[1:5, 0]
+
+gives the elements [21, 31, 41, 0]
+
+Note that when specifying ranges, if you are starting from or
+going up-to the end, the corresponding element may be dropped. So,
+in the previous example to obtain [11, 21, 31, 41], we could have
+simply said, 
+::
+
+  C[:4, 0]
+
+and 
+::
+
+  C[1:, 0]
+
+gives the elements [21, 31, 41, 0]. If we skip both the indexes,
+we get the slice from end to end, as we already know. 
+
+E%% %% Pause the video here. Obtain the elements [[23, 24], [33,
+-34]] and then resume the video. 
+::
+
+  C[1:3, 2:4] 
+
+gives us the elements, [[23, 24], [33, -34]]. 
+
+Now, we wish to obtain the top left quarter of the image. How do
+we go about doing it? Since, we know the shape of the image to be
+300, we know that we need to get the first 150 rows and first 150
+columns. 
+::
+
+  I[:150, :150]
+
+gives us the top-left corner of the image. 
+
+We use the ``imshow`` command to see the slice we obtained in the
+form of an image and confirm. 
+::
+
+  imshow(I[:150, :150])
+
+E%% %% Pause the video here, and obtain the square in the center
+of the image. 
+::
+
+  imshow(I[75:225, 75:225])
+
+Our next goal is to compress the image, using a very simple
+technique to reduce the space that the image takes on disk while
+not compromising too heavily on the image quality. The idea is to
+drop alternate rows and columns of the image and save it. This way
+we will be reducing the data to a fourth of the original data but
+losing only so much of visual information. 
+
+We shall first learn the idea of striding using the smaller array
+C. Suppose we wish to access only the odd rows and columns (first,
+third, fifth). We do this by, 
+::
+
+  C[0:5:2, 0:5:2]
+
+if we wish to be explicit, or simply, 
+::
+
+  C[::2, ::2]
+
+This is very similar to the step specified to the ``range``
+function. It specifies, the jump or step in which to move, while
+accessing the elements. If no step is specified, a default value
+of 1 is assumed. 
+::
+
+  C[1::2, ::2] 
+
+gives the elements, [[21, 23, 0], [41, 43, 0]]
+
+E%% %% Pause the video here, and obtain the following. 
+[[12, 0], [42, 0]]
+[[12, 13, 14], [0, 0, 0]]
+Then, resume the video. 
+::
+
+  C[::3, 1::3]
+
+gives the elements [[12, 0], [42, 0]]
+::
+
+  C[::4, 1:4]
+
+gives the elements [[12, 13, 14], [0, 0, 0]]
+
+Now, that we know how to stride over an image, we can drop
+alternate rows and columns out of the image in I. 
+::
+
+  I[::2, ::2]
+
+To see this image, we say, 
+::
+
+  imshow(I[::2, ::2])
+
+This does not have much data to notice any real difference, but
+notice that the scale has reduced to show that we have dropped
+alternate rows and columns. If you notice carefully, you will be
+able to observe some blurring near the edges. To notice this
+effect more clearly, increase the step to 4. 
+::
+
+  imshow(I[::4, ::4])
+
+{{{ show summary slide }}}
+
+That brings us to the end of this tutorial. In this tutorial, we
+have learnt to access parts of arrays, specifically individual
+elements, rows and columns and larger pieces of arrays. We have
+also learnt how to modify arrays, element wise or in larger
+pieces.
+
+Thank You!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/additional_ipython.rst	Fri Sep 17 14:33:35 2010 +0530
@@ -0,0 +1,189 @@
+Hello friends and welcome to the tutorial on Additional Features of IPython
+
+{{{ Show the slide containing title }}}
+
+{{{ Show the slide containing the outline slide }}}
+
+In this tutorial, we shall look at additional features of IPython that help us
+to retreive the commands that we type on the interpreter and then save them
+into a file and run it.
+
+Let us start ipython with pylab loaded, by typing
+::
+
+    $ ipython -pylab
+
+on the terminal
+
+{{{ shit to terminal and type ipython -pylab }}}
+
+We shall first make a plot and then view the history and save it.
+::
+
+    x = linspace(-2*pi, 2*pi, 100)
+    plot(x, xsinx(x))
+
+xsin(x) is actually x * sin(x)
+::
+
+    plot(x, x*sin(x))
+    plot(x, sin(x))
+    xlabel("x")
+    ylabel("$f(x)$")   
+    title("x and xsin")
+
+We now have the plot. Let us look at the commands that we have typed in. The
+history can be retreived by using =%hist= command. Type
+::
+
+    %hist
+
+As you can see, it displays a list of recent commands that we typed. Every
+command has a number in front, to specify in which order and when it was typed.
+
+Please note that there is a % sign before the hist command. This implies that 
+%hist is a command that is specific to IPython and not available in vannila 
+Python interpreter. These type of commands are called as magic commands.
+
+Also note that, the =%hist= itself is a command and is displayed as the most
+recent command. This implies that anything we type in is stored as history, 
+irrespective of whether it is command or an error or IPython magic command.
+
+If we want only the recent 5 to be displayed, we pass the number as an argument
+to =%hist= command. Hence
+::
+
+    %hist 5 
+
+displays the recent 5 commands, inclusive of the =%hist= command.
+The default number is 40.
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 1 %% Read through the %hist documenatation and find out how can we list all
+        the commands between 5 and 10
+
+{{{ continue from paused state }}}
+
+As we can see from =%hist= documentation,
+::
+
+    %hist 5 10
+
+displays the commands from 5 to 10
+
+Now that we have the history, we would like to save the required line of code
+from history. This is possible by using the =%save= command.
+
+Before we do that, let us first look at history and identify what lines of code
+we require.Type
+::
+
+    %hist
+
+
+{{{ point to the lines }}}
+
+The first command is linspace. But second command is a command that gave us an
+error. Hence we do not need seconf. The commands from third to sixth are 
+required. The seventh command although is correct, we do not need it since we
+are setting the title correctly in the eigthth command.
+
+So we need first third to sixth and the eigthth command for our program.
+Hence the syntax of =%save= is
+::
+
+    %save /home/fossee/plot_script.py 1 3-6 8
+
+{{{ point to the output of the command }}}
+
+The command saves first and then third to sixth and eighth lines of code into
+the specified file.
+
+The first argument to %save is the path of file to save the commands and the
+arguments there after are the commands to be saved in the given order.
+
+{{{ goto the file and open it and show it }}}
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 2 %% change the label on y-axis to "y" and save the lines of code
+        accordingly
+
+{{{ continue from paused state }}}
+
+we use the command =ylabel= on interpreter as
+::
+
+    ylabel("y")
+
+and then do
+::
+
+    %save /home/fossee/example_plot.py 1 3-6 10
+
+Now that we have the required lines of code in a file, let us learn how to run
+the file as a python script.
+
+We use the IPython magic command =%run= to do this. Type
+::
+
+   %run -i /home/fossee/plot_script.py
+
+The script runs but we do not see the plot. This happens because we are running
+a script and we are not in interactive mode anymore.
+
+Hence on your terminal type
+::
+
+    show()
+
+to show the plot.
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 3 %% Use %hist and %save and create a script that has show in it and run it
+        to produce and show the plot.
+
+{{{ continue from paused state }}}
+
+We first look at the history using
+::
+
+    %hist 20
+
+Then save the script using
+::
+
+    %save /home/fossee/show_included.py 1 3-6 8 10 13
+    %run -i /home/fossee/show_included.py
+
+We get the desired plot.
+
+The reason for including a -i after run is to tell the interpreter that if any
+name is not found in script, search for it in the interpreter. Hence all these
+sin, plot, pi and show which are not available in script, are taken from the
+interpreter and used to run the script.
+
+{{{ Show summary slide }}}
+
+This brings us to the end of the tutorial.
+we have looked at 
+
+ * Retreiving history using =%hist= command
+ * Vieweing only a part of history by passing an argument to %hist
+ * saving the required lines of code in required order using %save
+ * using %run -i command to run the saved script
+
+{{{ 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
+ 
+.. Author              : Nishanth
+   Internal Reviewer 1 : 
+   Internal Reviewer 2 : 
+   External Reviewer   :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/advanced-features-functions.rst	Fri Sep 17 14:33:35 2010 +0530
@@ -0,0 +1,4 @@
+========
+ Script
+========
+
--- a/arrays.org	Sun Apr 11 02:13:03 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,187 +0,0 @@
-* Arrays
-*** Outline
-***** Introduction
-******* What do we want to do
-********* We shall use arrays (mentioned before) which
-********* shall be used for matrices in future
-******* Arsenal Required
-********* working knowledge of lists
-***** Initializing matrices
-******* Entering element-wise
-******* using special functions
-***** Accessing and Changing elements
-******* Slicing??
-******* Striding??
-***** {{Simple operations??}}
-*** Script
-    Welcome to the Tutorial on arrays. 
-
-    As mentioned in [the previous tutorial] arrays are much faster and
-    more efficient. In this tutorial we shall look at creating arrays,
-    accessing elements and changing them. 
-
-    ---
-
-    Let's start with creating simple arrays. We've already seen how to
-    convert lists to arrays. Inputting a new array is similar to that. 
-
-    In []: a = array([5, 8, 10, 13])
-
-    Type /a/, to see what it is. 
-
-    In []: a
-    
-    We enter a multi-dimensional array this way -
-    
-    In []: c = array([[11,12,13],
-                     [21,22,23],
-                      [31,32,33]])
-
-    To see what c is, we just type c in the prompt. 
-		      
-    In []: c
-
-    To see the dimensions of the array c, we use c.shape
-    In []: c.shape 
-
-    Now let us look at some special methods of creating an
-    array. There are various functions that allow us to create special
-    arrays. 
-
-    The first one we shall look at is, /arange/. /arange/ is similar to
-    the range command, except that it returns an array and accepts
-    float arguments. 
-    
-    In []: a = arange(10)
-    
-    In []: a
-    This is the array we just created. 
-    
-    In []: a.shape
-    Note that /a/ is one dimensional and has 10 elements, as expected. 
-
-    We could also use a.shape to change the shape of the array a. 
-    In []: a.shape = 2,5
-    Note that the total size of new array must be unchanged. 
-
-    We type a, to see what it looks like
-    In []: a
-
-    ones command can be used to get an array with all the entries as
-    ones. We pass it the shape of the array that we require. 
-    
-    In []: b = ones((3, 4))
-
-    Look at b, by printing it out. 
-    In []: b 
-
-    To create an array with all entries as ones, with it's shape
-    similar to an already existing array, we use the ones_like
-    command.  
-    In []: b = ones_like(a)
-
-    zeros and zeros_like are similar commands that can give you arrays
-    with all zeros. empty and empty_like give you empty arrays (arrays
-    with no initialization done.)
-
-    In []: b = zeros((3, 4))
-    In []: b = zeros_like(a)
-
-    The identity command can be used to obtain a square array with
-    ones on the main diagonal. 
-    
-    In []: identity(3)
-
-    To obtain a 2-D array, that is not necessarily square, eye command
-    can be used. Look at the documentation of eye (using eye?) for
-    more info. 
-
-    ---
-    
-    Now that we have learnt how to create arrays, let's move on to
-    accessing elements and changing them. 
-    
-    Let's work with the c, array which we had already created. 
-
-    In []: c 
-
-    Let's say we want to access the element 23 in c, we say
-
-    In []: c[1][2]
-    Note that this is similar to accessing an element inside a list of
-    lists. Also, note that counting again starts from 0. 
-    
-    But arrays provide a more convenient way to access the elements. 
-    In []: c[1, 2]
-    
-    Now, we can also change the element using a simple assignment. 
-    In []: c[1, 2] = -23
-
-    Let's look at accessing more than one elements at a time. We begin
-    with accessing rows. 
-    In []: c[1] gives us the second row. (counting starts from 0)
-
-    To get a column, we use a syntax that is similar to the one used
-    to access a single element. 
-    In []: c[:,1], gives us the first column. 
-    
-    The colon specifies that we wish to obtain all elements in that
-    dimension from the array.  
-
-    So, we could use a more explicit way to access the second row of
-    the array. 
-    In []: c[1,:]
-    
-    The colon can be used to access specific portions of the array,
-    similar to the way we do with lists. 
-    In []: c[1,1:3]
-    Observe that we get the second and third columns from the second
-    row. As with lists, the number after the colon is excluded when
-    slicing a portion of the array. 
-
-    In []: c[1:3,1]
-    Now, we get the second and third rows from the first column. 
-
-    In []: c[1:3,1:3]
-    We get the second and third rows and the second and third
-    columns. 
-
-    The numbers before and after the colons are optional. If the
-    number before the colon is omitted, it is assumed to be zero by
-    default. If the element after the colon is omitted, it is assumed
-    to be until the end. 
-
-    In []: c[1:, 1:]
-    This is essentially similar to the previous example. We are using
-    the default value i.e, the end, instead of specifying 3,
-    explicitly. 
-
-    In []: c[:2, :2]
-    We have omitted specifying the zero before the colon, explicitly. 
-
-    --- 
-    
-    You may have observed the similarity of the semi-colon notation to
-    the notation used in lists. As expected, the semi-colon notation
-    also provides a way to specify a jump. This {concept/idea} is
-    termed as Striding. 
-
-    To get every alternate row of c, starting from the first one, we say
-    In []: c[::2,:]
-
-    To get every alternate row of c, starting from the second one, we
-    say 
-    In []: c[1::2,:]
-
-
-    In []: c[:,::2]
-    In []: c[::2,::2]
-
-    ---
-
-    We come to the end of this tutorial on arrays. In this tutorial,
-    you've learnt how to create arrays and access, change elements. 
-
-    Thank you. 
-
-*** Notes
--- a/basic-plot.txt	Sun Apr 11 02:13:03 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,206 +0,0 @@
-* Script
-
-*Hello and welcome to the tutorial on Basic Plotting using Python. 
-
-*The intended audience for this tutorial are Engineering, mathematics and science teachers and students
-
-*In this tutorial, we will cover the basics of the Plotting features available in Python. 
-For this we shall use  Ipython and pylab. 
-Ipython is An Enhanced Interactive Python interpreter. It provides additional features like tab completion,easier access to help , and many other useful features which are not present in the vanilla Python interpreter.
-Pylab is python library which provides plotting functionality. 
-
-I am assuming that both Ipython and Pylab are installed on your system. If not please refer to our tutorial on how to install IPython and pylab. 
-
-*On your terminal type in the command
-$ ipython -pylab
-press RETURN
-
-We will first start with the customary Hello world program by writing:
-
-In []: print 'hello world'
-
-Voila we have got hello world as the output 
-
-To exit ipython press Ctrl-D.
-
-*Now we will get back to plotting.
-
-type again :
-$ ipython -pylab
-press RETURN
-
-In order to plot, we need a set of points. Let us create a sequence of equally spaced points starting from 0 to 2*pi. For this we use linspace
-
-Type:
-In []: x = lins<Tab> This is an Ipython feature that will auto-suggest the word
-
-In []  x=linspace( RETURN
-Ouch! I made a mistake . As you can see I made the mistake of not writing command correctly
-and Ipython changed the prompt . To get the old prompt back press crtl-c
-
-In []: x = linspace(0, 2*pi, 100)
-
-*To know more about any function,  in this case say, for 'linspace' you can type ? after it .
-
-In []: linspace?
-
-It shows documentation related to linspace function. 'help' gives details about arguments to be passed, return values and also some examples on usage. You can scroll the help using up, and down arrows keys.
-To exit from the help menu type 'q'.
-
-*As you can see linspace can take three parameters the starting point, the ending point and the number of points.
-
-Let us see what x contains now. Type 'x' and hit enter.
-
-We see that x is a sequence of numbers from 0 to 2*pi. We can check the length of x by typing 
-
-In []: len(x)
-
-To obtain the plot we use,
-In []: plot(x, sin(x))
-***
-As you can see a plot has appeared on the screen. 
-***
-
-The plot has the default color and line properties. 
-
-In this case we have used two commands 
-'pi' and 'sin' these come from 'pylab' library called using -pylab. 
-
-*Now that we have a basic plot, we can label and title the plot. 
-In []: xla<TAB>bel('x') will add a label to the x-axis. Note that 'x' is enclosed in quotes. 
-Similarly
-In []: ylabel('sin(x)') adds a label to the y-axis.
-To add a title to plot we simply use 
-In []: tit<TAB>le('Sinusoid').
-
-Hmm we also got the axis's nicely labeled and the plot titled but there is still a important detail left.That might leave a teacher unsatisfied, it lacks a legend. 
-
-Add a legend to the plot by typing 
-In []: legend(['sin(x)'])
-
-We can modify previous command to specify the location of the legend, by passing an additional argument to the function. 
-
-To go to previous command, we can use 'UP Arrow key' and 'DOWN' will take us back.
-
-Once you start editing a previous command and then you try to use 'Up arrow key ' you can get commands that are only similar to the command you are editing. But if you move your cursor to the beginning of the line you can get all the previous commands using up and down arrow keys.
-In []: legend(['sin(x)'], loc = 'center')
-
-Note that once 
-other positions which can be tried are
-'best' 
-'right'
-
-Very often in mathematical plots we have to define certain points and their meaning also called annotating . We next look at how to annotate
-In this case, let's add a comment at the point of origin. 
-In []: annotate('local max', xy=(1.5, 1))
-
-The first argument is the comment string and second one is the position for it. 
-
-As you can see, the boundary along the x-axis extends after the graph and there is an ugly blank space left on the right. Also along the y-axis, the sine plot in fact is cut by the boundary. We want to make the graph fit better. For this we shall use xlim() and ylim() to set the boundaries on the figure.
-
-In []: xlim(0, 2*pi)
-
-In []: ylim(-1.2, 1.2)
-
-The first value passed is the lower limit and the second is the upper limit. Hence when we do xlim(0, 2*pi) the boundary is set from x-value 0 to x-value 2*pi. Similarly for the y-axis.
-
-Ok, what do I do with all this effort . I obviously have to save it . 
-
-We save the plot by the function savefig
-In []: savefig('sin.png') saves the figure with the name 'sin.png' in the current directory. 
-
-other supported formats are: eps, ps, pdf etc.
-
-Let's see what happens when we use plot again 
-In []: plot(x, cos(x)) by default plots get overlaid.
-
-we update Y axis label 
-In []: ylabel('f(x)')
-
-Now in these situations with overlaid graphs, legend becomes absolutely essential. To add multiple legends, we pass the strings within quotes separated by commas and enclosed within square brackets as shown.
-
-In []: legend( [ 'sin(x)' , 'cos(x)'] )
-
-Please note that the previous legend is overwritten.
-
-In []: clf()
-clears the plot area and starts afresh.
-
-# Close the figure manually.
-
-*In case we want to create multiple plots rather than overlaid plots, we use 'figure' function.
-The figure command is used to open a plain figure window without any plot.
-In []: figure(1)
-
-We will use plot() plot again to plot a sin curve on figure(1)
-In []: plot(x, sin(x))
-
-to creates a new plain figure window without any plot type: 
-In []: figure(2)
-figure() is also used to shift the focus between multiple windows. 
-
-Any command issued henceforth applies to this window only so typing
-In []: plot(x, cos(x))
-plots cos curve on second window now.
-The previous plot window remains unchanged to these commands.
-
-calling function figure using argument 1 shifts the focus back to figure(1).
-In []: figure(1)
-
-title() sets the title of figure(1) 
-In []: title('sin(x)')
-
-Now we save the plot of figure(1) by typing 
-In []: savefig('sine.png')
-
-close() closes figure(1). Now there is just one figure that is open and hence 
-the focus is automatically shifted to figure(2).
-In []: close()
-
-close() now closes the figure(2).
-In []: close()
-
-Now, what if we want to plot in a different color? The plot command can take the additional parameters such as 'g' which generates the plot in green color. 
-
-What if we want a thicker line? Passing the linewidth=2 option to plot, generates the plot with linewidth of two units.
-
-In []: plot(x, sin(x), 'g', linewidth=2) and add arguments
-
-In []: clf()
-
-If we want to  plot points we may pass '.' as a parameter to plot
-In []: plot(x, sin(x), '.')
-
-In []: clf()
-
-You may look at more options related to colors and type of lines using plot?(question mark)
-There are numerous options and various combinations available.
-quit the documentation using 'q'
-
-In []: clf()
-
-and finally to close the plot
-In []: close()
-
-In this tutorial we learned 
-
-Some IPython Features
-Starting and exiting.
-autocompletion.
-help functionality.
-
-Regarding plotting we covered:
-How to create basic plots.
-Adding labels, legends annotation etc.
-How to change looks of the plot like colors, linewidth formats etc
-
-****************
-This brings us to the end of this tutorial. This is the first tutorial in a series of tutorials on Python for Scientific Computing. This tutorial is created by the FOSSEE team, IIT Bombay. Hope you enjoyed it and found it useful.
-****************
-
-************
-A slide of review of what has been covered and sequentially/rapidly going through them.
-************
-
-Various problems of Ipython, navigation and enter, exit.
-What about xlim and ylim?
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/embellishing_a_plot.rst	Fri Sep 17 14:33:35 2010 +0530
@@ -0,0 +1,243 @@
+Hello friends and welcome to the tutorial on Embellishing Plots
+
+{{{ Show the slide containing title }}}
+
+{{{ Show the slide containing the outline slide }}}
+
+In this tutorial, we shall look at how to modify the colour, thickness and 
+linestyle of the plot. We shall then learn how to add title to the plot and 
+then look at adding labels to x and y axes. we shall also look at adding 
+annotations to the plot.
+
+Let us start ipython with pylab loaded, by typing
+::
+
+    ipython -pylab
+
+on the terminal
+
+{{{ shit to terminal and type ipython -pylab }}}
+
+We shall first make a simple plot and start with decorating it.
+::
+
+    x = linspace(-2, 4, 20)
+    plot(x, sin(x))
+
+As you can see, the colour and thickness of line as decided by pylab. It would
+be nice if we could control these parameters in the plot. This is possible by
+passing additional arguments to the plot command.
+
+The second argument that we shall be passing is colour. We shall first clear
+the figure and plot the same in red colour.Hence
+::
+
+    clf()
+    plot(x, sin(x), 'r')
+
+Plots the same curve but now in red colour.
+
+To alter the thickness of the line, we use the =linewidth= argument in the plot
+command.Hence
+::
+
+    plot(x, cos(x), linewidth=2)
+
+produces a plot with a thicker line.
+
+{{{ Show the plot and compare the sin and cos plots }}}
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 1 %% Plot sin(x) in blue colour and with linewidth as 3
+
+{{{ continue from paused state }}}
+
+A combination of colour and linewidth would do the job for us. Hence
+::
+
+    plot(x, sin(x), 'b', linewidth=3)
+
+produces the required plot
+
+#[Nishanth]: I could not think of a SIMPLE recipe approach for introducing
+             linestyle. Hence the naive approach.
+
+Occasionally we would also want to alter the style of line. Sometimes all we
+want is just a bunch of points not joined. This is possible by passing the
+linestyle argument along with or instead of the colour argument.Hence
+::
+
+    clf()
+    plot(x, sin(x), '.')
+
+produces a plot with only points.
+
+To produce the same plot but now in blue colour, we do
+::
+
+    clf()
+    plot(x, sin(x), 'b.')
+
+Other available options can be seen in the documentation of plot.
+::
+
+    plot?
+
+{{{ Run through the documentation and show the options available }}}
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 2 %% Plot the sine curve with green filled circles.
+
+{{{ continue from paused state }}}
+
+All we have to do is use a combination of linestyle and colour to acheive this.
+Hence
+::
+
+    clf()
+    plot(x, cos(x), 'go')
+
+produces the required plot.
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 3 %% Produce a plot of tangent curve with red dashed line and linewidth 3
+
+{{{ continue from paused state }}}
+
+Now that we know how to produce a bare minimum plot with colour, style and
+thickness of our interest, we shall look at decorating the plot.
+
+Let us start with a plot of the function -x^2 + 4x - 5.
+::
+
+    plot(x, -x*x + 4*x - 5, 'r', linewidth=2)
+
+{{{ Show the plot window and switch back to terminal }}}
+
+We now have the plot in a colour and linewidth of our interest. As you can see,
+the figure does have any description describing the plot.
+
+We will now add a title to the plot by using the =title= command.
+::
+
+    title("Parabolic function -x^2+4x-5") 
+
+{{{ Show the plot window and point to the title }}}
+The figure now has a title which describes what the plot is.
+The =title= command as you can see, takes a string as argument and set the
+title accordingly.
+
+The formatting in title is messed and it does not look clean. You can imagine
+what would be the situation if there were fractions and more complex functions
+like log and exp. Wouldn't it be good if there was LaTex like formatting.
+
+That is also possible by adding a $ sign before and after the part of the 
+string that should be LaTex style.
+
+for instance, we can use
+::
+
+    title("Parabolic function $-x^2+4x-5$")
+
+and we get the polynomial formatted properly.
+
+#[Nishanth]: Unsure if I have to give this exercise since enclosing the whole
+             string in LaTex style is not good
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 4 %% Change the title of the figure such that the whole title is formatted
+        in LaTex style
+
+{{{ continue from the paused state }}}
+
+The solution is to enclose the whole string in between $. Hence,
+::
+
+    title("$Parabolic function -x^2+4x-5$")
+
+gives a title that looks neatly formatted.
+
+Although we have title, the plot is not complete without labelling x and y
+axes. Hence we shall label x-axis to "x" and y-axis to "f(x)"
+::
+
+    xlabel("x")
+
+{{{ Switch to plot window and show the xlabel }}}
+
+As you can see, =xlabel= command takes a string as argument, similar to the
+=title= command and sets it to x-axis.
+
+Similarly,
+::
+
+    ylabel("f(x)")
+
+sets the name of y-axis as "f(x)"
+
+{{{ Show the plot window and point to ylabel and switch back to terminal }}}
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 5 %% Set the x and y labels as "x" and "f(x)" in LaTex style.
+
+{{{ continue from paused state }}}
+
+Since we need LaTex style formatting, all we have to do is enclose the string
+in between two $. Hence,
+::
+
+    xlabel("$x$")
+    yalbel("$f(x)$")
+
+does the job for us.
+
+{{{ Show the plot window with clean labels }}}
+
+The plot is now almost complete. Except that we have still not seen how to 
+name the points. For example the point (2, -1) is the local maxima. We would
+like to name the point accordingly. We can do this by using
+::
+
+    annotate("local maxima", xy=(2, -1))
+
+{{{ Show the annotation that has appeared on the plot }}}
+As you can see, the first argument to =annotate= command is the name we would
+like to mark the point as and the argument after xy= is the point at which the
+name should appear.
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 6 %% Make an annotation called "root" at the point (-4, 0)
+        What happens to the first annotation ?
+
+{{{ continue from paused state }}}
+
+As we can see, every annotate command makes a new annotation on the figure.
+
+{{{ Show summary slide }}}
+
+we have looked at 
+
+ * Modifying the attributes of plot by passing additional arguments
+ * How to add title
+ * How to incorporate LaTex style formatting
+ * How to label x and y axes
+ * How to add annotations
+
+{{{ 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
+ 
+.. Author              : Nishanth
+   Internal Reviewer 1 : 
+   Internal Reviewer 2 : 
+   External Reviewer   :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/getting-started-files.rst	Fri Sep 17 14:33:35 2010 +0530
@@ -0,0 +1,147 @@
+========
+ Script
+========
+
+Welcome to the tutorial on getting started with files. 
+
+{{{ Screen shows welcome slide }}}
+
+{{{ Show the outline for this tutorial }}} 
+
+In this tutorial we shall learn to read files, and do some basic
+actions on the file, like opening and reading a file, closing a
+file, iterating through the file line-by-line, and appending the
+lines of a file to a list. 
+
+{{{ switch back to the terminal }}}
+
+As usual, we start IPython, using 
+::
+
+  ipython -pylab 
+
+Let us first open the file, ``pendulum.txt`` present in
+``/home/fossee/``. 
+::
+
+  f = open('/home/fossee/pendulum.txt')
+
+``f`` is called a file object. Let us type ``f`` on the terminal to
+see what it is. 
+::
+
+  f
+
+The file object shows, the file which is open and the mode (read
+or write) in which it is open. 
+
+We shall first learn to read the whole file into a single
+variable. Later, we shall look at reading it line-by-line. We use
+the ``read`` method of ``f`` to read, all the contents of the file
+into the variable ``pend``. 
+::
+
+  pend = f.read()
+
+Now, let us see what is in ``pend``, by typing 
+::
+
+  print pend
+
+We can see that ``pend`` has all the data of file. Type just ``pend``
+to see more explicitly, what it contains. 
+::
+
+  pend
+
+%%1%% Pause the video here and split the variable into a list,
+``pend_list``, of the lines in the file and then resume the
+video. Hint, use the tab command to see what methods the string
+variable has. 
+
+#[punch: should this even be put? add dependency to strings LO,
+where we mention that strings have methods for manipulation. hint:
+use splitlines()]
+::
+
+  pend_list = pend.splitlines()
+
+  pend_list
+
+Now, let us learn to read the file line-by-line. But, before that
+we will have to close the file, since the file has already been
+read till the end. 
+#[punch: should we mention file-pointer?]
+
+Let us close the file opened into f.
+::
+
+  f.close()
+
+Let us again type ``f`` on the prompt to see what it shows. 
+::
+
+  f
+
+Notice, that it now says the file has been closed. It is a good
+programming practice to close any file objects that we have
+opened, after their job is done.
+
+Let us, now move on to reading files line-by-line. 
+
+%%1%% Pause the video here and re-open the file ``pendulum.txt``
+with ``f`` as the file object, and then resume the video.
+
+We just use the up arrow until we reach the open command and issue
+it again. 
+::
+
+  f = open('/home/fossee/pendulum.txt')
+
+Now, to read the file line-by-line, we iterate over the file
+object line-by-line, using the ``for`` command. Let us iterate over
+the file line-wise and print each of the lines. 
+::
+
+  for line in f:
+      print line
+
+As we already know, ``line`` is just a dummy variable, and not a
+keyword. We could have used any other variable name, but ``line``
+seems meaningful enough.
+
+Instead of just printing the lines, let us append them to a list,
+``line_list``. We first initialize an empty list, ``line_list``. 
+::
+
+  line_list = [ ]
+
+Let us then read the file line-by-line and then append each of the
+lines, to the list. We could, as usual close the file using
+``f.close`` and re-open it. But, this time, let's leave alone the
+file object ``f`` and directly open the file within the for
+statement. This will save us the trouble of closing the file, each
+time we open it. 
+
+for line in open('/home/fossee/pendulum.txt'):
+line_list.append(line)
+
+Let us see what ``line_list`` contains. 
+::
+
+  line_list
+
+Notice that ``line_list`` is a list of the lines in the file, along
+with the newline characters. If you noticed, ``pend_list`` did not
+contain the newline characters, because the string ``pend`` was
+split on the newline characters. 
+
+{{{ show the summary slide }}}
+
+That brings us to the end of this tutorial. In this tutorial we
+have learnt to open and close files, read the data in the files as
+a whole, using the read command or reading it line by line by
+iterating over the file object. 
+
+Thank you!   
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/getting-started-ipython.rst	Fri Sep 17 14:33:35 2010 +0530
@@ -0,0 +1,174 @@
+========
+ Script
+========
+
+Welcome to so and so..
+
+
+This tutorial will cover the basic usage of the ``ipython``
+interpreter. The following topics would be covered.
+
+{{{ Show slide with outline of the session. }}}
+
+IPython is an enhanced Python interpreter that provides features like
+tabcompletion, easier access to help and many other functionalities
+which are not available in the vannila Python interpreter.
+
+First let us see how to invoke the ``ipython`` interpreter.
+
+We type
+::
+
+  ipython
+
+at the terminal prompt to invoke the ipython interpreter.
+
+We get a prompt with ``In [1]:`` after getting some information about
+the version of Python installed and some help commands.   
+
+If you get an error saying something like ``ipython is not
+installed``, refer to the tutorial on how to install the packages
+required for this course.
+
+Now, to quit the ipython interpreter, type Ctrl-D.  You are prompted
+asking if you really want to exit, type y to say yes and quit ipython.
+
+Start ipython again, as you did before.
+
+The prompt that you have says ``In [1]``. ``In`` stands for input and the
+ipython interpreter is ready to accept input from you.
+
+Now let us see, how we can type some commands into the interpreter.
+
+Start with the simplest thing, addition.
+
+Let's type 
+::
+  1+2 
+
+at the prompt. IPython promptly gives back the output as 3.  Notice
+that the output is displayed with an ``Out[1]`` indication.
+
+Let's try out few other mathematical operations.
+::
+
+  5 - 3
+  7 - 4
+  6 * 5
+
+Now let's ``print 1+2``. Instead of typing the whole thing, we make
+use of the fact that IPython remembers the history of the commands
+that you have already used. We use the up arrow key to go back the
+command ``1+2``. We then use the left-arrow key to navigate to the
+beginning of the line and add the word ``print`` and a space. Then hit
+enter and observe that the interpreter prints out the value as 3,
+without the Out[] indication.
+
+Now, let's change the previous command ``print 1+2`` to ``print
+10*2``.  We use the up arrow again to navigate to the previous command
+and use the left arrow key to move the cursor on to the + symbol and
+then use the delete key to remove it and type 0 and * to change the
+expression to the required one.  We hit enter to see the output of
+``print``. 
+
+Now, let's say we want to use the function ``round``. We type ``ro``
+at the prompt and hit the tab key. As you can see, the IPython
+completes the command. This feature is called the tab-completion.
+
+Now, we remove all the characters and just type ``r`` and then hit
+tab. IPython does not complete the command since there are many
+possibilities. It just lists out all the possible completions.
+
+%% %% Pause the video here and type ``ab`` and hit tab to see what
+happens. Next, jut type ``a`` and hit tab to see what happens. 
+
+``ab`` tab completes to ``abs`` and ``a<tab>`` gives us a list of all
+the commands starting with a. 
+
+Now, let's see what these functions are used for.  We will use the
+help features of ipython to find this out.
+
+To get the help of any function, we first type the function, ``abs``
+in our case and then add a ? at the end and hit enter.
+
+As the documentation says, ``abs`` accepts a number as an input and
+returns it's absolute value.
+
+We say, 
+::
+
+  abs(-19)
+
+  abs(19)
+
+We get 19, as expected, in both the cases.  
+
+Does it work for decimals (or floats)?  Let's try typing abs(-10.5)
+and we do get back 10.5.
+
+%% %% Pause the video here, and look-up the documentation of ``round``
+and see how to use it. 
+
+::
+
+ round?
+
+If you notice, there are extra square brackets around the ``ndigits``.
+This means that ``ndigits`` is optional and 0 is the default value.
+Optional parameters are shown in square brackets anywhere in Python
+documentation.
+
+The function ``round``, rounds a number to a given precision.
+
+%% %% Pause the video here and check the output of
+round(2.48)
+round(2.48, 1)
+round(2.48, 2)
+and then resume the video. 
+
+::
+  round(2.484)
+  round(2.484, 1)
+  round(2.484, 2)
+
+We get 2.0, 2.5 and 2.48, which are what we expect. 
+
+Let's now see how to correct typing errors that we make when typing at
+the terminal. As already shown, if we haven't hit the enter key
+already, we could navigate using the arrow keys and make deletions
+using delete or backspace key and correct the errors. 
+
+Let's now type round(2.484 and hit enter, without closing the
+parenthesis. We get a prompt with dots.  This prompt is the
+continuation prompt of ``ipython``.  It appears, the previous line is
+incomplete in some way.  We now complete the command by typing, the
+closing parenthesis and hitting enter.  We get the expected output of
+2.5. 
+
+In other instances, if we commit a typing error with a longer and more
+complex expression and end up with the continuation prompt, we can
+type Ctrl-C to interrupt the command and get back the ``ipython`` input
+prompt.
+
+%% %% Pause the video here. 
+Try typing round(2.484, and hit enter. and then cancel the command
+using Ctrl-C. Then, type the command, round(2.484, 2) and resume the
+video. 
+
+::
+  
+  round(2.484 
+  ^C
+
+  round(2.484, 2)
+  
+This brings us to the end of the tutorial on getting started with
+``ipython``.
+
+In this tutorial we have seen 
+{{{ show the outline/summary slide. }}}
+
+Thank you!
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/input_output.rst	Fri Sep 17 14:33:35 2010 +0530
@@ -0,0 +1,182 @@
+Hello friends and welcome to the tutorial on Input/Output
+
+{{{ Show the slide containing title }}}
+
+{{{ Show the slide containing the outline slide }}}
+
+Input and Output are used in almost every program we use.
+In this tutorial, we shall learn
+
+ * Outputting data
+ * Taking input from the user
+
+type
+::
+ 
+    a = "This is a string"
+    a
+    print a
+     
+print a prints the value of a which is obvious.
+As you can see, even when you type just a, the value of a is shown.
+But there is a difference.
+
+Typing a shows the value of a while print a prints the string. This difference
+becomes more evident when we use strings with newlines in them.
+type
+::
+
+    b = "A line \n New line"
+    b
+    print b
+
+As you can see, just typing b shows that b contains a newline character.
+While typing print b prints the string and hence the newline.
+
+Moreover when we type just a, the value a is shown only in interactive mode and
+does not have any effect on the program while running it as a script.
+
+We shall look at different ways of outputting the data.
+
+print statement also accepts the syntax of C's printf statement.
+Various arguments can be passed to print using modifiers.
+type
+::
+
+    x = 1.5
+    y = 2
+    z = "zed"
+    print "x is %2.1f y is %d z is %s"%(x,y)
+
+As you can see, the values of x and y are substituted in place of %2.1f and %d
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 1 %% What happens when you do print "x is %d y is %f"%(x)
+
+{{{ continue from paused state }}}
+
+We see that the int value of x and float value of y are printed corresponding
+to the modifiers used in the print statement.
+
+We can also see that print statement prints a new line character at the end of
+line, everytime it is called. This can be suppressed by using a "," at the end
+print statement.
+
+Let us see this by typing out following code on an editor as print_example.py
+
+{{{ open an editor }}}
+type
+::
+
+    print "Hello"
+    print "World"
+
+    print "Hello",
+    print "World"
+
+Now we run the script using %run /home/fossee/print_example.py
+
+As we can see, the print statement when used with comma in the end, prints a
+space instead of a new line.
+
+Now we shall look at taking input from the user.
+We will use the ~~raw_input~~ for this.
+type
+::
+
+    ip = raw_input()
+
+The cursor is blinking indicating that it is waiting for input    
+type
+::
+
+    an input
+
+and hit enter.
+Now let us see what is the value of ip by typing.
+::
+
+    ip
+
+We can see that it contains the string "an input"
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 2 %% enter the number 5.6 as input and store it in a variable called c.
+
+{{{ continue from paused state }}}
+
+We have to use the raw_input command with variable c.
+type
+::
+
+    c = raw_input()
+    5.6
+    c
+
+Now let us see the type of c.
+
+::
+
+    type(c)
+
+We see that c is a string. This implies that anything you enter as input, will
+be taken as a string no matter what you enter.
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 3 %% What happens when you do not enter anything and hit enter
+
+{{{ continue from paused state }}}
+
+::
+
+    d = raw_input()
+    <RET>
+    d
+
+We see that when nothing is entered, an empty string is considered as input.
+
+raw_input also can display a prompt to assist the user.
+::
+
+    name = raw_input("Please enter your name: ")
+
+prints the string given as argument and then waits for the user input.
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 4 %% How do you display a prompt and let the user enter input in a new line
+
+{{{ continue from paused state }}}
+
+The trick is to include a newline character at the end of the prompt string.
+::
+
+    ip = raw_input("Please enter a number in the next line\n> ")
+
+prints the newline character and hence the user enters input in the new line
+
+{{{ Show summary slide }}}
+
+This brings us to the end of the tutorial.
+we have learnt
+
+ * How to print some value
+ * How to print using modifiers
+ * How to take input from user
+ * How to display a prompt to the user before taking the input
+
+{{{ 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
+ 
+.. Author              : Nishanth
+   Internal Reviewer 1 : 
+   Internal Reviewer 2 : 
+   External Reviewer   :
--- a/least-squares.org	Sun Apr 11 02:13:03 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-* Least Squares Fit
-*** Outline
-***** Introduction
-******* What do we want to do? Why?
-********* What's a least square fit?
-********* Why is it useful?
-******* How are we doing it?
-******* Arsenal Required
-********* working knowledge of arrays
-********* plotting
-********* file reading
-***** Procedure
-******* The equation (for a single point)
-******* It's matrix form
-******* Getting the required matrices
-******* getting the solution
-******* plotting
-*** Script
-    Welcome. 
-    
-    In this tutorial we shall look at obtaining the least squares fit
-    of a given data-set. For this purpose, we shall use the same
-    pendulum data used in the tutorial on plotting from files.
-
-    To be able to follow this tutorial comfortably, you should have a
-    working knowledge of arrays, plotting and file reading. 
-
-    A least squares fit curve is the curve for which the sum of the
-    squares of it's distance from the given set of points is
-    minimum. We shall use the lstsq function to obtain the least
-    squares fit curve. 
-
-    In our example, we know that the length of the pendulum is
-    proportional to the square of the time-period. Therefore, we
-    expect the least squares fit curve to be a straight line. 
-
-    The equation of the line is of the form T^2 = mL+c. We have a set
-    of values for L and the corresponding T^2 values. Using this, we
-    wish to obtain the equation of the straight line. 
-
-    In matrix form...
-    {Show a slide here?}
-    
-    We have already seen (in a previous tutorial), how to read a file
-    and obtain the data set. We shall quickly get the required data
-    from our file. 
-
-    In []: l = []
-    In []: t = []
-    In []: for line in open('pendulum.txt'):
-    ....     point = line.split()
-    ....     l.append(float(point[0]))
-    ....     t.append(float(point[1]))
-    ....
-    ....
-
-    Since, we have learnt to use arrays and know that they are more
-    efficient, we shall use them. We convert the lists l and t to
-    arrays and calculate the values of time-period squared. 
-
-    In []: l = array(l)
-    In []: t = array(t)
-    In []: tsq = t*t
-
-    Now we shall obtain A, in the desired form using some simple array
-    manipulation 
-
-    In []: A = array([l, ones_like(l)])
-    In []: A = A.T
-    
-    Type A, to confirm that we have obtained the desired array. 
-    In []: A
-    Also note the shape of A. 
-    In []: A.shape
-
-    We shall now use the lstsq function, to obtain the coefficients m
-    and c. lstsq returns a lot of things along with these
-    coefficients. Look at the documentation of lstsq, for more
-    information. 
-    In []: result = lstsq(A,tsq)
-
-    We take put the required coefficients, which are the first thing
-    in the list of things that lstsq returns, into the variable coef. 
-    In []: coef = result[0]
-
-    To obtain the plot of the line, we simply use the equation of the
-    line, we have noted before. T^2 = mL + c. 
-
-    In []: Tline = coef[0]*l + coef[1]
-    In []: plot(l, Tline)
-
-    Also, it would be nice to have a plot of the points. So, 
-    In []: plot(l, tsq, 'o')
-
-    This brings us to the end of this tutorial. In this tutorial,
-    you've learnt how to obtain a least squares fit curve for a given
-    set of points. 
-
-    Hope you enjoyed it. Thanks. 
-
-*** Notes
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loading-data-from-files.rst	Fri Sep 17 14:33:35 2010 +0530
@@ -0,0 +1,137 @@
+========
+ Script
+========
+
+Welcome to this tutorial on loading data from files. 
+
+{{{ Screen shows welcome slide }}}
+
+Until now, all the plots we have made use analytic functions. We have
+been using analytic functions to generate a sequence of points and
+plotting them, against another sequence of points. But, this is not
+what we do most often. We often require to plot points obtained from
+experimental observations.
+
+#[punch: the initial part of the paragraph may be removed, to make
+this a more generic LO?]
+
+In this tutorial we shall learn to read data from files and save it
+into sequences that can later be used to plot.
+
+{{{ Show the outline for this tutorial }}} 
+
+We shall use the ``loadtxt`` command to load data from files. We will
+be looking at how to get multiple columns of data into multiple
+sequences.
+
+{{{ switch back to the terminal }}}
+
+As usual, let us start IPython, using 
+::
+
+  ipython -pylab 
+
+Now, Let us begin with reading the file primes.txt, which contains
+just a list of primes listed in a column, using the loadtxt command.
+The file, in our case, is present in ``/home/fossee/primes.txt``.
+
+#[punch: do we need a slide for showing the path?]
+
+We use the ``cat`` command to see the contents of this file. 
+
+#[punch: should we show the cat command here? seems like a good place
+to do it] ::
+
+  cat /home/fossee/primes.txt
+
+Now let us read this list into the variable ``primes``.
+::
+
+  primes = loadtxt('/home/fossee/primes.txt')
+
+``primes`` is now a sequence of primes, that was listed in the file,
+``primes.txt``.
+
+We now type, ``print primes`` to see the sequence printed.
+
+We observe that all of the numbers end with a period. This is so,
+because these numbers are actually read as ``floats``. We shall learn
+about them, later.
+
+Now, let us use the ``loadtxt`` command to read a file that contains
+two columns of data, ``pendulum.txt``. This file contains the length
+of the pendulum in the first column and the corresponding time period
+in the second.
+
+%%1%% Pause the video here, and use the ``cat`` command to view the
+contents of this file and then resume the video.
+
+This is how we look at the contents of the file, ``pendulum.txt``
+::
+
+  cat /home/fossee/pendulum.txt
+
+Let us, now, read the data into the variable ``pend``. Again, it is
+assumed that the file is in ``/home/fossee/``
+::
+
+  pend = loadtxt('/home/fossee/pendulum.txt')
+
+Let us now print the variable ``pend`` and see what's in it. 
+::
+
+  print pend
+
+Notice that ``pend`` is not a simple sequence like ``primes``. It has
+two sequences, containing both the columns of the data file. Let us
+use an additional argument of the ``loadtxt`` command, to read it into
+two separate, simple sequences.
+::
+
+  L, T = loadtxt('/home/fossee/pendulum.txt', unpack=True)
+
+Let us now, print the variables L and T, to see what they contain.
+::
+
+  print L
+  print T
+
+Notice, that L and T now contain the first and second columns of data
+from the data file, ``pendulum.txt``, and they are both simple
+sequences.
+
+{{{ show the slide with loadtxt --- other features }}}
+
+In this tutorial, we have learnt the basic use of the ``loadtxt``
+command, which is capable of doing a lot more than we have used it for
+until now, for example
+
+%%2%% Pause the video here, and read the file
+``pendulum_semicolon.txt`` which contains the same data as
+``pendulum.txt``, but the columns are separated by semi-colons instead
+of spaces. Use the IPython help to see how to do this. Once you have
+finished, resume the video to look at the solution.
+
+{{{ switch back to the terminal }}}
+::
+
+  L, T = loadtxt('/home/fossee/pendulum.txt', unpack``True, delimiter``';')
+
+  print L
+
+  print T
+
+This brings us to the end of this tutorial. 
+
+{{{ show the summary slide }}}
+
+You should now be able to do the following, comfortably. 
+
+  + Read data from files, containing a single column of data using the
+    ``loadtxt`` command.
+  + Read multiple columns of data, separated by spaces or other
+    delimiters.
+
+Thank you!   
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loops.rst	Fri Sep 17 14:33:35 2010 +0530
@@ -0,0 +1,4 @@
+========
+ Script
+========
+
--- a/loopsdatastruct.org	Sun Apr 11 02:13:03 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-(Next slide)
-
-
-Lists
-~~~~~
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lstsq.rst	Fri Sep 17 14:33:35 2010 +0530
@@ -0,0 +1,128 @@
+Hello friends and welcome to the tutorial on Least Square Fit
+
+{{{ Show the slide containing title }}}
+
+{{{ Show the slide containing the outline slide }}}
+
+In this tutorial, we shall look at generating the least square fit line for a
+given set of points.
+
+First let us have a look at the problem.
+
+{{{ Show the slide containing problem statement. }}}
+
+We have an input file generated from a simple pendulum experiment.
+
+It contains two columns of data. The first column is the length of the
+pendulum and the second is the corresponding time period of the pendulum.
+
+As we know, the square of time period of a pendulum is directly proportional to
+its length, we shall plot l vs t^2 and verify if the proportionality is linear.
+
+If it is not linear, we shall generate a least square fit line.
+
+{{{ show the slide containing explanation on least square fit }}}
+
+As shown in the slide, we are first going to generate the two matrices tsq and
+A. Then we are going to use the =lstsq= function to find the values of m and c.
+
+To read the input file and parse the data, we are going to loadtxt function.
+Type
+::
+
+    data = loadtxt("/home/fossee/pendulum.txt")
+    data
+
+As you can see, data is a sequence containing 90 records. Each record contains
+two values. The first is length and second is time period. But what we need is 
+two sequences. One sequence containing all the length values and one containing
+all the time values.
+
+Hence we have to use the unpack option with loadtxt. It unpacks the data into
+ sequences depending on the structure of data.
+
+Type
+::
+
+    l, t = loadtxt("/home/fossee/pendulum.txt", unpack=True)
+    l
+    t
+
+We can see that l and t are two sequences containing length and time values
+correspondingly.
+
+Let us first plot l vs t^2. Type
+::
+
+    tsq = t * t
+    plot(l, tsq, 'bo')
+
+
+{{{ switch to the plot window }}}
+
+We can see that there is a visible linear trend.
+
+let us now generate the A matrix with l values.
+We shall first generate a 2 x 90 matrix with the first row as l values and the
+second row as ones. Then take the transpose of it. Type
+::
+
+    inter_mat = array((l, ones_like(l)))
+    inter_mat
+
+We see that we have intermediate matrix. Now we need the transpose.Type
+::
+
+    A = inter_mat.T
+    A
+
+Now we have both the matrices A and tsq. We only need to use the =lstsq=
+Type
+::
+
+    result = lstsq(A, tsq)
+
+The result is a sequence of values. The first item is the matrix p or in simple
+words, the values of m and c. Hence, 
+::
+
+    m, c = result[0]
+    m
+    c
+
+Now that we have m and c, we need to generate the fitted values of t^2. Type
+::
+
+    tsq_fit = m * l + c
+    plot(l, tsq, 'bo')
+    plot(l, tsq_fit, 'r')
+
+We get the least square fit of l vs t^2
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 2 %% change the label on y-axis to "y" and save the lines of code
+        accordingly
+
+{{{ continue from paused state }}}
+
+{{{ Show summary slide }}}
+
+This brings us to the end of the tutorial.
+we have learnt
+
+ * how to use loadtxt to read files
+ * how to generate a least square fit
+
+{{{ 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
+ 
+.. Author              : Nishanth
+   Internal Reviewer 1 : 
+   Internal Reviewer 2 : 
+   External Reviewer   :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/manipulating-strings.rst	Fri Sep 17 14:33:35 2010 +0530
@@ -0,0 +1,179 @@
+========
+ Script
+========
+
+{{{ show the welcome slide }}}
+
+Welcome to this tutorial on manipulating strings. 
+
+{{{ show the slide with outline }}} 
+
+In this tutorial we shall learn to manipulate strings, specifically
+slicing and reversing them, or replacing characters, converting from
+upper to lower case and vice-versa 
+
+#[punch: reversed returns an iterator. should we still teach it?]
+
+We have an ``ipython`` shell open, in which we are going to work,
+through out this session. 
+
+Let us consider a simple problem, and learn how to slice strings and
+get sub-strings. 
+
+Let's say the variable ``week`` has the list of the names of the days
+of the week. 
+
+::
+
+    week = ["sun", "mon", "tue", "wed", "thu", "fri", "sat"]
+
+
+Now given a string ``s``, we should be able to check if the string is a
+valid name of a day of the week or not. 
+
+::
+
+    s = saturday
+
+
+``s`` could be in any of the forms --- sat, saturday, Sat, Saturday,
+SAT, SATURDAY. We shall now be solving the problem only for the forms,
+sat and saturday. We shall solve it for the other forms, at the end of
+the tutorial. 
+
+{{{ show these forms in a slide }}}
+
+So, we need to check if the first three characters of the given string
+exists in the variable ``week``. 
+
+As, with any of the string data-types, strings can be sliced into
+sub-strings. To get the first three characters of s, we say, 
+
+::
+
+    s[0:3]
+
+Note that, we are slicing the string from the index 0 to index 3, 3
+not included. 
+
+As we already know, the last element of the string can be accessed
+using ``s[-1]``.  
+
+%%1%% Pause the video here and obtain the sub-string excluding the
+first and last characters from the string. 
+
+::
+
+    s[1:-1]
+
+gives the a substring of s, without the first and the last
+characters. 
+
+::
+
+    s = saturday
+    s[:3]
+
+Now, we just check if that substring is present in the variable
+``week``. 
+
+::
+
+    s[:3] in week          
+
+Let us now consider the problem of finding out if a given string is
+palindromic or not. First of all, a palindromic string is a string
+that remains same even when it has been reversed.
+
+Let the string given be ``malayalam``.
+
+::
+
+    s = "malayalam"
+
+Now, we need to compare this string with it's reverse. 
+
+Again, we will use a technique common to all sequence data-types,
+[::-1]
+
+So, we obtain the reverse of s, by simply saying, 
+
+::
+
+    s[::-1]
+
+Now, to check if the string is ``s`` is palindromic, we say
+::
+
+    s == s[::-1]
+
+As, expected, we get ``True``. 
+
+Now, if the string we are given is ``Malayalam`` instead of
+``malayalam``, the above comparison would return a False. So, we will
+have to convert the string to all lower case or all upper case, before
+comparing. Python provides methods, ``s.lower`` and ``s.upper`` to
+achieve this. 
+
+Let's try it out. 
+::
+
+   s = "Malayalam"
+
+   s.upper()
+
+   s
+
+   s.lower()
+
+   s.lower() == s.lower()[::-1]
+   
+Note that these methods, do not change the original string, but return
+a new string.
+
+a%% %% Pause the video here, and finish the problem of checking if
+``s`` is a valid name of a day of the week and then resume the
+video. Change the solution to this problem, to include forms like,
+SAT, SATURDAY, Saturday and Sat. 
+
+::
+
+    s.lower()[:3] in week
+
+We just convert any input string to lower case and then check if it is
+present in the list ``week``. 
+
+Now, let us consider another problem. We often encounter e-mail id's
+which have @ and periods replaced with text, something like
+info[at]fossee[dot]in. We now wish to get back proper e-mail
+addresses.  
+
+Let's say the variable email has the email address. 
+::
+
+   email = "info[at]fossee[dot]in"
+
+Now, we first replace the ``[at]`` with the ``@``, using the replace
+method of strings. 
+::
+
+   email = email.replace("[at]", "@")
+   print email
+
+%%1%% Pause the video here and replace the ``[dot]`` with ``.`` and then
+resume the video. 
+
+::
+
+   email = email.replace("[dot]", ".")        
+   print email
+
+
+That brings us to the end of the tutorial. 
+
+{{{ show summary slide }}}
+
+In this tutorial, we have learnt how to get substrings, reverse
+strings and a few useful methods, namely upper, lower and replace. 
+
+Thank You!
--- a/matrices.org	Sun Apr 11 02:13:03 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-* Matrices
-*** Outline
-***** Introduction
-******* Why do we want to do that?
-******* We shall use arrays (introduced before) for matrices
-******* Arsenal Required
-********* working knowledge of arrays
-***** Various matrix operations
-******* Transpose
-******* Sum of all elements
-******* Element wise operations
-******* Matrix multiplication
-******* Inverse of a matrix
-******* Determinant
-******* eigen values/vectors
-******* svd
-***** Other things available?
-*** Script
-    Welcome. 
-    
-    In this tutorial, you will learn how to perform some common matrix
-    operations. We shall look at some of the functions available in
-    pylab. Note that, this tutorial just scratches the surface and
-    there is a lot more that can be done. 
-
-    Let's begin with finding the transpose of a matrix. 
-    
-    In []: a = array([[ 1,  1,  2, -1],
-    ...:            [ 2,  5, -1, -9],
-    ...:            [ 2,  1, -1,  3],
-    ...:            [ 1, -3,  2,  7]])
-
-    In []: a.T
-
-    Type a, to observe the change in a. 
-    In []: a
-    
-    Now we shall look at adding another matrix b, to a. It doesn't
-    require anything special, just use the + operator. 
-    
-    In []: b = array([[3, 2, -1, 5],
-                      [2, -2, 4, 9],
-                      [-1, 0.5, -1, -7],
-                      [9, -5, 7, 3]])
-    In []: a + b
-
-    What do you expect would be the result, if we used * instead of
-    the + operator? 
-
-    In []: a*b
-    
-    You get an element-wise product of the two arrays and not a matrix
-    product. To get a matrix product, we use the dot function. 
-    
-    In []: dot(a, b)
-
-    The sum function returns the sum of all the elements of the
-    array. 
-    
-    In []: sum(a)
-
-    The inv command returns the inverse of the matrix. 
-    In []: inv(a)
-
-    In []: det(a)
-
-    In []: eig(a)
-    Returns the eigenvalues and the eigen vectors. 
-    
-    In []: eigvals(a)
-    Returns only the eigenvalues. 
-
-    In []: svd(a)
-    Singular Value Decomposition 
-
-*** Notes
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/module-assessment-arrays-matrices.rst	Fri Sep 17 14:33:35 2010 +0530
@@ -0,0 +1,88 @@
+========
+ Script
+========
+
+Welcome. 
+
+This spoken tutorial is a self-assessment tutorial and you will be
+able to assess yourself on the concepts learnt in the Module on Arrays
+and Matrices. 
+
+
+As with all other assessments we will first start with a few short
+questions that will not take you more that 15 to 20 seconds to
+answer. Then we shall move on to a bigger problem, that you are
+expected to solve in less than 10 mins. 
+
+
+  * Given a list of marks::
+   
+      marks = [10, 20, 30, 50, 55, 75, 83]
+
+    How will you convert it to an array?
+
+  * What is the shape of the following array?::
+
+      x = array([[1,2,3,4],
+                 [3,4,2,5]])
+
+  * What is the resulting array::
+
+      a = array([[1, 2],
+                 [3, 4]])
+      
+      a[1,0] = 0
+ 
+  * What is the resulting array?::
+
+      x = array(([1,2,3,4],
+                 [2,3,4,5]))
+
+      x[-2][-3] = 4
+
+
+  * How do we change the array ``x = array([[1,2,3,4]])`` to
+    ``array([[1,2,0,4]])``?
+
+  * How do we get the slice::
+
+      array([[2,3],
+             [4,2]])
+
+    out of the array::
+
+      x = array([[1,2,3,4],
+                 [3,4,2,5]])
+
+
+  * What is the output of x[::3,::3], when x is::
+
+      x = array([[9,18,27],
+                 [30,60,90],
+                 [14,7,1]])
+
+  * How do you get the transpose of this array?::
+
+      a = array([[1, 2],
+                 [3, 4]])
+
+  * What is the output of the following?::
+
+      a = array([[1, 2],
+                 [3, 4]])
+
+      b = array([[1, 1],
+                 [2, 2]])
+
+      a*b
+
+
+{{{ show slides with solutions to these problems }}}
+
+Now, let us move on to a larger problem. From the image
+`tagore-einstein.png``
+
+  + extract the face of Einstein alone.
+  + extract the face of Tagore alone.
+  + get a smaller copy of the image, that is a fourth it's size. 
+                 
--- a/odes.org	Sun Apr 11 02:13:03 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-* Solving ODEs
-*** Outline
-***** Introduction
-******* What are we going to do?
-******* How are we going to do?
-******* Arsenal Required
-********* working knowledge of arrays
-********* working knowledge of functions
-*** Script
-    Welcome. 
-    
-    In this tutorial we shall look at solving Ordinary Differential Equations
-    using odeints in Python.
-
-    Let's consider a classical problem of the spread of epidemic in a
-    population.
-    This is given by dy/dt = ky(L-y) where L is the total population.
-    For our problem Let us use L=25000, k=0.00003.
-    Let the boundary condition be y(0)=250.
-
-    First of all run the magic command to import odeint to our program.
-
-    In []: from scipy.integrate import odeint
-
-
-    For now just remember this as a command that does some magic to obtain
-    the function odeint in to our program.
-    We will come back to the details of this command in subsequent sessions.
-
-    We can represent the given ODE as a Python function.
-    This function takes the dependent variable y and the independent variable t
-    as arguments and returns the ODE.
-    Our function looks like this:
-    (Showing the slide should be sufficient)
-
-    In []: def epid(y, t):
-      ....     k = 0.00003
-      ....     L = 25000
-      ....     return k*y*(L-y)
-
-
-    Independent variable t can have be assigned the values in the interval of
-    0 and 12 with 61 points using linspace:
-
-    In []: t = linspace(0, 12, 61)
-
-    Now obtaining the odeint of the ode we have already defined is as simple as
-    calling the Python's odeint function which we imported:
-    
-    In []: y = odeint(epid, 250, t)
-
-    We can plot the the values of y against t to get a graphical picture our ODE.
-
-
-    Let us move on to solving a system of two ordinary differential equations.
-    Here we shall take the example ODEs of a simple pendulum.
-
-    The equations can be written as a system of two first order ODEs
-
-    d(theta)/dt = omega
-
-    and
-
-    d(omega)/dt = - g/L sin(theta)
-
-    Let us define the boundary conditions as: at t = 0, 
-    theta = theta 0 (10 degrees) and omega = 0
-
-    Let us first define our system of equations as a Python function, pend_int.
-    As in the earlier case of single ODE we shall use odeint function of Python
-    to solve this system of equations by passing pend_int to odeint.
-
-    pend_int is defined as shown:
-
-    In []: def pend_int(initial, t):
-      ....     theta = initial[0]
-      ....     omega = initial[1]
-      ....     g = 9.81
-      ....     L = 0.2
-      ....     f=[omega, -(g/L)*sin(theta)]
-      ....     return f
-      ....
-
-    It takes two arguments. The first argument is a 2-tuple containing the two
-    dependent variables in the system, theta and omega.
-    The second argument is the independent variable t.
-
-    In the function we assign theta and omega to first and second values of the
-    initial argument respectively.
-    Acceleration due to gravity, as we know is 9.8 meter per second sqaure.
-    Let the length of the the pendulum be 0.2 meter.
-
-    We create a list, f, of two equations which corresponds to our two ODEs,
-    that is d(theta)/dt = omega and d(omega)/dt = - g/L sin(theta).
-    We return this list of equations f.
-
-    Now we can create a set of values for our time variable t over which we need
-    to integrate our system of ODEs. Let us say,
-
-    In []: t = linspace(0, 20, 101)
-
-    We shall assign the boundary conditions to the variable initial.
-
-    In []: initial = [10*2*pi/360, 0]
-
-    Now solving this system is just a matter of calling the odeint function with
-    the correct arguments.
-    So first let us import odeint function into our program using the magic
-    import command
-
-    In []: from scipy.integrate import odeint
-
-    We can call ode_int as:
-
-    In []: pend_sol = odeint(pend_int, initial,t)
-
-    Plotting theta against t and omega against t we obtain the plots as shown
-    in the slide.
-
-    Thus we come to the end of this session on solving ordinary differential
-    equations in Python. Thanks for listening to this tutorial.
-
-*** Notes
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/parsing_data.rst	Fri Sep 17 14:33:35 2010 +0530
@@ -0,0 +1,192 @@
+Hello friends and welcome to the tutorial on Parsing Data
+
+{{{ Show the slide containing title }}}
+
+{{{ Show the slide containing the outline slide }}}
+
+In this tutorial, we shall learn
+
+ * What is parsing data
+ * the string operations required for parsing data
+ * datatype conversion
+
+ Lets us have a look at the problem
+
+{{{ Show the slide containing problem statement. }}}
+
+There is an input file containing huge no.of records. Each record corresponds
+to a student.
+
+{{{ show the slide explaining record structure }}}
+As you can see, each record consists of fields seperated by a ";". The first
+record is region code, then roll number, then name, marks of second language,
+first language, maths, science and social, total marks, pass/fail indicatd by P
+or F and finally W if with held and empty otherwise.
+
+Our job is to calculate the mean of all the maths marks in the region "B".
+
+#[Nishanth]: Please note that I am not telling anything about AA since they do
+             not know about any if/else yet.
+
+
+Now what is parsing data.
+
+From the input file, we can see that there is data in the form of text. Hence
+parsing data is all about reading the data and converting it into a form which
+can be used for computations. In our case, that is numbers.
+
+We can clearly see that the problem involves reading files and tokenizing.
+
+Let us learn about tokenizing strings. Let us define a string first. Type
+::
+
+    line = "parse this           string"
+
+We are now going to split this string on whitespace.
+::
+
+    line.split()
+
+As you can see, we get a list of strings. Which means, when split is called
+without any arguments, it splits on whitespace. In simple words, all the spaces
+are treated as one big space.
+
+split also can split on a string of our choice. This is acheived by passing
+that as an argument. But first lets define a sample record from the file.
+::
+
+    record = "A;015163;JOSEPH RAJ S;083;042;47;AA;72;244;;;"
+    record.split(';')
+
+We can see that the string is split on ';' and we get each field seperately.
+We can also observe that an empty string appears in the list since there are
+two semi colons without anything in between.
+
+Hence split splits on whitespace if called without an argument and splits on
+the given argument if it is called with an argument.
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 1 %% split the variable line using a space as argument. Is it same as
+        splitting without an argument ?
+
+{{{ continue from paused state }}}
+
+We see that when we split on space, multiple whitespaces are not clubbed as one
+and there is an empty string everytime there are two consecutive spaces.
+
+Now that we know splitting a string, we can split the record and retreive each
+field seperately. But there is one problem. The region code "B" and a "B"
+surrounded by whitespace are treated as two different regions. We must find a
+way to remove all the whitespace around a string so that "B" and a "B" with
+white spaces are dealt as same.
+
+This is possible by using the =strip= method of strings. Let us define a
+string by typing
+::
+
+    unstripped = "     B    "
+    unstripped.strip()
+
+We can see that strip removes all the whitespace around the sentence
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 2 %% What happens to the white space inside the sentence when it is stripped
+
+{{{ continue from paused state }}}
+
+Type
+::
+
+    a_str = "         white      space            "
+    a_str.strip()
+
+We see that the whitespace inside the sentence is only removed and anything
+inside remains unaffected.
+
+By now we know enough to seperate fields from the record and to strip out any
+white space. The only road block we now have is conversion of string to float.
+
+The splitting and stripping operations are done on a string and their result is
+also a string. hence the marks that we have are still strings and mathematical
+operations are not possible. We must convert them into integers or floats
+
+We shall look at converting strings into floats. We define an float string
+first. Type
+::
+
+    mark_str = "1.25"
+    mark = int(mark_str)
+    type(mark_str)
+    type(mark)
+
+We can see that string is converted to float. We can perform mathematical
+operations on them now.
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 3 %% What happens if you do int("1.25")
+
+{{{ continue from paused state }}}
+
+It raises an error since converting a float string into integer directly is
+not possible. It involves an intermediate step of converting to float.
+::
+
+    dcml_str = "1.25"
+    flt = float(dcml_str)
+    flt
+    number = int(flt)
+    number
+
+Using =int= it is also possible to convert float into integers.
+
+Now that we have all the machinery required to parse the file, let us solve the
+problem. We first read the file line by line and parse each record. We see if
+the region code is B and store the marks accordingly.
+::
+
+    math_marks_B = [] # an empty list to store the marks
+    for line in open("/home/fossee/sslc1.txt"):
+        fields = line.split(";")
+
+        region_code = fields[0]
+        region_code_stripped = region_code.strip()
+
+        math_mark_str = fields[5]
+        math_mark = float(math_mark_str)
+
+        if region_code == "AA":
+            math_marks_B.append(math_mark)
+
+
+Now we have all the maths marks of region "B" in the list math_marks_B.
+To get the mean, we just have to sum the marks and divide by the length.
+::
+
+        math_marks_mean = sum(math_marks_B) / len(math_marks_B)
+        math_marks_mean
+
+{{{ Show summary slide }}}
+
+This brings us to the end of the tutorial.
+we have learnt
+
+ * how to tokenize a string using various delimiters
+ * how to get rid of extra white space around
+ * how to convert from one type to another
+ * how to parse input data and perform computations on it
+
+{{{ 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
+ 
+.. Author              : Nishanth
+   Internal Reviewer 1 : 
+   Internal Reviewer 2 : 
+   External Reviewer   :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plotting-data.rst	Fri Sep 17 14:33:35 2010 +0530
@@ -0,0 +1,137 @@
+Plotting   Experimental  Data  
+=============================   
+Hello  and welcome , this tutorial on  Plotting Experimental data is 
+presented by the fossee  team.  
+
+{{{ Show the slide containing title }}}
+
+
+{{{ Show the Outline Slide }}}
+
+Here  we will discuss plotting  Experimental data. 
+
+1.We will see how we can represent a sequence of numbers in Python. 
+
+2.We will also become fimiliar with  elementwise squaring of such a
+sequence. 
+
+3. We will also see how we can use our graph to indicate Error.
+
+One needs   to  be  fimiliar  with  the   concepts  of  plotting
+mathematical functions in Python.
+
+We will use  data from a Simple Pendulum  Experiment to illustrate our
+points. 
+
+{{{ Simple Pendulum data Slide }}} 
+
+  
+  
+  
+As we know for a simple pendulum length,L is directly  proportional to 
+the square of time,T. We shall be plotting L and T^2 values.
+
+
+First  we will have  to initiate L and  T values. We initiate them as sequence 
+of values.  To tell ipython a sequence of values we  write the sequence in 
+comma  seperated values inside two square brackets.  This is also  called List 
+so to create two sequences
+
+L,t type in ipython shell. ::
+
+    In []: L = [0.1, 0.2, 0.3, 0.4, 0.5,0.6, 0.7, 0.8, 0.9]
+    
+    In []: t= [0.69, 0.90, 1.19,1.30, 1.47, 1.58, 1.77, 1.83, 1.94]
+
+
+  
+To obtain the  square of sequence t we will  use the function square
+with argument t.This is saved into the variable tsquare.::
+
+   In []: tsquare=square(t)
+  
+   array([  0.4761, 0.81 , 1.4161,  1.69 , 2.1609,  2.4964, 3.1329, 
+   3.3489, 3.7636])
+
+  
+Now to plot L vs T^2 we will simply type ::
+
+  In []: plot(L,t,.)
+
+'.' here represents to plot use small dots for the point. ::
+
+  In []: clf()
+
+You can also specify 'o' for big dots.::
+ 
+  In []: plot(L,t,o)
+
+  In []: clf()
+
+
+{{{ Slide with Error data included }}}
+
+
+Now we  shall try  and take into  account error  into our plots . The
+Error values for L and T  are on your screen.We shall again intialize
+the sequence values in the same manner as we did for L and t ::
+
+  In []: delta_L= [0.08,0.09,0.07,0.05,0.06,0.00,0.06,0.06,0.01]
+  
+  In []: delta_T= [0.04,0.08,0.11,0.05,0.03,0.03,0.01,0.07,0.01]
+
+
+  
+Now to plot L vs T^2 with an error bar we use the function errorbar()
+
+The syntax of the command is as given on the screen. ::
+
+    
+    In []: errorbar(L,tsquare,xerr=delta_L, yerr=delta_T, fmt='b.')
+
+This gives a  plot with error bar for  x and y axis. The  dots are of
+blue color.
+
+
+similarly we can draw the same error bar with big red dots just change 
+the parameters to fmt to 'ro'. ::
+
+    In []: clf()
+    In []: errorbar(L,tsquare,xerr=delta_L, yerr=delta_T, fmt='ro')
+
+
+
+thats it. you can explore other options to errorbar using the documentation 
+of errorbar.::
+
+   In []: errorbar?
+
+
+{{{ Summary Slides }}}
+
+In this tutorial we have learnt : 
+
+1. How to declare a sequence of number , specifically the kind of sequence we learned was a list.
+
+2. Plotting experimental data extending our knowledge from mathematical functions. 
+
+3. The various options available for plotting dots instead of lines.
+
+4. Plotting experimental data such that we can also represent error. We did this using the errorbar() function.
+
+
+ {{{ Show the "sponsored by FOSSEE" slide }}}
+
+
+
+This tutorial was created as a part of FOSSEE project.
+
+Hope you have enjoyed and found it useful.
+
+ Thankyou
+
+ 
+
+Author              : Amit Sethi
+Internal Reviewer   :
+Internal Reviewer 2 : 
--- a/plotting-files.org	Sun Apr 11 02:13:03 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-* Plotting Experimental Data
-*** Outline
-***** Introduction
-******* Why do we want to do that?
-******* Inputting data
-********* Lists
-********* Files
-******* Arsenal Required
-********* Lists
-*********** initializing
-*********** appending to lists
-********* for loops
-*********** iterating over a list
-********* basic plotting
-***** Inputting data as lists
-******* Input the dependent and independent variables in two lists
-******* Plot the points
-***** Plotting from files
-******* Look at the file
-******* Read the file and get data into variables
-******* Do any massaging required
-******* Plot the points
-
-*** Script
-
-This video will teach you how to plot experimental data, with two
-variables. 
-
-In general, we don't plot (analytical) functions. We often have
-experimental data points, that we wish to plot. We shall look at
-inputting this data and plotting it. 
-
-The data could be input (or entered) in two formats. For smaller data
-sets we could use lists to input the data and use plain text files for
-(somewhat?) larger ones. (Binary files?)
-
-[[[Before starting with this video, you should be comfortable with
-  - Lists
-    - initializing them
-    - appending elements to lists
-  - for command
-    - iterating over a list
-  - split command
-  - plot command
-    - plotting two variables
-]]]
-
-Let's begin with inputting the data as lists and plotting it. 
-
-x = [0, 1, 2.1, 3.1, 4.2, 5.2]
-y = [0, 0.8, 0.9, 0, -0.9, -0.8]
-Now we have two lists x and y, with the values that we wish to plot. 
-
-We say:
-plot (x, y, 'o')
-
-and there, we have our plot!
-
-[We close the plot window. ]
-
-Now, that we know how to plot data which is in lists, we will look at
-plotting data which is in a text file. Essentially, we read the data
-from the file and massage it into lists again. Then we can easily
-plot it, as we already did. 
-
-As an example we will use the data collected from a simple pendulum
-experiment. We have the data of, the length of pendulum vs. the time
-period of the pendulum in the file pendulum.txt
-
-In []: cat pendulum.txt (windows?)
-
-The cat command, shows the contents of the file. 
-
-The first column is the length of the pendulum and the second column
-is the time. We read the file line-by-line, collect the data into
-lists and plot them. 
-
-We begin with initializing three empty lists for length, time-period
-and square of the time-period. 
-
-l = []
-t = []
-tsq = []
-
-Now we open the file and read it line by line. 
-for line in open('pendulum.txt'):
-
-We split each line at the space 
-    point = line.split()
-
-Then we append the length and time values to the corresponding
-lists. Note that they are converted from strings to floats, before
-appending to the lists
-    l.append(float(point[0])
-    t.append(float(point[1])
-We also calculate the squares of the time-period and append to the end
-of the tsq list. 
-    tsq.append(t[-1]*t[-1])
-As you might be aware, t[-1] gives the last element of the list t. 
-
-Now the lists l, t have the required data. We can simply plot them, as
-we did already. 
-
-plot(l, t, 'o')
-
-Enjoy!
-
-*** Notes
-    - Also put in code snippets?
--- a/plotting-files.txt	Sun Apr 11 02:13:03 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-**********************************************************************************
-Hello and welcome, this is the second tutorial in the series of spoken tutorials on Python for Scientific computing. 
-
-Here we will teach you how to plot experimental data.
-
-You can input the data either as a list or read from a plain text/binary file. We will cover both one by one.
-Please make sure you have pendulum.txt file, as mentioned on requirement list of session
- 
-So let's begin.  First we will input the data as lists and then we will plot it. 
-So on the Interpreter we will type
-x = [0, 1, 2.1, 3.1, 4.2, 5.2]
-here x is a list. In python, list is a container that holds a number of objects. Various functions related to lists will be covered in more detail later. 
-
-Now for the corresponding Y values type
-y = [0, 0.8, 0.9, 0, -0.9, -0.8]
- 
-Now we have x and y in two separate lists and we plot x vs. y via:
-plot (x, y, 'o')
-
-Here, we have our plot! 
-[We close the plot window. ] 
-
-Now, that we know how to plot data from lists, we will look at plotting data from a text file. Essentially, we read the data from the file and fit them into lists again. Then we can easily plot it, as we  did before. 
-
-As an example we will use the data collected from a simple pendulum experiment. 
-
-In []: cat pendulum.txt (windows wont work!)
-The cat command shows the file content.
-The first column is the length of the pendulum and the second column is the time. We read the file line-by-line, collect the data into lists and plot them.
-
-We begin with initializing three empty lists for length, time-period and square of the time-period.
-l = []
-t = []
-tsq = []
- 
-Now we open the file and read it line by line.
-for line in open('pendulum.txt'): 
-
-The ':' at the end of the 'for' statement marks the start of the block.
-'open' returns an iterable object which we traverse using the 'for' loop. In  python, 'for' iterates over items of any sequence.
-#we will cover more about the 'for' loop in other spoken tutorials
-'line' is a string variable storing one line at a time as the 'for' loop iterates through the file.
-
-We split each line at the space using
-     point = line.split() 
-split function will return a list. In this case it will have two elements, first is length and second is time. 
-
-Note the indentation here. Everything inside the 'for' loop has to be indented by 4 spaces.
-Then we append the length and time values to the corresponding lists. Note that they are converted from strings to floats, before appending to the lists
-    l.append(float(point[0]))
-append is a function used to append one element to the list.
-    t.append(float(point[1]))
-
-By now we have the time and length values in two lists. Now to get the square of the time values, we will write one more 'for' loop which will iterate through list 't'
-
-for time in t:
-    tsq.append(time*time) 
-
-Now lists l(en) and tsq have the required data. We can simply plot them, as we did earlier. 
-plot(l, tsq, 'o')
-
-So here is the required plot. In this way, you can plot data from files.  Hope this information was helpful. See you in the next tutorial 
-
-******************
-
-For alternate ways of loading data from files go through the tutorial on loadtxt
-We should have two tutorials here, one should be basic, using for loops and lists
-Second one using loadtxt.
--- a/plotting-script.txt	Sun Apr 11 02:13:03 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-**********************************************************************************
-Hello friends and welcome to the second tutorial in the series of spoken tutorials on Python for Scientific computing. 
-
-In the previous tutorial we learnt how to obtain basic plots using a set of points. 
-We plot experimental data more often that we plot mathematical curves. 
-So here we shall learn how to plot experimental data.
-
-You can input the data either as a list or read from a plain text/binary file. We shall cover both one by one.
-Please make sure you have pendulum.txt file, as mentioned on requirement list of the session.
-As you can see the pendulum.txt file in our case is on the desktop and we are currently in the home directory. 
-So we navigate to the desktop, using cd Desktop. Now let's start IPython by typing ipython -pylab.
-
-First we shall look into using lists to input the data and then we shall plot it. 
-Type
-x = 0, 1, 2.1, 3.1, 4.2, 5.2 within square brackets.
-here x is a list. In python, list is a container that holds a number of objects in the given order. 
-We shall look into other functions related to lists a little later. 
-
-Now for the corresponding Y values type
-y = 0, 0.8, 0.9, 0, -0.9, -0.8 within square brackets.
- 
-Now that we have x and y in two separate lists and we plot x vs. y using
-plot (x, y, 'o') The o within quotes plots with filled circles. We saw the various style options in the previous tutorial.
-
-And lo! We have our plot! 
-[We close the plot window. ] 
-
-Now, that we know how to plot data from lists, we will look at plotting data from a text file. Essentially, if we read the data from the file and fit them into lists, we can easily plot the data, just as we did previously. 
-
-Here we shall use the data collected from a simple pendulum experiment as an example. 
-Let us check out what pendulum.txt contains. Type cat pendulum.txt
-
-Windows users just double click on the file to open it. Please be careful not to edit the file.
-
-The first column is the length of the pendulum and the second column is the time. We read the file line-by-line, collect the data into lists and plot them.
-
-Let's begin with initializing three empty lists for length, time-period and square of the time-period.
-l = []
-t = []
-tsq = []
- 
-Initializing an empty list is done as shown above using just a pair of square brackets without any content in them.
-
-Now we open the file and read it line by line. 
-for line in open('pendulum.txt'): 
-
-The ':' at the end of the 'for' statement marks the beginning of the for block.
-'open' returns an iterable object which we traverse using the 'for' loop. In  python, 'for' iterates over items of a sequence.
-For more details regarding the for loop refer to our tutorial on loops and data structures.
-'line' here is a string variable that contains one line of the file at a time as the 'for' loop iterates through the file.
-
-We split each line at the space using
-     point = line.split() 
-the split function returns a list of elements from the 'line' variable split over spaces. In this case it will have two elements, first is length and second is time. 
-
-Note the indentation here. Everything inside the 'for' loop has to be indented by 4 spaces.
-Then we append the length and time values to the appropriate lists. Since we cannot perform mathematical operations on strings, we need to convert the strings to floats, before appending to the lists. 
-    l.append(float(point[0]))
-append is a function used to append a single element to a list.
-    t.append(float(point[1]))
-
-Now we have the time and length values in two lists. Now to get the square of the time values, we shall write one more 'for' loop which will iterate through list 't'
-
-for time in t:
-    tsq.append(time*time) 
-
-Let us now verify if l, t and tsq have the same number of elements. Type
-print len(l), len(t), len(tsq)
-
-Now we have verified that all three have the same dimensions. lists l and tsq have the required data. Let's now plot them, as we did earlier. 
-plot(l, tsq, 'o')
-
-So here is the required plot. 
-In this way, you can plot data from files.  Hope this information was helpful. Thank you.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plotui.rst	Fri Sep 17 14:33:35 2010 +0530
@@ -0,0 +1,177 @@
+Hello and welcome to the tutorial on creating simple plots using
+Python.This tutorial is presented by the Fossee group.  
+{{{ Show the Title Slide }}} 
+
+I hope you have IPython running on your computer.
+
+In this tutorial we will look at plot command and also how to study
+the plot using the UI.
+
+{{{ Show Outline Slide }}}
+
+Lets start ipython on your shell, type :: 
+
+      $ipython -pylab
+
+
+Pylab is a python library which provides plotting functionality.It
+also provides many other important mathematical and scientific
+functions. After running IPython -pylab in your shell if at the top of
+the result of this command, you see something like ::
+ 
+
+   `ERROR: matplotlib could NOT be imported!  Starting normal
+      IPython.`
+
+
+{{{ Slide with Error written on it }}}
+
+Then you have to install matplotlib and run this command again.
+
+Now type in your ipython shell ::
+
+             In[]: linpace?
+
+
+
+as the documentation says, it returns `num` evenly spaced samples,
+calculated over the interval start and stop.  To illustrate this, lets
+do it form 1 to 100 and try 100 points.  ::
+
+           In[]: linspace(1,100,100)
+
+As you can see a sequence of numbers from 1 to 100 appears.
+
+Now lets try 200 points between 0 and 1 you do this by typing ::
+
+
+            In[]: linspace(0,1,200)
+
+0 for start , 1 for stop and 200 for no of points.  In linspace 
+the start and stop points can be integers, decimals , or
+constants. Let's try and get 100 points between -pi to pi. Type ::
+           
+            In[]: p = linspace(-pi,pi,100)
+
+
+'pi' here is constant defined by pylab. Save this to the variable, p
+.
+
+If you now ::
+     
+	   In[]: len(p)
+
+You will get the no. of points. len function gives the no of elements
+of a sequence.
+
+
+Let's try and plot a cosine curve between -pi and pi using these
+points.  Simply type :: 
+
+
+       	  In[]: plot(p,cos(points))
+
+Here cos(points) gets the cosine value at every corresponding point to
+p.
+
+
+We can also save cos(points) to variable cosine and plot it using
+plot.::
+
+           In[]: cosine=cos(points) 
+
+	   In[]: plot(p,cosine)
+
+ 
+
+Now do ::
+       	 
+	   In[]: clf()
+
+this will clear the plot.
+
+This is done because any other plot we try to make shall come on the
+same drawing area. As we do not wish to clutter the area with
+overlaid plots , we just clear it with clf().  Now lets try a sine
+plot. ::
+
+
+    	 In []: plot(p,sin(p))
+
+
+
+ 
+The Window on which the plot appears can be used to study it better.
+
+First of all moving the mouse around gives us the point where mouse
+points at.  
+
+Also we have some buttons the right most among them is
+for saving the file. 
+
+Just click on it specifying the name of the file.  We will save the plot 
+by the name sin_curve in pdf format.
+
+{{{ Action corelating with the words }}}
+
+As you can see I can specify format of file.  
+Left to the save button is the slider button to specify the margins.  
+
+{{{ Action corelating with the words  }}}
+
+Left to this is zoom button to zoom into the plot. Just specify the 
+region to zoom into.  
+The button left to it can be used to move the axes of the plot.  
+
+{{{ Action corelating with the words }}}
+ 
+The next two buttons with a left and right arrow icons change the state of the 
+plot and take it to the previous state it was in. It more or less acts like a
+back and forward button in the browser.  
+
+{{{ Action corelating with the words }}}
+
+The last one is 'home' referring to the initial plot.
+
+{{{ Action corelating with the words}}}
+
+
+
+{{{ Summary Slide }}}
+
+
+In this tutorial we have looked at 
+
+1. Starting Ipython with pylab 
+
+2. Using linspace function to create `num` equaly spaced points in a region.
+
+3. Finding length of sequnces using  len.
+ 
+4. Plotting mathematical functions using plot.
+
+4. Clearing drawing area using clf 
+ 
+5. Using the UI of plot for studying it better . Using functionalities like save , zoom , moving the plots on x and y axis 
+
+etc ..
+ 
+
+
+{{{ Show the "sponsored by FOSSEE" slide }}}
+
+ 
+
+This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India
+
+ 
+
+ Hope you have enjoyed and found it useful.
+
+ Thankyou
+
+ 
+
+Author              : Amit Sethi
+Internal Reviewer   :
+Internal Reviewer 2 : 
--- a/presentations/basic-plot.tex	Sun Apr 11 02:13:03 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +0,0 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%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}
-
-% Taken from Fernando's slides.
-\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}}}  }
-
-%%% This is from Fernando's setup.
-% \usepackage{color}
-% \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
-% % Use and configure listings package for nicely formatted code
-% \usepackage{listings}
-% \lstset{
-%    language=Python,
-%    basicstyle=\small\ttfamily,
-%    commentstyle=\ttfamily\color{blue},
-%    stringstyle=\ttfamily\color{orange},
-%    showstringspaces=false,
-%    breaklines=true,
-%    postbreak = \space\dots
-% }
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Title page
-\title[Basic Plotting]{Python for Scientific Computing : Basic Plotting}
-
-\author[FOSSEE] {FOSSEE}
-
-\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
-\date{}
-
-% DOCUMENT STARTS
-\begin{document}
-
-\begin{frame}
-  \maketitle
-\end{frame}
-
-\begin{frame}
-  \frametitle{About the Session}
-  \begin{block}{Intended Audience}
-  \begin{itemize}
-       \item Engg., Mathematics and Science teachers.
-       \item Interested students from similar streams.
-  \end{itemize}
-  \end{block}  
-
-  \begin{block}{Goal: Successful participants will be able to}
-    \begin{itemize}
-      \item Use Python as a basic Plotting tool.
-    \end{itemize}
-  \end{block}
-\end{frame}
-
-\begin{frame}
-\frametitle{Checklist}
-   \begin{itemize}
-    \item IPython
-    \item Pylab
-  \end{itemize}
-\end{frame}
-
-%% \begin{frame}[fragile]
-%% \frametitle{Starting up \ldots}
-%% \begin{block}{}
-%% \begin{verbatim}
-%%   $ ipython -pylab  
-%% \end{verbatim}
-%% \end{block}
-%% \begin{lstlisting}     
-%%   In []: print "Hello, World!"
-%%   Hello, World!
-%% \end{lstlisting}
-%% Exiting
-%% \begin{lstlisting}     
-%%   In []: ^D(Ctrl-D)
-%%   Do you really want to exit([y]/n)? y
-%% \end{lstlisting}
-%% \end{frame}
-
-\begin{frame}[fragile]
-  \frametitle{Summary}
-  \begin{block}{IPython}
-    \begin{itemize}
-    \item Starting and Quiting.
-    \item AutoCompletion
-    \item Help
-    \end{itemize}
-  \end{block}
-  \begin{block}{Plotting}
-    \begin{itemize}    
-    \item Creating simple plots.
-    \item Adding labels and legends.
-    \item Annotating plots.
-    \item Changing the looks: size, linewidth, colors
-    \end{itemize}  
-  \end{block}
-\end{frame}
-
-\begin{frame}
-  \frametitle{Thank you!}  
-  \begin{block}{}
-    This is first tutorial from the series of
-    \begin{center}      
-      \textcolor{blue}{'Python for Scientific Computing'}.
-    \end{center}
-  \end{block}
-  \begin{block}{}
-  It is part of \textcolor{blue}{FOSSEE} project funded by:
-  \begin{center}
-    \textcolor{blue}{NME through ICT from MHRD, Govt. of India}.
-  \end{center}  
-  \end{block}
-\end{frame}
-
-\end{document}
-
Binary file presentations/data/L-TSq-limited.png has changed
Binary file presentations/data/L-Tsq-Line.png has changed
Binary file presentations/data/L-Tsq-points.png has changed
Binary file presentations/data/L-Tsq.png has changed
Binary file presentations/data/all_regions.png has changed
Binary file presentations/data/annotate.png has changed
Binary file presentations/data/dash.png has changed
Binary file presentations/data/filter.png has changed
Binary file presentations/data/firstplot.png has changed
Binary file presentations/data/fwdDiff.png has changed
Binary file presentations/data/green.png has changed
Binary file presentations/data/interpolate.png has changed
Binary file presentations/data/label.png has changed
Binary file presentations/data/least-sq-fit.png has changed
Binary file presentations/data/legend.png has changed
Binary file presentations/data/lena.png has changed
Binary file presentations/data/loc.png has changed
Binary file presentations/data/missing_points.png has changed
--- a/presentations/data/pendulum.txt	Sun Apr 11 02:13:03 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-1.0000e-01 6.9004e-01
-1.1000e-01 6.9497e-01
-1.2000e-01 7.4252e-01
-1.3000e-01 7.5360e-01
-1.4000e-01 8.3568e-01
-1.5000e-01 8.6789e-01
-1.6000e-01 8.4182e-01
-1.7000e-01 8.5379e-01
-1.8000e-01 8.5762e-01
-1.9000e-01 8.8390e-01
-2.0000e-01 8.9985e-01
-2.1000e-01 9.8436e-01
-2.2000e-01 1.0244e+00
-2.3000e-01 1.0572e+00
-2.4000e-01 9.9077e-01
-2.5000e-01 1.0058e+00
-2.6000e-01 1.0727e+00
-2.7000e-01 1.0943e+00
-2.8000e-01 1.1432e+00
-2.9000e-01 1.1045e+00
-3.0000e-01 1.1867e+00
-3.1000e-01 1.1385e+00
-3.2000e-01 1.2245e+00
-3.3000e-01 1.2406e+00
-3.4000e-01 1.2071e+00
-3.5000e-01 1.2658e+00
-3.6000e-01 1.2995e+00
-3.7000e-01 1.3142e+00
-3.8000e-01 1.2663e+00
-3.9000e-01 1.2578e+00
-4.0000e-01 1.2991e+00
-4.1000e-01 1.3058e+00
-4.2000e-01 1.3478e+00
-4.3000e-01 1.3506e+00
-4.4000e-01 1.4044e+00
-4.5000e-01 1.3948e+00
-4.6000e-01 1.3800e+00
-4.7000e-01 1.4480e+00
-4.8000e-01 1.4168e+00
-4.9000e-01 1.4719e+00
-5.0000e-01 1.4656e+00
-5.1000e-01 1.4399e+00
-5.2000e-01 1.5174e+00
-5.3000e-01 1.4988e+00
-5.4000e-01 1.4751e+00
-5.5000e-01 1.5326e+00
-5.6000e-01 1.5297e+00
-5.7000e-01 1.5372e+00
-5.8000e-01 1.6094e+00
-5.9000e-01 1.6352e+00
-6.0000e-01 1.5843e+00
-6.1000e-01 1.6643e+00
-6.2000e-01 1.5987e+00
-6.3000e-01 1.6585e+00
-6.4000e-01 1.6317e+00
-6.5000e-01 1.7074e+00
-6.6000e-01 1.6654e+00
-6.7000e-01 1.6551e+00
-6.8000e-01 1.6964e+00
-6.9000e-01 1.7143e+00
-7.0000e-01 1.7706e+00
-7.1000e-01 1.7622e+00
-7.2000e-01 1.7260e+00
-7.3000e-01 1.8089e+00
-7.4000e-01 1.7905e+00
-7.5000e-01 1.7428e+00
-7.6000e-01 1.8381e+00
-7.7000e-01 1.8182e+00
-7.8000e-01 1.7865e+00
-7.9000e-01 1.7995e+00
-8.0000e-01 1.8296e+00
-8.1000e-01 1.8625e+00
-8.2000e-01 1.8623e+00
-8.3000e-01 1.8383e+00
-8.4000e-01 1.8593e+00
-8.5000e-01 1.8944e+00
-8.6000e-01 1.9598e+00
-8.7000e-01 1.9000e+00
-8.8000e-01 1.9244e+00
-8.9000e-01 1.9397e+00
-9.0000e-01 1.9440e+00
-9.1000e-01 1.9718e+00
-9.2000e-01 1.9383e+00
-9.3000e-01 1.9555e+00
-9.4000e-01 2.0006e+00
-9.5000e-01 1.9841e+00
-9.6000e-01 2.0066e+00
-9.7000e-01 2.0493e+00
-9.8000e-01 2.0503e+00
-9.9000e-01 2.0214e+00
Binary file presentations/data/plot1.png has changed
Binary file presentations/data/plot10.png has changed
Binary file presentations/data/plot11.png has changed
Binary file presentations/data/plot2.png has changed
Binary file presentations/data/plot3.png has changed
Binary file presentations/data/plot4.png has changed
Binary file presentations/data/plot5.png has changed
Binary file presentations/data/plot6.png has changed
Binary file presentations/data/plot7.png has changed
Binary file presentations/data/plot8.png has changed
Binary file presentations/data/plot9.png has changed
--- a/presentations/data/points.txt	Sun Apr 11 02:13:03 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-0.01 153.990844267
-0.06 156.161844972
-0.11 158.226964724
-0.16 160.191367397
-0.21 162.059965021
-0.26 163.837430063
-0.31 165.528207113
-0.36 167.136523992
-0.41 168.666402332
-0.46 170.121667625
-0.51 171.505958792
-0.56 172.822737282
-0.61 174.075295727
-0.66 175.266766176
-0.71 176.400127926
-1.26 185.75176924
-1.31 186.373771356
-1.36 186.965438071
-1.41 187.52824886
-1.46 188.063611042
-1.51 187.533026401
-1.56 177.900088899
-1.61 168.736955303
-1.66 160.020713006
-1.71 151.729566862
-1.76 143.842784687
-1.81 136.340645417
-1.86 129.204389797
-1.91 122.416173471
-1.96 115.959022361
-2.51 62.67951023
-2.56 59.135750565
-2.61 55.7648220983
-2.66 52.5582957529
-2.71 49.5081535427
-2.76 46.6067685235
-2.81 43.8468857214
-2.86 41.2216039918
-2.91 38.7243587631
-2.96 36.3489056213
--- a/presentations/data/pos.txt	Sun Apr 11 02:13:03 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-0.  0.
-0.25     0.47775
-0.5    0.931
-0.75     1.35975
-1.     1.764
-1.25     2.14375
-1.5    2.499
-1.75     2.82975
-2.     3.136
-2.25     3.41775
-2.5    3.675
-2.75     3.90775
-3.     4.116
-3.25     4.29975
-3.5    4.459
-3.75     4.59375
-4.     4.704
-4.25     4.78975
-4.5    4.851
-4.75     4.88775
-5.   4.9
-5.25     4.88775
-5.5    4.851
-5.75     4.78975
-6.     4.704
-6.25     4.59375
-6.5    4.459
-6.75     4.29975
-7.     4.116
-7.25     3.90775
-7.5    3.675
-7.75     3.41775
-8.     3.136
-8.25     2.82975
-8.5    2.499
-8.75     2.14375
-9.     1.764
-9.25     1.35975
-9.5    0.931
-9.75     0.47775
-10.   0.
Binary file presentations/data/pos_vel_accel.png has changed
Binary file presentations/data/position.png has changed
Binary file presentations/data/science.png has changed
Binary file presentations/data/smoothing.gif has changed
Binary file presentations/data/stline_dots.png has changed
Binary file presentations/data/stline_points.png has changed
Binary file presentations/data/straightline.png has changed
Binary file presentations/data/title.png has changed
--- a/presentations/plotting-files.tex	Sun Apr 11 02:13:03 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%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}
-
-% Taken from Fernando's slides.
-\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}}}  }
-
-%%% This is from Fernando's setup.
-% \usepackage{color}
-% \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
-% % Use and configure listings package for nicely formatted code
-% \usepackage{listings}
-% \lstset{
-%    language=Python,
-%    basicstyle=\small\ttfamily,
-%    commentstyle=\ttfamily\color{blue},
-%    stringstyle=\ttfamily\color{orange},
-%    showstringspaces=false,
-%    breaklines=true,
-%    postbreak = \space\dots
-% }
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Title page
-\title{Python for Scientific Computing : Plotting Experimental Data}
-
-\author[FOSSEE] {FOSSEE}
-
-\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
-\date{}
-
-% DOCUMENT STARTS
-\begin{document}
-
-\begin{frame}
-  \maketitle
-\end{frame}
-
-\begin{frame}
-  \frametitle{About the Session}
-  \begin{block}{Goal}
-    Plotting experimental data via lists or files 
-  \end{block}
-  \begin{block}{Checklist}
-    \begin{itemize}
-    \item pendulum.txt
-  \end{itemize}
-  \end{block}
-\end{frame}
-
-\begin{frame}[fragile]
-  \frametitle{Summary}
-  \begin{block}{lists}
-    \begin{itemize}
-    \item Creation.
-    \item Appending.
-    \item Iterating through list.
-    \end{itemize}
-  \end{block}
-  \begin{block}{Data processing}
-    \begin{itemize}
-    \item In form of lists.
-    \item Handling files.
-    \item for loops  
-    \end{itemize}  
-  \end{block}
-\end{frame}
-
-\begin{frame}
-  \frametitle{Thank you!}  
-  \begin{block}{}
-  This session is part of \textcolor{blue}{FOSSEE} project funded by:
-  \begin{center}
-    \textcolor{blue}{NME through ICT from MHRD, Govt. of India}.
-  \end{center}  
-  \end{block}
-\end{frame}
-
-\end{document}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sets.rst	Fri Sep 17 14:33:35 2010 +0530
@@ -0,0 +1,149 @@
+Hello friends and welcome to the tutorial on Sets
+
+{{{ Show the slide containing title }}}
+
+{{{ Show the slide containing the outline slide }}}
+
+In this tutorial, we shall learn
+
+ * sets
+ * operations on sets
+
+Sets are data structures which contain unique elements. In other words,
+duplicates are not allowed in sets.
+
+Lets look at how to input sets.
+type
+::
+ 
+    a_list = [1, 2, 1, 4, 5, 6, 7]
+    a = set(a_list)
+    a
+     
+We can see that duplicates are removed and the set contains only unique
+elements. 
+::
+
+    f10 = set([1, 2, 3, 5, 8])
+    p10 = set([2, 3, 5, 7])
+
+f10 is the set of fibonacci numbers from 1 to 10.
+p10 is the set of prime numbers from 1 to 10.
+
+Various operations that we do on sets are possible here also.
+The | character stands for union
+::
+
+    f10 | p10
+
+gives us the union of f10 and p10
+
+The & character stands for intersection.
+::
+
+    f10 & p10
+
+gives the intersection
+
+similarly,
+::
+
+    f10 - p10
+
+gives all the elements that are in f10 but not in p10
+
+::
+
+    f10 ^ p10
+
+is all the elements in f10 union p10 but not in f10 intersection p10. In
+mathematical terms, it gives the symmectric difference.
+
+Sets also support checking of subsets.
+::
+
+    b = set([1, 2])
+    b < f10
+
+gives a True since b is a proper subset of f10.
+Similarly,
+::
+
+    f10 < f10
+
+gives a False since f10 is not a proper subset.
+hence the right way to do would be
+::
+
+    f10 <= f10
+
+and we get a True since every set is a subset of itself.
+
+Sets can be iterated upon just like lists and tuples. 
+::
+
+    for i in f10:
+        print i,
+
+prints the elements of f10.
+
+The length and containership check on sets is similar as in lists and tuples.
+::
+
+    len(f10)
+
+shows 5. And
+::
+    
+    1 in f10
+    2 in f10
+
+prints True and False respectively
+
+The order in which elements are organised in a set is not to be relied upon 
+since sets do not support indexing. Hence, slicing and striding are not valid
+on sets.
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 1 %% Given a list of marks, marks = [20, 23, 22, 23, 20, 21, 23] 
+        list all the duplicates
+
+{{{ continue from paused state }}}
+
+Duplicates marks are the marks left out when we remove each element of the 
+list exactly one time.
+
+::
+
+    marks = [20, 23, 22, 23, 20, 21, 23] 
+    marks_set = set(marks)
+    for mark in marks_set:
+        marks.remove(mark)
+
+    # we are now left with only duplicates in the list marks
+    duplicates = set(marks)
+
+{{{ Show summary slide }}}
+
+This brings us to the end of the tutorial.
+we have learnt
+
+ * How to make sets from lists
+ * How to input sets
+ * How to perform union, intersection and symmectric difference operations
+ * How to check if a set is a subset of other
+ * The various similarities with lists like length and containership
+
+{{{ 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
+ 
+.. Author              : Nishanth
+   Internal Reviewer 1 : 
+   Internal Reviewer 2 : 
+   External Reviewer   :
--- a/solving-equations.org	Sun Apr 11 02:13:03 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-* Solving Equations
-*** Outline
-***** Introduction
-******* What are we going to do?
-******* How are we going to do?
-******* Arsenal Required
-********* working knowledge of arrays
-
-*** Script
-    Welcome. 
-    
-    In this tutorial we shall look at solving linear equations, roots
-    of polynomials and other non-linear equations. In the process, we
-    shall look at defining functions. 
-
-    Let's begin with solving linear equations. 
-    {show a slide of the equations}
-    We shall use the solve function, to solve this system of linear
-    equations.  Solve requires the coefficients and the constants to
-    be in the form of matrices to solve the system of linear equations. 
-
-    We begin by entering the coefficients and the constants as
-    matrices. 
-
-    In []: A = array([[3,2,-1],
-                      [2,-2,4],                   
-                      [-1, 0.5, -1]])
-    In []: b = array([1, -2, 0])
-
-    Now, we can use the solve function to solve the given system. 
-    
-    In []: x = solve(A, b)
-
-    Type x, to look at the solution obtained. 
-
-    Next, we verify the solution by obtaining a product of A and x,
-    and comparing it with b. Note that we should use the dot function
-    here, and not the * operator. 
-
-    In []: Ax = dot(A, x)
-    In []: Ax
-
-    The result Ax, doesn't look exactly like b, but if you carefully
-    observe, you will see that it is the same as b. To save yourself
-    this trouble, you can use the allclose function. 
-
-    allclose checks if two matrices are close enough to each other
-    (with-in the specified tolerance level). Here we shall use the
-    default tolerance level of the function. 
-
-    In []: allclose(Ax, b)
-    The function returns True, which implies that the product of A &
-    x, and b are close enough. This validates our solution x. 
-
-    Let's move to finding the roots of polynomials. We shall use the
-    roots function to calculate the roots of the polynomial x^2-5x+6. 
-
-    The function requires an array of the coefficients of the
-    polynomial in the descending order of powers. 
-    
-    In []: coeffs = [1, -5, 6]
-    In []: roots(coeffs)
-    As you can see, roots returns the coefficients in an array. 
-
-    To find the roots of any arbitrary function, we use the fsolve
-    function. We shall use the function sin(x)+cos^2(x) as our
-    function, in this tutorial. First, of all we import fsolve, since it
-    is not already available to us. 
-
-    In []: from scipy.optimize import fsolve
-
-    Now, let's look at the arguments of fsolve using fsolve?
-    
-    In []: fsolve?
-
-    The first argument, func, is a python function that takes atleast
-    one argument. So, we should now define a python function for the
-    given mathematical expression sin(x)+cos^2(x). 
-
-    The second argument, x0, is the initial estimate of the roots of
-    the function. Based on this initial guess, fsolve returns a root. 
-
-    Before, going ahead to get a root of the given expression, we
-    shall first learn how to define a function in python. 
-    Let's define a function called f, which returns values of the
-    given mathematical expression (sin(x)+cos^2(x)) for a each input. 
-
-    In []: def f(x):
-               return sin(x)+cos(x)*cos(x)
-   
-    def, is a key word in python that tells the interpreter that a
-    function definition is beginning. f, here, is the name of the
-    function and x is the lone argument of the function. The whole
-    definition of the function is done with in an indented block. Our
-    function f has just one line in it's definition. 
-
-    You can test your function, by calling it with an argument for
-    which the output value is know, say x = 0. We can see that
-    sin(x) + cos^2(x) has a value of 1, when x = 0. 
-
-    Let's check our function definition, by calling it with 0 as an
-    argument. 
-    In []: f(0)
-    We can see that the output is as expected. 
-
-    Now, that we have our function, we can use fsolve to obtain a root
-    of the expression sin(x)+cos^2(x). Recall that fsolve takes
-    another argument, the initial guess. Let's use 0 as our initial
-    guess. 
-
-    In []: fsolve(f, 0)
-    fsolve has returned a root of sin(x)+cos^2(x) that is close to 0. 
-
-    That brings us to the end of this tutorial on solving linear
-    equations, finding roots of polynomials and other non-linear
-    equations. We have also learnt how to define functions and call
-    them. 
-
-    Thank you!
-
-*** Notes
--- a/statistics.txt	Sun Apr 11 02:13:03 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-Hello welcome to the tutorial on statistics and dictionaries in Python.
-
-In the previous tutorial we saw the `for' loop and lists. Here we shall look into
-calculating mean for the same pendulum experiment and then move on to calculate
-the mean, median and standard deviation for a very large data set.
-
-Let's start with calculating the mean acceleration due to gravity based on the data from pendulum.txt.
-
-We first create an empty list `g_list' to which we shall append the values of `g'.
-In []: g_list = []
-
-For each pair of `L' and `t' values in the file `pendulum.txt' we calculate the 
-value of `g' and append it to the list `g_list'
-In []: for line in open('pendulum.txt'):
-  ....     point = line.split()
-  ....     L = float(point[0])
-  ....     t = float(point[1])
-  ....     g = 4 * pi * pi * L / (t * t)
-  ....     g_list.append(g)
-
-We proceed to calculate the mean of the value of `g' from the list `g_list'. 
-Here we shall show three ways of calculating the mean. 
-Firstly, we calculate the sum `total' of the values in `g_list'.
-In []: total = 0
-In []: for g in g_list:
- ....:     total += g
- ....:
-
-Once we have the total we calculate by dividing the `total' by the length of `g_list'
-
-In []: g_mean = total / len(g_list)
-In []: print 'Mean: ', g_mean
-
-The second method is slightly simpler. Python provides a built-in function called "sum()" that computes the sum of all the elements in a list. 
-In []: g_mean = sum(g_list) / len(g_list)
-In []: print 'Mean: ', g_mean
-
-The third method is the simplest. Python provides a built-in function `mean' that
-calculates the mean of all the elements in a list.
-In []: g_mean = mean(g_list)
-In []: print 'Mean: ', g_mean
-
-Python provides support for dictionaries. Dictionaries are key value pairs. Lists are indexed by integers while dictionaries are indexed by strings. For example:
-In []: d = {'png' : 'image',
-      'txt' : 'text', 
-      'py' : 'python'} 
-is a dictionary. The first element in the pair is called the `key' and the second 
-is called the `value'. The key always has to be a string while the value can be 
-of any type.
-
-Dictionaries are indexed using their keys as shown
-In []: d['txt']
-Out[]: 'text'
-
-In []: d['png']
-Out[]: 'image'
-
-The dictionaries can be searched for the presence of a certain key by typing
-In []: 'py' in d
-Out[]: True
-
-In []: 'jpg' in d
-Out[]: False
-Please note the values cannot be searched in a dictionaries.
-
-In []: d.keys()
-Out[]: ['py', 'txt', 'png']
-is used to obtain the list of all keys in a dictionary
-
-In []: d.values()
-Out[]: ['python', 'text', 'image']
-is used to obtain the list of all values in a dictionary
-
-In []: d
-Out[]: {'png': 'image', 'py': 'python', 'txt': 'text'}
-Please observe that dictionaries do not preserve the order in which the items
-were entered. The order of the elements in a dictionary should not be relied upon.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/symbolics.rst	Fri Sep 17 14:33:35 2010 +0530
@@ -0,0 +1,248 @@
+Symbolics with Sage
+-------------------
+
+This tutorial on using Sage for symbolic calculation is brought to you
+by Fossee group.
+
+{{{ Part of Notebook with title }}}
+
+We would be using simple mathematical functions on the sage notebook
+for this tutorial .
+
+During the course of the tutorial we will learn
+
+
+{{{ Part of Notebook with outline }}}
+
+To define symbolic expressions in sage .  Use built-in costants and
+function.  Integration , differentiation using sage .  Defining
+matrices.  Defining Symbolic functions .  Simplifying and solving
+symbolic expressions and functions
+    
+
+
+Using sage we can perform mathematical operations on symbols .
+
+On the sage notebook type::
+   
+    sin(y)
+
+It raises a name error saying that y is not defined . But in sage we
+can declare y as a symbol using var function. ::
+   
+    var('y')
+   
+Now if you type::
+
+    sin(y)
+
+     sage simply returns the expression .
+
+thus now sage treats sin(y) as a symbolic expression . You can use
+this to do a lot of symbolic maths using sage's built-in constants and
+expressions .
+
+Try out ::
+   
+   var('x,alpha,y,beta') x^2/alpha^2+y^2/beta^2
+ 
+Similarly , we can define many algebraic and trigonometric expressions
+using sage .
+
+
+
+Sage also provides a few built-in constants which are commonly used in
+mathematics .
+
+example : pi,e,oo , Function n gives the numerical values of all these
+    constants.
+
+For instance::
+
+   n(e)
+   
+   2.71828182845905
+
+gives numerical value of e.
+
+If you look into the documentation of n by doing ::
+
+   n(<Tab>
+
+You will see what all arguments it can take etc .. It will be very
+helpful if you look at the documentation of all functions introduced
+      
+
+Also we can define the no of digits we wish to use in the numerical
+value . For this we have to pass an argument digits.  Type::
+  
+   n(pi, digits = 10)
+
+Apart from the constants sage also has a lot of builtin functions like
+sin,cos,sinh,cosh,log,factorial,gamma,exp,arcsin,arccos,arctan etc ...
+lets try some out on the sage notebook. ::
+     
+   sin(pi/2)
+   
+   arctan(oo)
+     
+   log(e,e)
+
+
+Given that we have defined variables like x,y etc .. , We can define
+an arbitrary function with desired name in the following way.::
+
+       var('x') function(<tab> {{{ Just to show the documentation
+       extend this line }}} function('f',x)
+
+Here f is the name of the function and x is the independent variable .
+Now we can define f(x) to be ::
+
+     f(x) = x/2 + sin(x)
+
+Evaluating this function f for the value x=pi returns pi/2.::
+	   
+	   f(pi)
+
+We can also define function that are not continuous but defined
+piecewise.  We will be using a function which is a parabola between 0
+to 1 and a constant from 1 to 2 .  type the following as given on the
+screen::
+      
+
+      var('x') h(x)=x^2 g(x)=1 f=Piecewise(<Tab> {{{ Just to show the
+      documentation extend this line }}}
+      f=Piecewise([[(0,1),h(x)],[(1,2),g(x)]],x) f
+
+Checking f at 0.4, 1.4 and 3 :: f(0.4) f(1.4) f(3)
+
+for f(3) it raises a value not defined in domain error .
+
+
+Apart from operations on expressions and functions one can also use
+them for series .
+
+We first define a function f(n) in the way discussed above.::
+
+   var('n') function('f', n)
+
+
+To sum the function for a range of discrete values of n, we use the
+sage function sum.
+
+ For a convergent series , f(n)=1/n^2 we can say ::
+   
+   var('n') function('f', n)
+
+   f(n) = 1/n^2
+
+   sum(f(n), n, 1, oo)
+
+For the famous Madhava series :: var('n') function('f', n)
+
+    f(n) = (-1)^(n-1)*1/(2*n - 1)
+
+This series converges to pi/4. It was used by ancient Indians to
+interpret pi.
+
+For a divergent series, sum would raise a an error 'Sum is
+divergent' :: 
+	
+	var('n') 
+	function('f', n) 
+	f(n) = 1/n sum(f(n), n,1, oo)
+
+
+
+
+We can perform simple calculus operation using sage
+
+For example lets try an expression first ::
+
+    diff(x**2+sin(x),x) 2x+cos(x)
+
+The diff function differentiates an expression or a function . Its
+first argument is expression or function and second argument is the
+independent variable .
+
+We have already tried an expression now lets try a function ::
+
+   f=exp(x^2)+arcsin(x) diff(f(x),x)
+
+To get a higher order differentiation we need to add an extra argument
+for order ::
+ 
+   diff(<tab> diff(f(x),x,3)
+
+
+in this case it is 3.
+
+
+Just like differentiation of expression you can also integrate them ::
+
+     x = var('x') s = integral(1/(1 + (tan(x))**2),x) s
+
+
+
+To find factors of an expression use the function factor
+
+    factor(<tab> y = (x^100 - x^70)*(cos(x)^2 + cos(x)^2*tan(x)^2) f =
+    factor(y)
+
+One can also simplify complicated expression using sage ::
+    f.simplify_full()
+
+This simplifies the expression fully . You can also do simplification
+of just the algebraic part and the trigonometric part ::
+
+    f.simplify_exp() f.simplify_trig()
+    
+
+One can also find roots of an equation by using find_root function::
+
+    phi = var('phi') find_root(cos(phi)==sin(phi),0,pi/2)
+
+Lets substitute this solution into the equation and see we were
+correct ::
+
+     var('phi') f(phi)=cos(phi)-sin(phi)
+     root=find_root(f(phi)==0,0,pi/2) f.substitute(phi=root)
+
+
+as we can see the solution is almost equal to zero .
+
+
+We can also define symbolic matrices ::
+
+
+
+   var('a,b,c,d') A=matrix([[a,1,0],[0,b,0],[0,c,d]]) A
+
+
+Now lets do some of the matrix operations on this matrix ::
+
+
+    A.det() A.inverse()
+
+You can do ::
+    
+    A.<Tab>
+
+To see what all operations are available
+
+
+{{{ Part of the notebook with summary }}}
+
+So in this tutorial we learnt how to
+
+
+We learnt about defining symbolic expression and functions .  
+And some built-in constants and functions .  
+Getting value of built-in constants using n function.  
+Using Tab to see the documentation.  
+Also we learnt how to sum a series using sum function.  
+diff() and integrate() for calculus operations .  
+Finding roots , factors and simplifying expression using find_root(), 
+factor() , simplify_full, simplify_exp , simplify_trig .
+Substituting values in expression using substitute function.
+And finally creating symbolic matrices and performing operation on them .
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tuples.rst	Fri Sep 17 14:33:35 2010 +0530
@@ -0,0 +1,149 @@
+Hello friends and welcome to the tutorial on Tuples
+
+{{{ Show the slide containing title }}}
+
+{{{ Show the slide containing the outline slide }}}
+
+In this tutorial, we shall learn
+
+ * what are tuples
+ * their similarities and dissimilarities with lists
+ * why are they needed
+
+Let`s get started by defining a tuple. A tuple is defined by enclosing
+parantheses around a sequence of items seperated by commas. It is similar to
+defining a list except that parantheses are used instead of square brackets.
+::
+
+    t = (1, 2.5, "hello", -4, "world", 1.24, 5)
+    t
+
+defines a tuple. The items in the tuple are indexed using numbers and can be 
+accessed by using their position.
+::
+
+    t[3]
+
+prints -4 which is the fourth item of the tuple.
+
+::
+
+    t[1:5:2]
+
+prints the corresponding slice
+
+This is the behaviour similar as to lists. But the difference can be seen when
+we try to change an element in the tuple.
+::
+
+    t[2] = "Hello"
+
+We can see that, it raises an error saying tuple does not support item
+assignment. It only implies that tuples are immutable or in simple words,
+tuples cannot be changed.
+
+But what is the use of tuples!!!
+
+We shall understand that soon. But let us look at a simple problem of swapping
+values.
+
+{{{ Pause here and try out the following exercises }}}
+
+%% 1 %% a = 5 and b = 7. swap the values of a and b
+
+{{{ continue from paused state }}}
+::
+
+    a = 5
+    b = 7
+
+    a
+    b
+
+We define the two values
+::
+    temp = a
+    a = b
+    b = temp
+
+    a
+    b
+
+This is the traditional approach
+
+Now let us do it the python way
+::
+
+    a
+    b
+
+    a, b = b, a
+
+    a
+    b
+
+We see that the values are swapped.
+This idiom works for different datatypes also.
+::
+
+    a = 2.5
+    b = "hello"
+
+    a
+    b
+
+Moreover this type of behaviour is straight forward and what you would expect
+should happen naturally.
+
+This is possible because of the immutability of tuples. This process is called
+tuple packing and unpacking.
+
+Let us first see what is tuple packing. Type
+::
+
+    5,
+
+What we see is a tuple with one element.
+::
+
+    5, "hello", 2.5
+
+Now it is a tuple with two elements.
+
+So when we are actually typing two or more elements seperated by commas, those
+elements are packed and a tuple is made from them.
+
+When you type
+::
+
+    a, b = b, a
+
+First the values of b and a are packed into a tuple on the right side and then
+unpacked into the variables a and b.
+
+Immutability of tuples ensures that the values are not changed during the
+packing and unpacking.
+
+{{{ Show summary slide }}}
+
+This brings us to the end of the tutorial.
+we have learnt
+
+ * How to define tuples
+ * The similarities of tuples with lists, like indexing and iterability
+ * The immutability of tuples
+ * The value swapping idiom in Python
+ * packing and unpacking of tuples
+
+{{{ 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
+ 
+.. Author              : Nishanth
+   Internal Reviewer 1 : 
+   Internal Reviewer 2 : 
+   External Reviewer   :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/using-sage.rst	Fri Sep 17 14:33:35 2010 +0530
@@ -0,0 +1,119 @@
+========
+ Script
+========
+
+{{{ show the welcome slide }}}
+
+Welcome to this tutorial on using Sage.
+
+{{{ show the slide with outline }}} 
+
+In this tutorial we shall quickly look at a few examples of the areas
+(name the areas, here) in which Sage can be used and how it can be
+used.
+
+{{{ show the slide with Calculus outline }}} 
+
+Let us begin with Calculus. We shall be looking at limits,
+differentiation, integration, and Taylor polynomial.
+
+{{{ show sage notebook }}}
+
+We have our Sage notebook running. In case, you don't have it running,
+start is using the command, ``sage --notebook``.
+
+To find the limit of the function x*sin(1/x), at x=0, we say::
+
+   lim(x*sin(1/x), x=0)
+
+We get the limit to be 0, as expected. 
+
+It is also possible to the limit at a point from one direction. For
+example, let us find the limit of 1/x at x=0, when approaching from
+the positive side.::
+
+    lim(1/x, x=0, dir='above')
+
+To find the limit from the negative side, we say,::
+
+    lim(1/x, x=0, dir='above')   
+
+Let us now see how to differentiate, using Sage. We shall find the
+differential of the expression ``exp(sin(x^2))/x`` w.r.t ``x``. We
+shall first define the expression, and then use the ``diff`` function
+to obtain the differential of the expression.::
+
+    var('x')
+    f = exp(sin(x^2))/x
+
+    diff(f, x)
+
+We can also obtain the partial differentiation of an expression w.r.t
+one of the variables. Let us differentiate the expression
+``exp(sin(y - x^2))/x`` w.r.t x and y.::
+
+    var('x y')
+    f = exp(sin(y - x^2))/x
+
+    diff(f, x)
+
+    diff(f, y)
+
+Now, let us look at integration. We shall use the expression obtained
+from the differentiation that we did before, ``diff(f, y)`` ---
+``e^(sin(-x^2 + y))*cos(-x^2 + y)/x``. The ``integrate`` command is
+used to obtain the integral of an expression or function.::
+
+    integrate(e^(sin(-x^2 + y))*cos(-x^2 + y)/x, y)
+
+We get back the correct expression. The minus sign being inside or
+outside the ``sin`` function doesn't change much. 
+
+Now, let us find the value of the integral between the limits 0 and
+pi/2. ::
+
+    integral(e^(sin(-x^2 + y))*cos(-x^2 + y)/x, y, 0, pi/2)
+
+Let us now see how to obtain the Taylor expansion of an expression
+using sage. Let us obtain the Taylor expansion of ``(x + 1)^n`` up to
+degree 4 about 0.::
+
+    var('x n')
+    taylor((x+1)^n, x, 0, 4)
+
+This brings us to the end of the features of Sage for Calculus, that
+we will be looking at. For more, look at the Calculus quick-ref from
+the Sage Wiki. 
+
+Next let us move on to Matrix Algebra. 
+
+{{{ show the equation on the slides }}}
+
+Let us begin with solving the equation ``Ax = v``, where A is the
+matrix ``matrix([[1,2],[3,4]])`` and v is the vector
+``vector([1,2])``. 
+
+To solve the equation, ``Ax = v`` we simply say::
+
+    x = solve_right(A, v)
+
+To solve the equation, ``xA = v`` we simply say::
+
+    x = solve_left(A, v)
+
+The left and right here, denote the position of ``A``, relative to x. 
+
+
+
+Now, let us look at Graph Theory in Sage. 
+
+Graph: G = Graph({0:[1,2,3], 2:[4]})
+Directed Graph: DiGraph(dictionary)
+Graph families: graphs. tab
+Invariants: G.chromatic polynomial(), G.is planar()
+Paths: G.shortest path()
+Visualize: G.plot(), G.plot3d()
+Automorphisms: G.automorphism group(), G1.is isomorphic(G2), G1.is subgraph(G2)
+
+Now let us look at bits and pieces of Number theory, combinatorics, 
+