MathGroup Archive 2010

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

Search the Archive

Re: From list to list of arguments

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113321] Re: From list to list of arguments
  • From: "Nasser M. Abbasi" <nma at 12000.org>
  • Date: Sat, 23 Oct 2010 07:07:24 -0400 (EDT)
  • References: <i9r803$hp1$1@smc.vnet.net>
  • Reply-to: nma at 12000.org

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