Re: How to add a vector to a list of vectors?
- To: mathgroup at smc.vnet.net
- Subject: [mg26501] Re: [mg26493] How to add a vector to a list of vectors?
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Sat, 30 Dec 2000 01:55:15 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
on 00.12.29 11:31 AM, AGUIRRE ESTIBALEZ Julian at mtpagesj at lg.ehu.es wrote:
> Dear Group,
>
> I have a list of vectors l = {v1,...,vn} and another vector w, all
> of the same length. I wat to get the list {w + v1, ..., w + vn} .
>
> l + w does not work.
>
> Is there a simpler (or more efficient) way than
>
> Table[w + l[[i]],{i, Length at l}] ?
>
> Julian Aguirre
> Universidad del Pais Vasco
>
>
>
As usual, there are lots of ways, but the first one that comes to my mind
is:
Transpose[Transpose[l] + w]
--
Andrzej Kozlowski
Toyama International University
JAPAN
http://platon.c.u-tokyo.ac.jp/andrzej/
http://sigma.tuins.ac.jp/