MathGroup Archive 2010

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

Search the Archive

Re: From list to list of arguments


On 10/21/2010 10:38 PM, Sam Takoy wrote:
> Hi,
>
> Suppose I have a list of arrays, say g = {a, b, c} where a, b, and c are
> arrays, and I would like to calculate
>
> Outer[Times, a, b, c]
>
> how do I do it?
>

one way:

----------------------------------
(* data *)
n = 3;
a = Table[RandomInteger[10], {n}, {n}];
b = a; c = a;
g = {a, b, c};

(* compute *)
Dot @@ g
Out[99]= {{267, 96, 1070}, {114, 39, 460},
   {92, 30, 391}}

(*verify *)
a . b . c

Out[100]= {{267, 96, 1070}, {114, 39, 460},
   {92, 30, 391}}
-------------------------------


>
> An auxiliary question: within the function f[x__] := ... what kind of
> object is x? It's not a list, but what is it?
>
> Many thanks in advance,
>
> Sam
>
>

I just looked at ?__ and it seems to have good examples and help on this.

--Nasser



  • Prev by Date: Re: Two questions related to Arrays
  • Next by Date: Re: From list to list of arguments
  • Previous by thread: Re: From list to list of arguments
  • Next by thread: Re: From list to list of arguments