(*^ ::[ Information = "This is a Mathematica Notebook file. It contains ASCII text, and can be transferred by email, ftp, or other text-file transfer utility. It should be read or edited using a copy of Mathematica or MathReader. If you received this as email, use your mail application or copy/paste to save everything from the line containing (*^ down to the line containing ^*) into a plain text file. On some systems you may have to give the file a name ending with ".ma" to allow Mathematica to recognize it as a Notebook. The line below identifies what version of Mathematica created this file, but it can be opened using any other version as well."; FrontEndVersion = "Macintosh Mathematica Notebook Front End Version 2.2"; MacintoshStandardFontEncoding; fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e8, 24, "Times"; fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e6, 18, "Times"; fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, e6, 14, "Times"; fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, a20, 18, "Times"; fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, a15, 14, "Times"; fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, a12, 12, "Times"; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; fontset = input, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L-5, 12, "Courier"; fontset = output, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; fontset = message, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, R65535, L-5, 12, "Courier"; fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, B65535, L-5, 12, "Courier"; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, 12, "Courier"; fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, 10, "Geneva"; fontset = header, inactive, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = leftheader, inactive, L2, 12, "Times"; fontset = footer, inactive, noKeepOnOnePage, preserveAspect, center, M7, 12, "Times"; fontset = leftfooter, inactive, L2, 12, "Times"; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; paletteColors = 128; automaticGrouping; currentKernel; ] :[font = input; initialization; preserveAspect] *) $Post:=If[MatrixQ[#],MatrixForm[#],#]& (* :[font = input; preserveAspect] Exercise 4.2.1 :[font = input; preserveAspect] By tabulating the solutions of LinearSolve, we obtain on the ROWS the solutions X[[i]] of F.X[[i]]=L[b[[i]]]; in the above equation nevertheless, the X[[i]]'s are column vectors, so if we want to build a matrix with them in order to preserve the result of F.X, we have to put the X[[i]] solutions as columnns, hence transpose. :[font = input; initialization; preserveAspect] *) Exercise 4.2.2 (* :[font = input; initialization; preserveAspect; startGroup] *) b=Table[If[i==j,0,1],{i,7},{j,7}]; B=Transpose[b] (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{0, 1, 1, 1, 1, 1, 1}, {1, 0, 1, 1, 1, 1, 1}, {1, 1, 0, 1, 1, 1, 1}, {1, 1, 1, 0, 1, 1, 1}, {1, 1, 1, 1, 0, 1, 1}, {1, 1, 1, 1, 1, 0, 1}, {1, 1, 1, 1, 1, 1, 0}}] ;[o] 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 :[font = input; initialization; preserveAspect] *) Of course transposing was not necessary here, but it was done to make clear our intention to have the b[i]'s as columns in B. (* :[font = input; initialization; preserveAspect; startGroup] *) c=Table[i+j-1,{i,7},{j,7}]; Unprotect[C]; C=Transpose[c] (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{1, 2, 3, 4, 5, 6, 7}, {2, 3, 4, 5, 6, 7, 8}, {3, 4, 5, 6, 7, 8, 9}, {4, 5, 6, 7, 8, 9, 10}, {5, 6, 7, 8, 9, 10, 11}, {6, 7, 8, 9, 10, 11, 12}, {7, 8, 9, 10, 11, 12, 13}}] ;[o] 1 2 3 4 5 6 7 2 3 4 5 6 7 8 3 4 5 6 7 8 9 4 5 6 7 8 9 10 5 6 7 8 9 10 11 6 7 8 9 10 11 12 7 8 9 10 11 12 13 :[font = input; initialization; preserveAspect; startGroup] *) S=C.Inverse[B] (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{11/3, 8/3, 5/3, 2/3, -1/3, -4/3, -7/3}, {23/6, 17/6, 11/6, 5/6, -1/6, -7/6, -13/6}, {4, 3, 2, 1, 0, -1, -2}, {25/6, 19/6, 13/6, 7/6, 1/6, -5/6, -11/6}, {13/3, 10/3, 7/3, 4/3, 1/3, -2/3, -5/3}, {9/2, 7/2, 5/2, 3/2, 1/2, -1/2, -3/2}, {14/3, 11/3, 8/3, 5/3, 2/3, -1/3, -4/3}}] ;[o] 11 8 5 2 1 4 7 -- - - - -(-) -(-) -(-) 3 3 3 3 3 3 3 23 17 11 5 1 7 13 -- -- -- - -(-) -(-) -(--) 6 6 6 6 6 6 6 4 3 2 1 0 -1 -2 25 19 13 7 1 5 11 -- -- -- - - -(-) -(--) 6 6 6 6 6 6 6 13 10 7 4 1 2 5 -- -- - - - -(-) -(-) 3 3 3 3 3 3 3 9 7 5 3 1 1 3 - - - - - -(-) -(-) 2 2 2 2 2 2 2 14 11 8 5 2 1 4 -- -- - - - -(-) -(-) 3 3 3 3 3 3 3 :[font = input; initialization; preserveAspect] *) T[v_]:=S.v (* :[font = input; initialization; preserveAspect] *) Solution check: (* :[font = input; initialization; preserveAspect; startGroup] *) Do[Print[T[b[[i]]]-c[[i]]],{i,7}] (* :[font = print; inactive; preserveAspect; endGroup] {0, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, 0} :[font = input; initialization; preserveAspect] *) Exercise 4.2.3 (* :[font = input; initialization; preserveAspect; startGroup] *) NullSpace[S] (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{5, -6, 0, 0, 0, 0, 1}, {4, -5, 0, 0, 0, 1, 0}, {3, -4, 0, 0, 1, 0, 0}, {2, -3, 0, 1, 0, 0, 0}, {1, -2, 1, 0, 0, 0, 0}}] ;[o] 5 -6 0 0 0 0 1 4 -5 0 0 0 1 0 3 -4 0 0 1 0 0 2 -3 0 1 0 0 0 1 -2 1 0 0 0 0 :[font = input; initialization; preserveAspect; startGroup] *) RowReduce[Transpose[S]] (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{1, 0, -1, -2, -3, -4, -5}, {0, 1, 2, 3, 4, 5, 6}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}}] ;[o] 1 0 -1 -2 -3 -4 -5 0 1 2 3 4 5 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 :[font = input; initialization; preserveAspect; startGroup] *) {%[[1]],%[[2]]} (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{1, 0, -1, -2, -3, -4, -5}, {0, 1, 2, 3, 4, 5, 6}}] ;[o] 1 0 -1 -2 -3 -4 -5 0 1 2 3 4 5 6 :[font = input; initialization; preserveAspect] *) Exercise 4.2.4 (* :[font = input; initialization; preserveAspect; startGroup] *) B=Array[Min,{6,6}] (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{1, 1, 1, 1, 1, 1}, {1, 2, 2, 2, 2, 2}, {1, 2, 3, 3, 3, 3}, {1, 2, 3, 4, 4, 4}, {1, 2, 3, 4, 5, 5}, {1, 2, 3, 4, 5, 6}}] ;[o] 1 1 1 1 1 1 1 2 2 2 2 2 1 2 3 3 3 3 1 2 3 4 4 4 1 2 3 4 5 5 1 2 3 4 5 6 :[font = input; initialization; preserveAspect] *) Crd[v_]:=Inverse[B].v (* :[font = input; initialization; preserveAspect; startGroup] *) u=Array[U,6] v=Array[V,6] (* :[font = output; output; inactive; preserveAspect] {U[1], U[2], U[3], U[4], U[5], U[6]} ;[o] {U[1], U[2], U[3], U[4], U[5], U[6]} :[font = output; output; inactive; preserveAspect; endGroup] {V[1], V[2], V[3], V[4], V[5], V[6]} ;[o] {V[1], V[2], V[3], V[4], V[5], V[6]} :[font = input; initialization; preserveAspect] *) a) (* :[font = input; initialization; preserveAspect; startGroup] *) Crd[u+v]-(Crd[u]+Crd[v])//Simplify (* :[font = output; output; inactive; preserveAspect; endGroup] {0, 0, 0, 0, 0, 0} ;[o] {0, 0, 0, 0, 0, 0} :[font = input; initialization; preserveAspect; startGroup] *) Crd[k u]-k Crd[u]//Simplify (* :[font = output; output; inactive; preserveAspect; endGroup] {0, 0, 0, 0, 0, 0} ;[o] {0, 0, 0, 0, 0, 0} :[font = input; initialization; preserveAspect] *) Exercise 4.2.5 (* :[font = input; initialization; preserveAspect; startGroup] *) S=Inverse[B] (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{2, -1, 0, 0, 0, 0}, {-1, 2, -1, 0, 0, 0}, {0, -1, 2, -1, 0, 0}, {0, 0, -1, 2, -1, 0}, {0, 0, 0, -1, 2, -1}, {0, 0, 0, 0, -1, 1}}] ;[o] 2 -1 0 0 0 0 -1 2 -1 0 0 0 0 -1 2 -1 0 0 0 0 -1 2 -1 0 0 0 0 -1 2 -1 0 0 0 0 -1 1 :[font = input; initialization; preserveAspect] *) Exercise 4.2.6 (* :[font = input; initialization; preserveAspect; startGroup] *) f=Table[Min[j-i+1,1],{i,6},{j,9}]; F=Transpose[f] (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{1, 0, -1, -2, -3, -4}, {1, 1, 0, -1, -2, -3}, {1, 1, 1, 0, -1, -2}, {1, 1, 1, 1, 0, -1}, {1, 1, 1, 1, 1, 0}, {1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1}}] ;[o] 1 0 -1 -2 -3 -4 1 1 0 -1 -2 -3 1 1 1 0 -1 -2 1 1 1 1 0 -1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 :[font = input; initialization; preserveAspect; startGroup] *) d=Table[1+Min[i,j],{i,6},{j,9}]; Unprotect[D]; D=Transpose[d] (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{2, 2, 2, 2, 2, 2}, {2, 3, 3, 3, 3, 3}, {2, 3, 4, 4, 4, 4}, {2, 3, 4, 5, 5, 5}, {2, 3, 4, 5, 6, 6}, {2, 3, 4, 5, 6, 7}, {2, 3, 4, 5, 6, 7}, {2, 3, 4, 5, 6, 7}, {2, 3, 4, 5, 6, 7}}] ;[o] 2 2 2 2 2 2 2 3 3 3 3 3 2 3 4 4 4 4 2 3 4 5 5 5 2 3 4 5 6 6 2 3 4 5 6 7 2 3 4 5 6 7 2 3 4 5 6 7 2 3 4 5 6 7 :[font = input; initialization; preserveAspect; startGroup] *) SL=Array[LinearSolve[B,D[[#]]]&,9] (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{2, 0, 0, 0, 0, 0}, {1, 1, 0, 0, 0, 0}, {1, 0, 1, 0, 0, 0}, {1, 0, 0, 1, 0, 0}, {1, 0, 0, 0, 1, 0}, {1, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 1}}] ;[o] 2 0 0 0 0 0 1 1 0 0 0 0 1 0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 1 0 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 :[font = input; initialization; preserveAspect] *) L[v_]:=SL.v (* :[font = input; initialization; preserveAspect; startGroup] *) Do[Print[L[B[[i]]]-d[[i]]],{i,6}] (* :[font = print; inactive; preserveAspect; endGroup] {0, 0, 0, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, 0, 0, 0} :[font = input; initialization; preserveAspect] *) Clear[T] T[vB_]:=LinearSolve[F,SL.B.vB] (* :[font = input; initialization; preserveAspect] *) Solution check: (* :[font = input; initialization; preserveAspect; startGroup] *) T[{1,1,1,1,1,1}]-Sum[LinearSolve[F,d[[i]]],{i,6}] (* :[font = output; output; inactive; preserveAspect; endGroup] {0, 0, 0, 0, 0, 0} ;[o] {0, 0, 0, 0, 0, 0} :[font = input; initialization; preserveAspect; startGroup] *) T[u+v]-(T[u]+T[v])//Expand (* :[font = output; output; inactive; preserveAspect; endGroup] {0, 0, 0, 0, 0, 0} ;[o] {0, 0, 0, 0, 0, 0} :[font = input; initialization; preserveAspect; startGroup] *) T[k u]-k T[u]//Expand (* :[font = output; output; inactive; preserveAspect; endGroup] {0, 0, 0, 0, 0, 0} ;[o] {0, 0, 0, 0, 0, 0} :[font = input; initialization; preserveAspect] *) Exercise 4.2.7 (* :[font = input; initialization; preserveAspect; startGroup] *) ST=Array[LinearSolve[f,IdentityMatrix[6][[#]]]&,6].SL.B (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{2, 2, 3, 4, 5, 6}, {0, 1, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0}, {0, 0, 0, 1, 0, 0}, {0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 1}}] ;[o] 2 2 3 4 5 6 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 :[font = input; initialization; preserveAspect] *) Solution check: (* :[font = input; initialization; preserveAspect; startGroup] *) T[u]-ST.u//Simplify (* :[font = output; output; inactive; preserveAspect; endGroup] {0, 0, 0, 0, 0, 0} ;[o] {0, 0, 0, 0, 0, 0} :[font = input; initialization; preserveAspect] *) Exercise 4.2.8 (* :[font = input; initialization; preserveAspect; startGroup] *) A=Table[i+j,{i,5},{j,7}] (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{2, 3, 4, 5, 6, 7, 8}, {3, 4, 5, 6, 7, 8, 9}, {4, 5, 6, 7, 8, 9, 10}, {5, 6, 7, 8, 9, 10, 11}, {6, 7, 8, 9, 10, 11, 12}}] ;[o] 2 3 4 5 6 7 8 3 4 5 6 7 8 9 4 5 6 7 8 9 10 5 6 7 8 9 10 11 6 7 8 9 10 11 12 :[font = input; initialization; preserveAspect; startGroup] *) b={35,42,49,56,63} (* :[font = output; output; inactive; preserveAspect; endGroup] {35, 42, 49, 56, 63} ;[o] {35, 42, 49, 56, 63} :[font = input; initialization; preserveAspect; startGroup] *) sp=LinearSolve[A,b] (* :[font = output; output; inactive; preserveAspect; endGroup] {-14, 21, 0, 0, 0, 0, 0} ;[o] {-14, 21, 0, 0, 0, 0, 0} :[font = input; initialization; preserveAspect; startGroup] *) NullSpace[A] (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{5, -6, 0, 0, 0, 0, 1}, {4, -5, 0, 0, 0, 1, 0}, {3, -4, 0, 0, 1, 0, 0}, {2, -3, 0, 1, 0, 0, 0}, {1, -2, 1, 0, 0, 0, 0}}] ;[o] 5 -6 0 0 0 0 1 4 -5 0 0 0 1 0 3 -4 0 0 1 0 0 2 -3 0 1 0 0 0 1 -2 1 0 0 0 0 :[font = input; initialization; preserveAspect; startGroup] *) sh=Sum[t[i]%[[i]],{i,5}] (* :[font = output; output; inactive; preserveAspect; endGroup] {5*t[1] + 4*t[2] + 3*t[3] + 2*t[4] + t[5], -6*t[1] - 5*t[2] - 4*t[3] - 3*t[4] - 2*t[5], t[5], t[4], t[3], t[2], t[1]} ;[o] {5 t[1] + 4 t[2] + 3 t[3] + 2 t[4] + t[5], -6 t[1] - 5 t[2] - 4 t[3] - 3 t[4] - 2 t[5], t[5], t[4], t[3], t[2], t[1]} :[font = input; initialization; preserveAspect; startGroup] *) sg=sp+sh (* :[font = output; output; inactive; preserveAspect; endGroup] {-14 + 5*t[1] + 4*t[2] + 3*t[3] + 2*t[4] + t[5], 21 - 6*t[1] - 5*t[2] - 4*t[3] - 3*t[4] - 2*t[5], t[5], t[4], t[3], t[2], t[1]} ;[o] {-14 + 5 t[1] + 4 t[2] + 3 t[3] + 2 t[4] + t[5], 21 - 6 t[1] - 5 t[2] - 4 t[3] - 3 t[4] - 2 t[5], t[5], t[4], t[3], t[2], t[1]} :[font = input; initialization; preserveAspect] *) Clear[L] L[x_]:=A.x (* :[font = input; initialization; preserveAspect; startGroup] *) L[sg]-b//Expand (* :[font = output; output; inactive; preserveAspect; endGroup] {0, 0, 0, 0, 0} ;[o] {0, 0, 0, 0, 0} ^*)