Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Building a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47147] Re: Building a list
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Sat, 27 Mar 2004 01:35:07 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On 3/26/04 at 3:56 AM, mark at markscoleman.com (Mark Coleman) wrote:


>I've got a relatively simple function f[a_,b_,c_,d_], where a and b
>are integers and c and d are lists (of reals), and f returns a
>real.

>I need to evaluate f on (potentially long) sets of lists and
>calculate a square "matrix" from the possible permutations of the
>elements in the lists. For instance

>If

>xlist={x1,x2,x3}

>I need to calculate

>{{f[a,b,x1,x1],f[a,b,x1,x2],f[a,b,x1,x3]},{f[a,b,x2,x1],f[a,b,x2,x2
>],f[a ,b,x2,x3]},{f[a,b,x3,x1],f[a,b,x3,x2],f[a,b,x3,x3]}}

You can get what you want with Table e.g.

Table[f[a, b, xlist[[i]], xlist[[j]]],{i, Length@xlist}, {j, Length@xlist}]
--
To reply via email subtract one hundred and four


  • Prev by Date: solving nonlinear equation with mathematica !!
  • Next by Date: Re: Yet another Mathematica docs whopper
  • Previous by thread: Re: Building a list
  • Next by thread: Re: Building a list