Re: Are points co-planar in (numDimensions-1)?
- To: mathgroup at smc.vnet.net
- Subject: [mg43291] Re: Are points co-planar in (numDimensions-1)?
- From: "Eckhard Hennig" <aidev at n-o-s-p-a-m.kaninkolo.de>
- Date: Sat, 23 Aug 2003 08:09:25 -0400 (EDT)
- References: <bi195e$akp$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"AngleWyrm" <no_spam_anglewyrm at hotmail.com> schrieb im Newsbeitrag news:bi195e$akp$1 at smc.vnet.net... > My last post on this subject lacked depth, so here's more info. > > Given some n-dimensional vectors, are they coplanar in n-1? Let a1, a2, ..., an be vectors. If they > are coplanar, then there exists a set of coefficients {k1, k2, ..., kn}, not all zero, which satisfy > the equation: > > k1 a1 + k2 a2 + ... + kn an = 0. > > I have a dataset I wish to test for this property in various dimensions Hi Jonathan, all you have to do to establish coplanarity in R^(n-1) of a set of n-dimensional vectors V is to check whether the null space of the linear mapping defined by V has dimension 1. Here is an example: (* Define 3 linearly independent vectors in R^3. *) b1 = {2, 2, 3}; b2 = {1, -1, 2}; b3 = {1, 0, -1}; (* Generate a set of 20 coplanar 3D vectors by random linear combination of b1 and b2. *) vectors2 = Table[Table[ Random[Real, 100.], {2}].{b1, b2}, {20}] {{141.896, -43.2064, 259.119}, {235.749, 73.7496, 394.124}, {168.208, -1.00792, 294.616}, {226.818, 30.7284, 389.25}, {130.994, -42.3138, 239.819}, {188.267, 145.338, 293.133}, {135.893, -39.0971, 247.588}, {166.104, -20.0404, 295.692}, {255.549, 106.74, 420.526}, {79.3515, -52.4986, 151.99}, {28.6323, -20.5325, 55.2397}, {104.607, -36.8255, 192.268}, {186.737, 122.674, 296.121}, {168.858, -10.575, 298.144}, {118.529, 23.6818, 201.505}, {242.039, 58.6966, 408.894}, {87.5345, -34.0044, 161.686}, {253.772, 113.359, 415.761}, {251.641, 105.093, 414.099}, {187.668, 33.3995, 320.069}} (* The null space of the mapping defined by vectors2 has dimension 1, hence the set is coplanar. *) Length[NullSpace[vectors]] 1 (* NullSpace may be unreliable for large and ill-conditioned systems. A more reliable, but much less efficient alternative is to determine the number of the singular values of the mapping. There are two singular values here. Thus, the set of vectors spans a two-dimensional space, i.e. the vectors are coplanar in R^3. *) Length[SingularValues[vectors2][[2]]] 2 (* Here is a cross-check for the non-coplanar case:*) (* Generate 20 vectors in R^3 by random linear combination of the three independent basis vectors b1, b2, b3. *) vectors3 = Table[Table[ Random[Real, 100.], {3}].{b1, b2, b3}, {20}] {{97.5691, 8.92645, 15.3948}, {209.845, 90.9745, 191.33}, {270.354, 122.235, 307.576}, {301.134, 122.922, 361.611}, {207.461, 120.194, 126.804}, {335.047, 81.3127, 398.899}, {247.852, 75.145, 377.879}, {146.503, -76.1851, 194.489}, {136.244, -92.1843, 148.866}, {243.536, 67.1113, 304.781}, {148.882, 91.5116, 182.38}, {248.666, -1.90047, 244.042}, {167.467, 75.7405, 231.607}, {299.364, 101.095, 285.858}, {124.301, 75.0092, 69.6073}, {247.475, 92.8315, 212.618}, {166.297, 18.9796, 284.875}, {119.518, -69.845, 129.386}, {232.718, 5.92733, 249.302}, {252.431, 127.178, 367.957}} (* The null space is empty, hence b1..b3 span R^3. *) Length[NullSpace[vectors3]] 0 (* The number of singular values equals the dimension of the space. *) Length[SingularValues[vectors3][[2]]] 3 HTH Eckhard -- Dr.-Ing. Eckhard Hennig Ballaufstr. 3, 81735 Munich, Germany eckhard at kaninkolo.de www.kaninkolo.de