Re: GramSchmidt Orthogonalization question
- To: mathgroup at smc.vnet.net
- Subject: [mg14361] Re: [mg14291] GramSchmidt Orthogonalization question
- From: Jurgen Tischer <jtischer at col2.telecom.com.co>
- Date: Thu, 15 Oct 1998 00:29:02 -0400
- Organization: Universidad del Valle
- References: <199810130521.BAA08509@smc.vnet.net.>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Steve, you can fix it yourself. In the package there is a function named Projection. This function does not expect a null vector. Since your third vector in the Gram-Schmidt sequence is zero, it tries to divide by zero. Replace it with something like Projection[v1_,v2_,opts___] := Module[{ip}, {ip} = {InnerProduct}/.{opts}/.Options[Projection]; If[ip[v2,v2]==0,v2, ip[v1,v2] v2/ip[v2,v2]] ] and it will do what you want. By the way, you should be aware that the default inner product Orthogonalization is using is real, so your resulting vectors are not orthogonal in the usual sense, you should give the complex inner product as an option to GramSchmidt. Jurgen Steve Reagan wrote: > > The LinearAlgebra'Orthogonalization' package seems to have a problem > when dealing with a set of dependent vectors: > > <<LinearAlgebra`Orthogonalization` > v1={3+2I,3-2I,5}; > v2={3-2I,3+2I,5}; > v3={5,7,-12}; > v4=2*v1; > v5=-7*v3; > GramSchmidt[{v1,v2,v3,v4},Normalized->False] > > {{3 + 2*I, 3 - 2*I, 5}, > {-48/35 - (172*I)/35, -48/35 + (172*I)/35, -16/7}, {330/43, 330/43, > -396/43}, > {0, 0, 0}} > > GramSchmidt[{v1,v2,v3,v4,v5},Normalized->False] Power::infy Infinite > expression 1/0 encountered. indet:Indeterminate expression > 0*ComplexInfinity encountered. > > {{3 + 2*I, 3 - 2*I, 5}, {-48/35 - (172*I)/35, -48/35 + (172*I)/35, > -16/7}, {330/43, 330/43, -396/43}, > {0, 0, 0}, {Indeterminate, Indeterminate, Indeterminate}} > > When the number of vectors in the input list exceeds the number of > independent ones by exactly one, there is no problem as shown in first > example. But, if a larger list is used for input, errors result as > shown in the second example. > > Is there an extension or package that handles dependent sets such that > an orthogonal set is produced correctly ? > > Thank you in advance, > Steve Reagan
- References:
- GramSchmidt Orthogonalization question
- From: Steve Reagan <swr4f@virginia.edu>
- GramSchmidt Orthogonalization question