RE: variogram
- To: mathgroup at smc.vnet.net
- Subject: [mg42071] RE: [mg42000] variogram
- From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
- Date: Wed, 18 Jun 2003 02:10:40 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
>-----Original Message----- >From: civnrn at hotmail.com [mailto:civnrn at hotmail.com] To: mathgroup at smc.vnet.net >Sent: Monday, June 16, 2003 9:57 AM >To: mathgroup at smc.vnet.net >Subject: [mg42071] [mg42000] variogram > > >Hi, > >Given the following dataset: > >x y T >2.9 0.876 0.138 >2.5 0.188 0.214 >4.7 2.716 2.119 >4.2 2.717 2.685 >4.2 3.739 0.031 >2.1 1.534 1.534 >2.4 2.078 0.267 >5.8 3.324 1.670 > > > >I want to formulate the variogram: ie the square difference >1/2[T(x,y)-T(x,y)']**2 for all measurement pairs. For the above 8 >measurements there are (n(n-1))/2 = 28 such pairs. > > >so for T=0.138, the first step is to compute: > >0.138-0.214 then 0.138-2.119 then 0.138-2.685....then 0.138-1.670 > >the next step is: >0.214-2.119 then 0.214-2.685 etc [BUT NOT 0.214-0.138] > >Is it possible to program this in mathematica? Thanks in advance. > >Cheers > >Rees > Just for fun, alternatives with pure list operations (no assignments): In[9]:= Flatten@MapThread[(#1 - #2)^2 &, {Drop[t, -1], NestList[Rest, Rest[t], Length[t] - 2]}]/2 or also In[13]:= Flatten[(First[#] - Rest[#])^2 & /@ NestList[Rest, t, Length[t] - 2]]/2 -- Hartmut