Student Support Forum: 'moving elements' topicStudent Support Forum > General > "moving elements"

 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic
 Author Comment/Response Bill Simpson 03/22/13 00:38am Without example data showing exactly what you want this to do it is somewhat difficult to guess what the answer should be. Suppose your data looks like this In[1]:= v={{0,9,1,7},{7,8,9,7},{9,0,7,6},{5,8,6,8},{9,1,3,3},{2,0,3,6}}; Since I am guessing you want to look at pairs of these 4 element lists I will use Partition to group this into overlapping pairs In[2]:= vp=Partition[v,2,1] Out[2]= {{{0,9,1,7},{7,8,9,7}}, {{7,8,9,7},{9,0,7,6}}, {{9,0,7,6},{5,8,6,8}}, {{5,8,6,8},{9,1,3,3}}, {{9,1,3,3},{2,0,3,6}}} Now I will define a function that is given a pair of 4 element lists in another list and will calculate something using the individual items. In[3]:= f[{{a_,b_,c_,d_},{e_,f_,g_,h_}}]:=d

 Subject (listing for 'moving elements') Author Date Posted moving elements augustus 03/21/13 2:10pm Re: moving elements Bill Simpson 03/22/13 00:38am Re: Re: moving elements augustus 03/23/13 1:37pm Re: Re: Re: moving elements Bill Simpson 03/23/13 2:06pm Re: Re: Re: Re: moving elements augustus 03/25/13 10:26am
 < Previous Comment | Next Comment > Help | Reply To Comment | Reply To Topic