[Date Index]
[Thread Index]
[Author Index]
RE: RE: Generating Two Unit Orthogonal Vectors
*To*: mathgroup at smc.vnet.net
*Subject*: [mg36476] RE: [mg36448] RE: Generating Two Unit Orthogonal Vectors
*From*: "DrBob" <drbob at bigfoot.com>
*Date*: Sun, 8 Sep 2002 03:31:00 -0400 (EDT)
*Reply-to*: <drbob at bigfoot.com>
*Sender*: owner-wri-mathgroup at wolfram.com
Wouldn't it be nice if NullSpace's behavior were DOCUMENTED? Otherwise,
it's futile to give it approximate numbers expecting any particular
behavior. Even if it always works, it may not work in the next version
of Mathematica.
Bobby
-----Original Message-----
From: Ersek, Ted R [mailto:ErsekTR at navair.navy.mil]
To: mathgroup at smc.vnet.net
Subject: [mg36476] [mg36448] RE: Generating Two Unit Orthogonal Vectors
David Park replied with
----------------
Daniel Lichtblau has pointed out that NullSpace does not generally give
orthogonal vectors. Therefore the routines that depended upon that were
in
error. He says that it does give orthogonal vectors when the input
vector
contains approximate numbers. For graphical purposes this will be good
enough for me. Therefore I modify Ted's routine to
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
Prev by Date:
**Arbitrary Crash with Compile**
Next by Date:
**Re: Mathematica 4.2: Problem with online help.**
Previous by thread:
**RE: Generating Two Unit Orthogonal Vectors**
Next by thread:
**Re: RE: RE: Generating Two Unit Orthogonal Vectors**
| |