Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #5411 > unrolled thread

Thread::tdlen: Objects of unequal length

Started bySysInv <johan@systeminvestors.se>
First post2011-10-05 08:17 +0000
Last post2011-10-06 08:34 +0000
Articles 6 — 5 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Thread::tdlen: Objects of unequal length SysInv <johan@systeminvestors.se> - 2011-10-05 08:17 +0000
    Re: Thread::tdlen: Objects of unequal length Peter Pein <petsie@dordos.net> - 2011-10-06 08:21 +0000
    Re: Thread::tdlen: Objects of unequal length David Reiss <dbreiss@gmail.com> - 2011-10-06 08:21 +0000
    Re: Thread::tdlen: Objects of unequal length David Reiss <dbreiss@gmail.com> - 2011-10-06 08:22 +0000
    Re: Thread::tdlen: Objects of unequal length Michael Weyrauch <michael.weyrauch@gmx.de> - 2011-10-06 08:33 +0000
    Re: Thread::tdlen: Objects of unequal length A Retey <awnl@gmx-topmail.de> - 2011-10-06 08:34 +0000

#5411 — Thread::tdlen: Objects of unequal length

FromSysInv <johan@systeminvestors.se>
Date2011-10-05 08:17 +0000
SubjectThread::tdlen: Objects of unequal length
Message-ID<j6h3re$76t$1@smc.vnet.net>
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.000199939,-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...

[toc] | [next] | [standalone]


#5422

FromPeter Pein <petsie@dordos.net>
Date2011-10-06 08:21 +0000
Message-ID<j6jodd$m0q$1@smc.vnet.net>
In reply to#5411
Am 05.10.2011 10:17, schrieb SysInv:
> 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.000199939,-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...
>

1.) wrap curly braces around the sequence of lists in the assignment to t.
2.) use matrix-multiplication

In[5]:= s.t.Transpose[s]
Out[5]= {{x2 (0.00395759 x1+0.0113862 x2-0.000199939 x3-0.000556137 
x4)+x3 (0.000211963 x1-0.000199939 x2+0.00118147 x3-0.00043913 x4)+x1 
(0.0284435 x1+0.00395759 x2+0.000211963 x3+0.0357403 x4)+(0.0357403 
x1-0.000556137 x2-0.00043913 x3+0.0649449 x4) x4}}

alternatively you can write the input as Dot[s, t, s\[Transpose]], where 
\[Transpose] can be entered as <esc>tr<esc>.

[toc] | [prev] | [next] | [standalone]


#5423

FromDavid Reiss <dbreiss@gmail.com>
Date2011-10-06 08:21 +0000
Message-ID<j6joec$m1j$1@smc.vnet.net>
In reply to#5411
P.S.  If you type "Matrix multiplication" into the Help browser you
will get a link to the tutorial on how to perform matrix operations.

--David


On Oct 5, 4:17 am, SysInv <jo...@systeminvestors.se> wrote:
> 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.000 199939,-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...

[toc] | [prev] | [next] | [standalone]


#5424

FromDavid Reiss <dbreiss@gmail.com>
Date2011-10-06 08:22 +0000
Message-ID<j6jog9$m2s$1@smc.vnet.net>
In reply to#5411
You want to compute s.t.Transpose[s]  rather than s*t*Transpose[s].
An asterisk is multiplication .  A dot is matrix multiplication.

--David


On Oct 5, 4:17 am, SysInv <jo...@systeminvestors.se> wrote:
> 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.000 199939,-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...

[toc] | [prev] | [next] | [standalone]


#5437

FromMichael Weyrauch <michael.weyrauch@gmx.de>
Date2011-10-06 08:33 +0000
Message-ID<j6jp3t$mbk$1@smc.vnet.net>
In reply to#5411
For matrix multiplication you must use Dot[].
Then it will work easily.

Michael

Am 5.10.2011 10:17, schrieb SysInv:
> 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.000199939,-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...
>

[toc] | [prev] | [next] | [standalone]


#5440

FromA Retey <awnl@gmx-topmail.de>
Date2011-10-06 08:34 +0000
Message-ID<j6jp6q$mc6$1@smc.vnet.net>
In reply to#5411
Am 05.10.2011 10:17, schrieb SysInv:
> 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.000199939,-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...
>

Times (*) is element wise multiplication, I guess you want Dot (.):

s.t.Transpose[s]

hth,

albert

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web