 
 
 
 
 
 
Re: Dot or Inner ... but not quite
- To: mathgroup at smc.vnet.net
- Subject: [mg79639] Re: Dot or Inner ... but not quite
- From: "Mariusz Jankowski" <mjankowski at usm.maine.edu>
- Date: Wed, 1 Aug 2007 04:53:21 -0400 (EDT)
- Organization: University of Southern Maine
- References: <f8n2rc$lp9$1@smc.vnet.net>
Mark, the Dot product does give the result you want, 
In[3]:= l1.l2
Out[3]= {20, 49}
Mariusz
>>> On 7/31/2007 at 6:27 AM, in message <f8n2rc$lp9$1 at smc.vnet.net>,
Diamond,
Mark<dot at dot.dot> wrote:
> I have two equi-length lists, the first of number, the second of 
> (equi-length) lists of numbers , such as
> 
> l1={1,4,3};
> l2={{1,7},{1,9},{5,2}};
> 
> I want to produce 1*{1,7}+4*{1,9}+3*{5,2}
> 
> It looks so close to Inner that I thought I could use it in some form, 
> but I 
> have ended up using
> 
> (#[[1]]*#[[2]])& /@ Transpose[{l1,l2}]
> 
> Is there a better way using one of the builtin functions with which I am 
> 
> unfamiliar?
> 
> Cheers,
> 
> Mark Diamond 

