Re: Thread::tdlen: Objects of unequal length

*To*: mathgroup at smc.vnet.net*Subject*: [mg121923] Re: Thread::tdlen: Objects of unequal length*From*: "David Park" <djmpark at comcast.net>*Date*: Thu, 6 Oct 2011 04:26:28 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*References*: <18407677.92785.1317799907818.JavaMail.root@m06>

To go straight for the answer: (svector = {x1, x2, x3, x4}) // MatrixForm (tmatrix = {{0.0284435, 0.00395759, 0.000211963, 0.0357403}, {0.00395759, 0.0113862, -0.000199939, -0.000556137}, {0.000211963, \ -0.000199939, 0.00118147, -0.00043913}, {0.0357403, -0.000556137, -0.00043913, 0.0649449} }) // MatrixForm svector.tmatrix.svector // Expand The general rules for multiplying (or contracting) arrays of various orders, with contractions occurring at various levels, are: The Prime Rule for Products of 'Tensor' Arrays in Mathematica: S.T dots the lowest level of S with the highest level of T, or equivalently S.T dots the last level of S with the first level of T. The Mathematica Transpose[T,{n1,n2,n3,...}] moves levels {1,2,3,...} to levels {n1,n2,n3,...}. We will always want to move the contracted level to the first or last level when doing Dot products and to the first two levels when doing single array contractions. If R, S, T,... are Mathematica tensor arrays, then their direct product is given by Outer[Times,R,S,T,...]. This will produce a single Mathematica array. The levels are in the same order as the levels in the successive arrays. The basic Mathematica command for contraction of the top two levels in a single array T is Tr[T,Plus,2]. We will have to use Transpose on T to put the contraction slots in the first two levels. We will have to repeat the operation if we want to do multiple contractions. You just have to remain level headed. David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ From: SysInv [mailto:johan at systeminvestors.se] This problem is driving me crazy. I'm trying to multiply matrices, where one is 1x4 (s) and the other is 4x4 (t) and the multiplication is s*t*Transpose[s] Despite this I get the error message that the objects is of unequal length. The matrices are: s={{x1,x2,x3,x4}} t={0.0284435,0.00395759,0.000211963,0.0357403},{0.00395759,0.0113862,-0.0001 99939,-0.000556137},{0.000211963,-0.000199939,0.00118147,-0.00043913},{ 0.0357403,-0.000556137,-0.00043913,0.0649449} I must use double level in the 1 row matrix, since otherwise Transpose[] complains that it needs at least 2 levels. I tried without this as well, but I keep getting: Thread::tdlen : Objects of unequal length in {{x1,x2,x3,x4}}{{0.0284435,0.00395759,0.000211963,0.0357403},<<2>>,{<<10>>,< <3>>}}{{x1},{x2},{x3},{x4}} cannot be combined. >> . when I run s*t*Transpose[s]. I've spent hours trying to figure this simple problem out, but without any luck. Any pointers guys? It doesn't help if I change the order of the transpose...