Re: Interpolation with random nodes

*To*: mathgroup at smc.vnet.net*Subject*: [mg44788] Re: Interpolation with random nodes*From*: Bill Rowe <browe51 at earthlink.net>*Date*: Thu, 27 Nov 2003 11:38:12 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

On 11/25/03 at 12:45 AM, a_d_u_n at o2.pl (Wojtek) wrote: > I want to interpolate function with a few different sets of nodes. > One of them are random ones. I have made the list of nodes and my function's > values: > (n is given) > data1=Table[{e=Random[]*2-1,ArcTan(x,0.,n}] I assume what you mean is something like: data1 = Table[{x = Random[]*2-1, ArcTan@x, {n}] > and I have a list: {{x_0,f(x_0)},{x_1,f(x_1)}...} > I use the following formula to calculate my function > L(x) = SUM(j=0..n) f(x_j) * Lambda(j,x) > And I need to extract these values from my list. > and I want to define two functions > y[n] - this returns the f(x_n) from my list > x[n] - this returns the x_n from my list > how can I do it in mathematica? Given the structure of your list there are a number of ways to extract x and y as you've defined them above. Any of the following will work x = First/@data1; y = Last/@data1; x = data1[[All,{1}]]; y = data1[[All,{2}]]; {x,y} = Transpose@data1;