Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Problem with Thread over Plus?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65389] Re: [mg65370] Problem with Thread over Plus?
  • From: "Virgilio, Vincent - SSD" <Vincent.Virgilio at itt.com>
  • Date: Thu, 30 Mar 2006 05:29:40 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Thank you, I see now.

I wasn't thinking correctly about the original expressions.  In fact,
Mathematica handles both of them properly.

Vince Virgilio

-----Original Message-----
From: Andrzej Kozlowski [mailto:akoz at mimuw.edu.pl] 
To: mathgroup at smc.vnet.net
Subject: [mg65389] Re: [mg65370] Problem with Thread over Plus?

> On 29 Mar 2006, at 13:34, 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
>
>

Thread evaluates its argument(s) so in the first case you get the
equivalent of this


Plus[{1, 1}, {{1, 1}, {2, 2}}]


{{2, 2}, {3, 3}}


Thread[%]


{{2, 3}, {2, 3}}

while in the second

Plus[ {1, 1} , { {1, 1} , {2, 2} , {3, 3} } ]

tries to add lists of different lengths and fails.

In fact, are you sure that you really meant to get the answer you did
get in the case you claim "works"? Did you not rather mean this:


Thread[Unevaluated[Plus[{1, 1} , {{1, 1}, {2, 2}}]]]


{{2, 2}, {3, 3}}


?


It is a little harder to make the second case work in the same way but
of course it can be done:


Thread[ Unevaluated[Plus[ {1,1} , { {1,1} , {2,2} , {3,3} } ] ],List,-1]


{{2, 2}, {3, 3}, {4, 4}}


Andrzej Kozlowski





************************************
This e-mail and any files transmitted with it are proprietary and intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender. Please 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 Industries, Inc. The recipient should check this e-mail and any attachments for the presence of viruses. ITT Industries accepts no liability for any damage caused by any virus transmitted by this e-mail.
************************************



  • Prev by Date: Re: Problem with Infinite products
  • Next by Date: Recursive issue
  • Previous by thread: Re: Problem with Thread over Plus?
  • Next by thread: RootSearch options