diff options
author | Nishanth Amuluru | 2010-10-12 10:47:28 +0530 |
---|---|---|
committer | Nishanth Amuluru | 2010-10-12 10:47:28 +0530 |
commit | 9cffa0a600ba51e9581a801bd05f3afe1ae9dc6f (patch) | |
tree | c5b509c9fc080bcf4800cf5e261f37f33bf7a061 | |
parent | eb5c3e4af85a18ccfa59aa585bb76c02896ad55c (diff) | |
download | st-scripts-9cffa0a600ba51e9581a801bd05f3afe1ae9dc6f.tar.gz st-scripts-9cffa0a600ba51e9581a801bd05f3afe1ae9dc6f.tar.bz2 st-scripts-9cffa0a600ba51e9581a801bd05f3afe1ae9dc6f.zip |
Finished lstsq
-rw-r--r-- | lstsq/quickref.tex | 20 | ||||
-rw-r--r-- | lstsq/script.rst | 6 |
2 files changed, 13 insertions, 13 deletions
diff --git a/lstsq/quickref.tex b/lstsq/quickref.tex index a0212b3..e057739 100644 --- a/lstsq/quickref.tex +++ b/lstsq/quickref.tex @@ -1,11 +1,15 @@ -Creating a tuple:\\ -{\ex \lstinline| t = (1, "hello", 2.5)|} +Creating a matrix with all ones:\\ +{\ex \lstinline| o = ones_like(l)|} -Accessing elements of tuples:\\ -{\ex \lstinline| t[index] Ex: t[2]|} +Creating the A matrix:\\ +{\ex \lstinline| A = array(l, ones_like(l)).T|} -Accessing slices of tuples:\\ -{\ex \lstinline| t[start:stop:step]|} +Computing least square:\\ +{\ex \lstinline| result = lstsq(A, tsq)|} + +Obtaining the m and c values:\\ +{\ex \lstinline| m, c = result[0]|} + +Computing the least square fit line:\\ +{\ex \lstinline| lst_line = m * l + c|} -Swapping values:\\ -{\ex \lstinline| a, b = b, a|} diff --git a/lstsq/script.rst b/lstsq/script.rst index 59f1809..a53524e 100644 --- a/lstsq/script.rst +++ b/lstsq/script.rst @@ -1,11 +1,6 @@ .. Objectives .. ---------- -.. A - Students and teachers from Science and engineering backgrounds - B - - C - - D - - .. Plotting a least square fit line .. Prerequisites @@ -13,6 +8,7 @@ .. 1. Basic Plotting .. 2. Arrays +.. 3. Loading data from files .. Author : Nishanth Amuluru Internal Reviewer : |