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 /lstsq/quickref.tex | |
parent | eb5c3e4af85a18ccfa59aa585bb76c02896ad55c (diff) | |
download | st-scripts-9cffa0a600ba51e9581a801bd05f3afe1ae9dc6f.tar.gz st-scripts-9cffa0a600ba51e9581a801bd05f3afe1ae9dc6f.tar.bz2 st-scripts-9cffa0a600ba51e9581a801bd05f3afe1ae9dc6f.zip |
Finished lstsq
Diffstat (limited to 'lstsq/quickref.tex')
-rw-r--r-- | lstsq/quickref.tex | 20 |
1 files changed, 12 insertions, 8 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|} |