MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Tensor cross vector

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115372] Re: Tensor cross vector
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Sun, 9 Jan 2011 02:19:07 -0500 (EST)

----- Original Message -----
> From: "solid-state" <phmech at gmail.com>
> To: mathgroup at smc.vnet.net
> Sent: Saturday, January 8, 2011 2:38:18 AM
> Subject: [mg115341] Tensor cross vector
> Hi, everybody!
> 
> Could anybody please help me on how to find a tensor-vector cross
> product? The "Cross" function seems to work only with vectors.
> Thanks.

There are various generalizations of the cross product, all based in some form on exterior algebra. From your wording I'd guess you have in mind an (n-2)xn matrix and n vector, where the matrix is effectively regarded as the exterior product of its row vectors, and you seek the Hodge star of the exterior product of that multivector with the new vector. This can be attained by the same "trick" taught in college math for finding the ordinary cross product (where you augment a sx3 matrix with the three unit vectors as the top "row").

The code below does this as a Laplace expansion. This is more efficient than direct augmentation with unit vector surrogates in cases where the matrix is numerical, because we now avoid symbolic computations.

crossProduct[mat_List, vec_List] :=
 Catch[Module[
   {dims = Dimensions[mat], n, augmat},
   n = dims[[1]];
   If[Length[dims] != 2 || n + 2 != Length[vec] || n + 2 != dims[[2]],
     Throw[$Failed]];
   augmat = Transpose[Append[mat, vec]];
   Sum[UnitVector[n + 2, j]*(-1)^(j - 1)*Det[Delete[augmat, j]]
    , {j, n + 2}]
   ]]

This shows that it is equivalent to the usual cross product when the dimension is 3.

In[6]:= n = 3;
mat = RandomInteger[{-10, 10}, {n - 2, n}]
vec = RandomInteger[{-10, 10}, {n}]

Out[7]= {{5, 9, 3}}
Out[8]= {4, 7, -1}

In[15]:= crossProduct[mat, vec]
Cross[mat[[1]], vec]

Out[15]= {-30, 17, -1}
Out[16]= {-30, 17, -1}

Daniel Lichtblau
Wolfram Research



  • Prev by Date: Re: Combining Slider and SetterBar in Manipulate
  • Next by Date: how to remove $RecursionLimit::reclim: and $IterationLimit::itlim:
  • Previous by thread: Re: Tensor cross vector
  • Next by thread: Re: Tensor cross vector