{VERSION 5 0 "SUN SPARC SOLARIS" "5.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "" -1 256 "" 0 1 255 0 0 1 0 0 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 257 "" 0 1 255 0 0 1 1 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 258 "" 0 1 255 0 255 1 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 259 "" 0 1 255 0 255 1 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 260 "" 0 1 255 0 255 1 0 1 1 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 256 1 {CSTYLE "" -1 -1 "" 1 24 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 257 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 } {PSTYLE "" 0 258 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 256 "" 0 "" {TEXT 256 10 "Project 3 " }{TEXT 257 10 "(Solution)" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "with(LinearAlgebra):" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 86 "Below you can see how the data vectors were generated (bu t now this is commented out)." }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 170 "#_seed:=3467:\n#vv2:=RandomVector(10):\n#vv3 :=RandomVector(10):\n#vv4:=RandomVector(10):\n#vv1:=2*vv2-vv3:\n#ww:=R andomVector(10):\n#save vv1, vv2, vv3, vv4, ww, \"proj3data.m\";" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 34 "We read the vectors from the file: " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "read \"proj3data.m\";" }}} {EXCHG {PARA 257 "" 0 "" {TEXT 258 9 "Problem 1" }{MPLTEXT 1 0 0 "" }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 24 "a) we compute the norms:" } {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 46 "Norm(vv1,2)^2+N orm(vv2,2)^2,Norm(vv1+vv2,2)^2;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 102 "and we see that the results do not agree. We conclude that the ve ctors vv1 and vv2 are not orthogonal." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 102 "b) We first find the cosine of the angle using the stand ard definition: cos(a) = vv1.vv2/(|vv1||vv2|)." }{MPLTEXT 1 0 0 "" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 62 "cosa:=DotProduct(vv1,vv2)/(Norm(vv1 ,2)*Norm(vv2,2));\nevalf(%);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "a:=evalf(arccos(cosa));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 78 " and we see that the vectors are not orthogonal, confirming what we sai d in a)." }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 112 "c ) We find a basis by using Maple's Basis command (we could, alternativ ely have used the row reduction process)." }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "B:=Basis([vv1,vv2,vv3,vv4]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 193 "Notice that the result is a list of vect ors. So, the basic vectors are B[1], B[2], B[3]. Of course, they are B [1]=vv1, B[2]=vv2 and B[3]=vv4. Thus, dim(S)=3, the number of vectors \+ in the basis." }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 63 "d) We start by normalizing the first vector of the basis, B[1]." } {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "w[1]:=B[1]/Norm (B[1],2):" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 87 "Next we subtract fro m B[2] its projection on w[1]. After that we normalize this vector." } {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 66 "BB[2]:=B[2]-Dot Product(w[1],B[2])*w[1]:\nw[2]:=BB[2]/Norm(BB[2],2):" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 97 "Finally, we subtract from B[3] its projection o n , and normalize the resulting vector." }{MPLTEXT 1 0 0 " " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 93 "BB[3]:=B[3]-DotProduct(w[1],B[3 ])*w[1]-DotProduct(w[2],B[3])*w[2]:\nw[3]:=BB[3]/Norm(BB[3],2):" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 77 "Thus, our orthonormal basis is w[1 ], w[2], w[3], that we display as a matrix:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 17 ";" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 54 "and, for more a more convenient view, its decimal form" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "evalf(%);" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 334 "e) The QRDecomposition command takes a matrix whose co lumns are a basis of a subspace and returns the QR-decomposition of th at matrix. That is, two matrices whose product is the original matrix. The columns of the Q-part (the first matrix) form an orthonormal basi s of the subspace spanned by the columns of the original matrix. Thus: " }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "evalf(QRDeco mposition());" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 154 "and by looking at the first matrix we read the orthonormal basis of S . Notice that this basis coincides with the basis that we found in the previous item." }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 38 "f) We define the vector vs=vv1+...vv4:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "vs:=vv1+vv2+vv3+vv4:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 197 "Then we compute the coordinates of vs with respect to th e basis B'=\{w[1], w[2], w[3]\}. Since the basis B' is orthonormal, th e coefficients are just the dot product of vs with the corresponding w [j]" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 107 "c[1]:=DotProduct(vs,w[1]);e valf(%);\nc[2]:=DotProduct(vs,w[2]);evalf(%);\nc[3]:=DotProduct(vs,w[3 ]);evalf(%);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 31 "Last, we check ou r computation:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "vs,c[1]*w[1]+c[2] *w[2]+c[3]*w[3];" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 63 "Notice that w e could have compared the two vectors using Equal:" }{MPLTEXT 1 0 0 " " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "Equal(vs,c[1]*w[1]+c[2]*w[2]+c[ 3]*w[3]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 204 "g) Since we already know an orthonormal basis of S, we know that the matrix of PS with re spect to the canonical basis is W.Transpose(W), where W is the matrix \+ whose columns are the orthonormal basis of S:" }{MPLTEXT 1 0 0 "" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "W:=:\nMPS:=W.Transp ose(W);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 82 "That result was not ve ry illuminating, so we show it again in floating point form:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "evalf(MPS,3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 75 "A simple test: since vv1 is in S, its projection should b e the same vector:" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "MPS.vv1=vv1;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 101 "h) we firs t find the projection of ww on S (wProj) and the part of ww that is or thogonal to S (wOrth)" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "wProj:=MPS.ww:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 16 " wOrth:=ww-wProj:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 66 "Next we find \+ the cosine of the angle determined by wProj and wOrth" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 60 "cosa:=DotProduct(wProj,wOrth )/(Norm(wProj,2)*Norm(wOrth,2));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 21 "and the angle itself:" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "a:=arccos(cosa);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 144 "So the vectors are orthogonal, as was expected since one was the \+ orthogonal projection on S and the other was in the orthogonal complem ent of S." }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 149 " i) We remember that the reflection on S is computed by RS(v) = 2PS(v)- v, so that its matrix with respect to the canonical basis is MRS=2*MPS -Identity" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "MRS :=2*MPS-IdentityMatrix(10);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 35 "ag ain, we show floating point form:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "evalf(MRS,3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 20 "j) We apply \+ MRS to w" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "wRef :=MRS.ww;\nevalf(wRef,3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 26 "Then we compare the norms:" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "Norm(wRef,2)=Norm(ww,2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 185 "An orthogonal transformation must preserve the length of every vector. We have seen that RS preserves the length of a vector, \+ so, in principle, RS could be an orthogonal transformation." }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 133 "k) We know that a transformation \+ is orthogonal if and only if its associated matrix is orthogonal, that is, if Transpose(M) =M^(-1). " }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 " " {MPLTEXT 1 0 41 "Equal(Transpose(MRS),MatrixInverse(MRS));" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 104 "and we conclude that MRS is an or thogonal matrix so that the reflection is an orthogonal transformation ." }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 258 "" 0 "" {TEXT 259 9 "Problem 2" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 47 "a) We st art by checking that a[0] has length 1:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "int((1/sqrt(2))^2,t=-Pi..Pi)/Pi;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 43 "Next we consider the cosines: a[n] for n>0." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "int((cos(n*t))^2,t=-Pi..Pi)/Pi;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 217 "The result is correct but we would like \+ to see a more simplified answer. For that we have to let Maple know th at n is an integer number. Since we will be also using the integer m b elow we declare to Maple these facts:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "assume(n::integer,m::integer);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 49 "and ask Maple to repeat the previous computation:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "int((cos(n*t))^2,t=-Pi..Pi)/Pi;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 32 "Finally we check the sines b[n]:" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "int((sin(n*t))^2,t=-Pi..Pi)/Pi;" }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 45 "b) we now take any two sin(n*t) a nd cos(m*t):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "int(cos(m*t)*sin(n* t),t=-Pi..Pi)/Pi;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 52 "and sin(nt) \+ against sin(mt) with n different from m:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "int(sin(m*t)*sin(n*t),t=-Pi..Pi)/Pi;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 34 "Finally, the same for the cosines:" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "int(cos(m*t)*cos(n*t),t=-Pi..Pi)/Pi ;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 137 "Remark: notice that wheneve r we wrote n and m for Maple they are different numbers (that is, Mapl e is assuming that they are different). " }{MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 54 "We conclude with the product of a[ 0] and a[n] or b[n]:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "int(1/sqrt( 2)*cos(n*t),t=-Pi..Pi)/Pi;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "int(1 /sqrt(2)*sin(n*t),t=-Pi..Pi)/Pi;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 142 "c) Here and below we will be finding orthogonal projections, so i t will be convenient to define a few things. We start with the inner p roduct:" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "IP:=( f,g)->int(f(t)*g(t),t=-Pi..Pi)/Pi;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 55 "and continue with a few of the a[n] and b[n] functions:" } {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 260 "a[0]:= t->1/sq rt(2):\na[1]:= t->cos(1*t):\na[2]:= t->cos(2*t):\na[3]:= t->cos(3*t): \na[4]:= t->cos(4*t):\na[5]:= t->cos(5*t):\na[6]:= t->cos(6*t):\nb[1]: = t->sin(1*t):\nb[2]:= t->sin(2*t):\nb[3]:= t->sin(3*t):\nb[4]:= t->si n(4*t):\nb[5]:= t->sin(5*t):\nb[6]:= t->sin(6*t):" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 43 "Finally we declare the function f(x)=x^2-1." } {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "ff:=t->t^2-1;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 295 "Next, we could find the projec tion of ff on by P1(ff)=IP(ff,a[0])*a[0]+IP(ff,a[1])* a[1]+ IP(ff,b[1])*b[1]. Instead, since we are going to use it several \+ times, we define a function that does this for an arbitrary n. For exa mple, the previous projection should correspond to n=1." }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 82 "P:=(f,n,t)->sum('IP(f,a[j] )*a[j](t)','j'=0..n)+sum('IP(f,b[j])*b[j](t)','j'=1..n);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 39 "Finally, the projection of ff on T1 is " }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "proj:=t->P(ff, 1,t);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "simplify(proj(t));" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 41 "We see the plot of ff and the proj ection:" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "plot( [ff(t),proj(t)],t=-Pi..Pi);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 49 "Th e last thing is the computation of the \"error\":" }}{PARA 0 "> " 0 " " {MPLTEXT 1 0 35 "sqrt(IP(ff-proj,ff-proj));evalf(%);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 70 "d) We repeat the steps of the previous it em, but this time we use n=2:" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 110 "proj:=t->P(ff,2,t);\nsimplify(proj(t));\nerr:=evalf( sqrt(IP(ff-proj,ff-proj)));\nplot([ff(t),proj(t)],t=-Pi..Pi);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 72 "e) Finally, we compute the errors \+ for n=3,4,... until the error is < 0.2" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 58 "proj:=t->P(ff,3,t):\nerr:=evalf(sqrt(IP(ff-proj,ff-proj)));" } }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 16 "Not there yet..." }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 58 "proj:=t->P(ff,4,t):\nerr:=evalf(sqrt(IP(ff-pro j,ff-proj)));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 8 "Close..." }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 58 "proj:=t->P(ff,5,t):\nerr:=evalf(sqr t(IP(ff-proj,ff-proj)));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 58 "Done. So the projection that achieves the error margin is " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "simplify(proj(t));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 16 "and the plot is:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "pl ot([ff(t),proj(t)],t=-Pi..Pi);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 260 9 "Problem 3" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 36 " a) We start by defining the vectors:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "u[1]:=<1,1>;\nu[2]:=<0,1>;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 182 "The volume of the parallelepiped spanned by u[1] and u[2] is comp uted by the absolute value of the determinant of the matrix that has u [1] in the first column and u[2] in the second:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "abs(Determinant());" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 186 "b) For this (and the next) item we could make a lis t of all the possible candidates by hand but I prefer to have Maple do it for me. In order to achieve this I need the combinat package:" } {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "with(combinat): " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 111 "Next we let N be the dimensi on of our vectors (2 in this case) and vals the possible values for th e components:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "vals:=\{0,1\};" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "N:=2;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 153 "The following lines use the cartprod command to obtain a ll possible vectors with components in vals. The list of all the possi ble vectors is left in bas." }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "T:=cartprod([seq(vals,i=1..N)]):" }}{PARA 0 "> " 0 " " {MPLTEXT 1 0 103 "bas:=\{\}:\nwhile not T[finished] do\n bas:=bas un ion \{convert(T[nextvalue](),Vector)\}:\n end do:\nnops(bas);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 27 "We can see all the vectors:" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "bas;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 85 "But we need a list of all pairs of such vectors. For that we use the choose function:" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "Nples:=choose(bas,N):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "nops(Nples);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 29 "and we ca n see all the pairs:" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "Nples;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 185 "Next we define \+ a function that computes the (absolute value of the) determinant of a \+ pair of vectors. Actually, the function returns the value of the deter minant as well as the vectors." }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 " " {MPLTEXT 1 0 86 "computeDet:= s-> [abs(Determinant(convert(convert(s ,list),Matrix),method=integer)),s];" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 12 "For example:" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "computeDet(Nples[1]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "result:=map(computeDet,Nples):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "result;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 105 "To ma ke it easier to see the result we create a new set were we just keep t he values of the determinants:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 55 "j ustDeterminant:=\{seq(result[i][1],i=1..nops(result))\};" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 394 "So, the maximum value of the absolute va lue of the determinant is 1, and this is also the maximum volume of th e parallelogram spanned by the vectors. To find vectors whose parallel ogram has volume 1, just explore the list result.In view of the next i tems, we may want to do this in a more \"automatic\" way. The followin g code will find an element in result that has volume 1 (the maximum v alue)." }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 112 "for i from 1 to nops(result) do\n if (result[i][1]=1) then\n \+ print(result[i][2]);\n break;\n end if;\nend do;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 81 "c) We repeat step by step everything that we di d above, only that now we use N=3:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "N:=3;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 135 "T:=cartprod([s eq(vals,i=1..N)]):bas:=\{\}:\nwhile not T[finished] do\n bas:=bas unio n \{convert(T[nextvalue](),Vector)\}:\n end do:\nnops(bas);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "Nples:=choose(bas,N):\nnops( Nples);\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "result:=map(co mputeDet,Nples):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 55 "justDet erminant:=\{seq(result[i][1],i=1..nops(result))\};" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 102 "So now the maximum volume is 2. To find a triple of vectors with maximal volume we do as we did above:" }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 112 "for i from 1 to nops(result) do\n if (result [i][1]=2) then\n print(result[i][2]);\n break;\n end if;\nend d o;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 39 "d) Again we repeat everythi ng with N=4:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "N:=4;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 189 "T:=cartprod([seq(vals,i=1..N)]):ba s:=\{\}:\nwhile not T[finished] do\n v:=convert(T[nextvalue](),Vector) ;\n if (not Equal(v,ZeroVector(N))) then\n bas:=bas union \{v\}:\n en d if:\nend do:\nnops(bas);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "Nples:=choose(bas,N):\nnops(Nples);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "result:=map(computeDet,Nples):" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 55 "justDeterminant:=\{seq(result[i][1],i=1..nops( result))\};" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 134 "and we see that t he maximum volume is 3. It seems to be getting obvious: in R^N the max imum volume is N... Could it be a general fact?" }{MPLTEXT 1 0 0 "" }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 60 "Finally, we show a quadruple of v ectors with maximal volume:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 112 "for i from 1 to nops(result) do\n if (result[i][1]=3) then\n print(re sult[i][2]);\n break;\n end if;\nend do;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" } }}}{MARK "50 1 0" 138 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }