summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJovina2011-08-02 12:58:08 +0530
committerJovina2011-08-02 12:58:08 +0530
commit4fb4c7f41d00de1d383d0d3f25384cca2a74043f (patch)
treedd4fcec874d162c7d35415875a0af974fbe53dc8
parent4d2ec5b5b96ac3da95d8b7245376e5b6694dfb9e (diff)
downloadst-scripts-4fb4c7f41d00de1d383d0d3f25384cca2a74043f.tar.gz
st-scripts-4fb4c7f41d00de1d383d0d3f25384cca2a74043f.tar.bz2
st-scripts-4fb4c7f41d00de1d383d0d3f25384cca2a74043f.zip
Minor changes to scripts in 4th module.
-rw-r--r--accessing_parts_of_arrays/script.rst14
-rw-r--r--least_square_fit/script.rst20
2 files changed, 17 insertions, 17 deletions
diff --git a/accessing_parts_of_arrays/script.rst b/accessing_parts_of_arrays/script.rst
index aeb1938..48ed2e9 100644
--- a/accessing_parts_of_arrays/script.rst
+++ b/accessing_parts_of_arrays/script.rst
@@ -60,14 +60,14 @@ At the end of this tutorial, you will be able to,
Before beginning this tutorial,we would suggest you to complete the
tutorial on "Getting started with arrays".
-
-.. L4
-
-{{{ Open the terminal }}}
.. R4
As usual, we start IPython, using
+
+.. L4
+
+{{{ Open the terminal }}}
::
ipython -pylab
@@ -211,7 +211,7 @@ just one particular element. We access the third column by saying,
.. L16
::
- C[:, 2]
+ C[:, 2]
.. R17
@@ -225,12 +225,12 @@ Pause the video here, try out the following exercise and resume the video.
.. R18
- Change the last column of C to zeroes.
+ Change the last column of C to zeros.
.. R19
Switch to the terminal for solution.To change the entire last column of
-C to zeroes, we simply say,
+C to zeros, we simply say,
.. L19
diff --git a/least_square_fit/script.rst b/least_square_fit/script.rst
index 429b640..acf6432 100644
--- a/least_square_fit/script.rst
+++ b/least_square_fit/script.rst
@@ -115,6 +115,10 @@ values of m and c.
.. L8
{{{ Switch to the terminal }}}
+::
+
+ inter_mat = array((l, ones_like(l)))
+ inter_mat
.. R8
@@ -122,18 +126,12 @@ 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
-.. L9
-::
-
- inter_mat = array((l, ones_like(l)))
- inter_mat
-
.. R9
We see that we have intermediate matrix. Now we need the transpose.
Type
-.. L10
+.. L9
::
A = inter_mat.T
@@ -145,7 +143,7 @@ Now we have both the matrices A and tsq. We only need to use
the ``lstsq``
Type
-.. L11
+.. L10
::
result = lstsq(A, tsq)
@@ -155,7 +153,7 @@ Type
The result is a sequence of values. The first item in this sequence,
is the matrix p i.e., the values of m and c.
-.. L12
+.. L11
::
m, c = result[0]
@@ -167,7 +165,7 @@ is the matrix p i.e., the values of m and c.
Now that we have m and c, we need to generate the fitted values of t^2.
Type
-.. L13
+.. L12
::
tsq_fit = m * l + c
@@ -178,6 +176,8 @@ Type
We get the least square fit of l vs t^2.
+.. L13
+
.. L14
{{{ Show summary slide }}}