MathGroup Archive 2001

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

Search the Archive

Re: DO if Loop


var = Array[a, {6, 3}]; 

If the function's input is a vector, use one of these forms

f /@ var == 
(f[#] &) /@ var == 
Thread[f[var]]

True

If the function's input is a sequence, use one of these forms

f @@@ var == 
Apply[f, var, {1}] == 
(f[#[[1]], #[[2]], #[[3]]] & ) /@ var == 
(f[Sequence @@ #1] & ) /@ var == 
MapThread[f, Transpose[var]]

True


Bob Hanlon

In a message dated 2001/1/11 11:14:27 AM, pixelpounder at earthlink.net writes:

>I have a matrix function and a list of 2622 variables in groups of 3. 
>I need to apply this function to each set of 3 variables continuing until
>finished with the list.
>
>How is this done?
>


  • Prev by Date: horizontal cylinder
  • Next by Date: Cause of $ErrorLink message in EXCEL/Mathematica
  • Previous by thread: DO if Loop
  • Next by thread: Re: DO if Loop