diff -r 5c8e88276e1f -r efb8ddf26aff lstsq/quickref.tex --- a/lstsq/quickref.tex Tue Oct 12 10:36:46 2010 +0530 +++ b/lstsq/quickref.tex Tue Oct 12 10:47:28 2010 +0530 @@ -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)|} -Swapping values:\\ -{\ex \lstinline| a, b = b, a|} +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|} +