MathGroup Archive 2001

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

Search the Archive

RE: Multiply 2 Lists together in a certain way


Hi Jerry,

Somehow I wonder if you have specified clearly enough your "multiplication"
algorithm for us. But this works for your specific example.

L1 = {a, b};
L2 = {{{f, g, h}, {j, k, l}}, {{m, n, o}, {p, q, r}}};

MapThread[#1 (First /@ #2) &, {L1, L2}]
{{a f, a j}, {b m, b p}}

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/

> From: Blimbaum Jerry DLPC [mailto:BlimbaumJE at ncsc.navy.mil]
To: mathgroup at smc.vnet.net
>
> 	I would like to multiply 2 lists together in  a certain way...e.g.
>
> 	Suppose I have 2 lists, L1, L2 (these lists are the output of
> previous calculations):
>
>
> 	L1 = {a,b}
>
> 	L2 = {  { {f,g,h}, {j,k,l} }, { {m,n,o}, {p,q,r} }  }
>
>
> 	I want to multiply them out in such a way that i get the following
> output:
>
>
> 	{ { {a f, a j }, {b m, b p} } }
>
>
> 	I have tried MapThread but the the lists are of incompatible size
> and Table..without success...so at this point i'm stuck...
>
> 	thanks....Jerry Blimbaum   NSWC  Panama City, Fl
>
>
>
>
>



  • Prev by Date: Re: Multiply 2 Lists together in a certain way
  • Next by Date: Re: Multiply 2 Lists together in a certain way
  • Previous by thread: Re: Multiply 2 Lists together in a certain way
  • Next by thread: Re: Multiply 2 Lists together in a certain way