Re: Problem with Thread over Plus?
- To: mathgroup at smc.vnet.net
- Subject: [mg65390] Re: Problem with Thread over Plus?
- From: dh <dh at metrohm.ch>
- Date: Thu, 30 Mar 2006 05:29:41 -0500 (EST)
- References: <e0dsg9$r67$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Vincent,
The argument of Thread will be evaluated before beeing fed to Thread.
You are actually feeding the result of Plus[ {1,1} , { {1,1} , {2,2} }
], namely:
List[{1 + a, 2 + b}, {1 + a, 2 + b}]
to thread. The function "List" is then threaded.
On the other hand,
Plus[ {1,1} , { {1,1} , {2,2} , {3,3} } ]
will produce the error you saw.
However, your first attempt does not actually give the correct answer.
If you want to thread Plus over {1,1} and { {1,1} , {2,2} } you would
use MapThread:
MapThread[Plus, {{1, 1}, {{1, 1}, {2, 2}}}]
and get:
{{2, 2}, {3, 3}}
Daniel
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} } ] ]
>
> Thanks,
>
> Vince Virgilio
>
> ************************************
> This e-mail and any files transmitted with it are proprietary and intende
> d solely for the use of the individual or entity to whom they are address
> ed. If you have received this e-mail in error please notify the sender. P
> lease note that any views or opinions presented in this e-mail are solely
> those of the author and do not necessarily represent those of ITT Indust
> ries, Inc. The recipient should check this e-mail and any attachments for
> the presence of viruses. ITT Industries accepts no liability for any dam
> age caused by any virus transmitted by this e-mail.
> ************************************
>