Added changes to array.org file and basic plotting.
--- a/arrays.org Tue Mar 30 15:40:44 2010 +0530
+++ b/arrays.org Tue Mar 30 17:15:22 2010 +0530
@@ -57,21 +57,22 @@
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.
+ Note that the total size(number of elements) of new array must
+ be unchanged.
- We type a, to see what it looks like
+ We check re-shaped 'a' by
In []: a
- ones command can be used to get an array with all the entries as
- 1s. We pass it the shape of the array that we require.
+ 'ones' function can be used to get an array with all the entries as
+ 1s. We pass it the shape of the required array. For ex.
In []: b = ones((3, 4))
- Look at b, by printing it out.
+ b is 3(cross)4 array with all 1s
In []: b
To create an array with all entries as ones, with a shape similar to
- an already existing array, we use the ones_like command.
+ an already existing array, we use the ones_like function.
In []: b = ones_like(a)
zeros and zeros_like are similar commands that can give you arrays
@@ -91,20 +92,22 @@
---
- Now that we have learnt how to create arrays, let move on to
+ Now that we have learnt how to create arrays, lets 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
+ Let's say we want to access the element 23 in c(second row
+ third column), 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.
+ Additionally 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.
@@ -126,6 +129,7 @@
We could use the colon to access specific portions of an array.
In []: c[1,1:2]
+ second column, from second row(1) till third(2) and excluding it
In []: c[1:2,1]
In []: c[1:2,1:2]
...
--- a/basic-plot.txt Tue Mar 30 15:40:44 2010 +0530
+++ b/basic-plot.txt Tue Mar 30 17:15:22 2010 +0530
@@ -1,14 +1,17 @@
* Script
-In this tutorial, we will cover the basics of Plotting features available in Python. We shall use Ipython and pylab. Ipython is An Enhanced Interactive Python interpreter. It provides additional features like tab completion, help etc. pylab is python library which provides plotting functionality.
+Hello, in this tutorial, we will cover the basics of Plotting features available in Python. We shall use Ipython and pylab. Ipython is An Enhanced Interactive Python interpreter. It provides additional features like tab completion, help etc. pylab is python library which provides plotting functionality.
+
+I am assuming that you have them installed on your system.
Lets start ipython. Open up your terminal and type the following.
$ ipython -pylab
+press RETURN
This will give us a prompt where we can get started.
-First, we create an array with equally spaced points from 0 to 2*pi
+First, we create a sequence of equally spaced points from 0 to 2*pi
In []: x = linspace(0, 2*pi, 100)
We have passed three arguments to linspace function - the first point, the last point and the total number of points.