RE: Generating Two Unit Orthogonal Vectors
- To: mathgroup at smc.vnet.net
- Subject: [mg36471] RE: Generating Two Unit Orthogonal Vectors
- From: dennisw555 at aol.com (DennisW555)
- Date: Sun, 8 Sep 2002 03:30:50 -0400 (EDT)
- References: <alc8og$sdp$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
>OrthogonalUnitVectors[vect__?(VectorQ[#, NumericQ] &)] /; > (SameQ @@ Length /@ {vect}) && (Length[First[{vect}]] > 1) := > #/Sqrt[#.#] & /@ NullSpace[{vect}// N] > >---------------- > >Lets see what NullSpace does with approximate complex vectors. > >In[1]:= > v1 = {1.0 I, 0.0, 0.5 I, 0.0, 1.0}; > v2 = {0.0, 2.0, 1.0 I, 2.0, 0.5}; > {v3,v4,v5} = NullSpace[{v1,v2}] > >Out[3]= > {{-0.730153 + 0.*I, 0. - 0.138254*I, 0.250585 + 0.*I, 0. - 0.138254*I, >0. >+ 0.60486*I}, > {0. + 0.*I, -0.515861 + 0.*I, 0. + 0.457321*I, 0.687357 + 0.*I, 0.22866 >+ 0.*I}, > {0. + 0.*I, 0.510406 + 0.*I, 0. + 0.740442*I, -0.23274 + 0.*I, 0.370221 >+ 0.*I}} > >-------- >In the next line we see NullSpace returned vectors that are orthogonal to >the vectors we gave NullSpace. > >In[4]:= > {v1.v3, v1.v4, v1.v5, v2.v3, v2.v4, v2.v5}//Chop > >Out[4]= > {0, 0, 0, 0, 0, 0} > >---------- >However, the vectors returned aren't orthogonal to each other. > >In[5]:= > {v3.v4, v3.v5, v4.v5}//Chop > >Out[5]= > {0.229195*I, 0.371087*I, -0.677239} > >--------- >I suppose an OrthogonalUnitVectors function that uses NullSpace should > (1) Only accept real valued vectors. > (2) Ensure NullSpace is given approximate vectors. > >------ >Regards, > Ted Ersek I think you will find that the output vectors are orthogonal if you use the complex conjugate. for example v4.Conjugate[v5] is zero. Dennis Wangsness