Re: Problem with Thread over Plus?

*To*: mathgroup at smc.vnet.net*Subject*: [mg65405] Re: [mg65370] Problem with Thread over Plus?*From*: Sseziwa Mukasa <mukasa at jeol.com>*Date*: Thu, 30 Mar 2006 05:30:04 -0500 (EST)*References*: <200603291134.GAA27493@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

On Mar 29, 2006, at 6:34 AM, Virgilio, Vincent - SSD wrote: > > > Hello, > > Why does this work: > > Thread[ Plus[ {1,1} , { {1,1} , {2,2} } ] ] > > but this doesn't? > > Thread[ Plus[ {1,1} , { {1,1} , {2,2} , {3,3} } ] ] In the first case the argument lists are the same length Thread[Plus[{1,1},{{1,1},{2,2}}]] = Thread[{{2,2},{3,3}}] (since the argument to thread is evaluated first) = Thread[List[{2,2},{3,3}] (I'm just explicitly listing the head here to make what happens clear) = {List[2,3],List[2,3]} (This is the result of threading List over its arguments) = {{2,3},{2,3}} I suspect this is not what you intended even though the result is equivalent, I believe you wanted to thread Plus over its arguments, but remember it got evaluated before Thread was applied. There was a recent mailing list discussion of the interaction of Thread and the evaluator starting here http://forums.wolfram.com/mathgroup/archive/ 2006/Feb/msg00323.html. At any rate In the second case the argument lists are not the same length. Thread[Plus[{1,1},{{1,1},{2,2},{3,3}}]] gives two warning messages the first of which is due to the expression Plus[{1,1}, {{1,1},{2,2},{3,3}}] which issues a warning message upon evaluation because you cannot add {1,1} to {{1,1},{2,2},{3,3}}. The second warning message is due to the attempt to evaluate Thread[Plus[{1,1}, {{1,1},{2,2},{3,3}}]]. Regards, Ssezi

**References**:**Problem with Thread over Plus?***From:*"Virgilio, Vincent - SSD" <Vincent.Virgilio@itt.com>