Re: Problem with Thread over Plus?
- To: mathgroup at smc.vnet.net
- Subject: [mg65391] Re: [mg65370] Problem with Thread over Plus?
- From: "W. Craig Carter" <ccarter at mit.edu>
- Date: Thu, 30 Mar 2006 05:29:42 -0500 (EST)
- References: <200603291134.GAA27493@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
> > Why does this work: > > Thread[ Plus[ {1,1} , { {1,1} , {2,2} } ] ] One way to think of it is that you are attempting to add a vector of length 2 to each column vector of a 2x2 matrix. (e.g., consider that Thread[Plus[{a, b, c}, Transpose[{{1, 1, c}, {2, 2, d}}]]]//MatrixForm does not give an error, but Thread[Plus[{a, b, c}, {{1, 1, c}, {2, 2, d}}]]//MatrixForm does give an error.) Another way to think of it is that: It adds: a) the list {1,1} to the list of first elements of the second list {1,2} producing {2,3} b) the list {1,1} to the list of second elements of the second list {1,2} producing {2,3} > > but this doesn't? > > Thread[ Plus[ {1,1} , { {1,1} , {2,2} , {3,3} } ] ] This attempts to add: a) the list {1,1} to the list of first elements {1,2,3} and incurs an error. It is not clear what you wanted---do you wish to add a 1 to each element of a list? Then 1 + { {a,b},{c,d}} would do the trick.
- References:
- Problem with Thread over Plus?
- From: "Virgilio, Vincent - SSD" <Vincent.Virgilio@itt.com>
- Problem with Thread over Plus?