MathGroup Archive 2003

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

Search the Archive

Re: variogram

  • To: mathgroup at smc.vnet.net
  • Subject: [mg42032] Re: [mg42000] variogram
  • From: "piele" <piele at uwp.edu>
  • Date: Tue, 17 Jun 2003 05:42:59 -0400 (EDT)
  • References: <200306160757.DAA18014@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Functional solution (one liner)

I will apply the solution function to a simple list Range[10].
In[60]:=X=Range[10]

Out[60]={1,2,3,4,5,6,7,8,9,10}

solution
In[61]:=(Rest[# - First[#]] &) /@ NestList[Rest[#1] &, X, Length[X] - 2]))^2

Out[61]={{1,4,9,16,25,36,49,64,81},{1,4,9,16,25,36,49,64},{1,4,9,16,25,36,49
},{1,4,9,
    16,25,36},{1,4,9,16,25},{1,4,9,16},{1,4,9},{1,4},{1}}

Explanation of the above solution

1. drop first element of the list until you are down to 2 elements

In[63]:=NestList[Rest[#1]&,X,Length[X]-2]

Out[63]={{1,2,3,4,5,6,7,8,9,10},{2,3,4,5,6,7,8,9,10},{3,4,5,6,7,8,9,10},{4,5
,6,7,8,9,
    10},{5,6,7,8,9,10},{6,7,8,9,10},{7,8,9,10},{8,9,10},{9,10}}

2. take difference with first element for each list.

In[64]:=Rest[#-First[#]]&/@ %

Out[64]={{1,2,3,4,5,6,7,8,9},{1,2,3,4,5,6,7,8},{1,2,3,4,5,6,7},{1,2,3,4,5,6}
,{1,2,3,4,
    5},{1,2,3,4},{1,2,3},{1,2},{1}}

3. square each element in the lists

In[65]:=%^2

Out[65]={{1,4,9,16,25,36,49,64,81},{1,4,9,16,25,36,49,64},{1,4,9,16,25,36,49
},{1,4,9,
    16,25,36},{1,4,9,16,25},{1,4,9,16},{1,4,9},{1,4},{1}}


Don Piele

----- Original Message -----
From: "Rees" <civnrn at hotmail.com>
To: mathgroup at smc.vnet.net
Subject: [mg42032] [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
>


  • References:
  • Prev by Date: Re: How is it possible to factor Sum[a]+Sum[b] to Sum[a+b] ?
  • Next by Date: Re: help with 3D scatter plot
  • Previous by thread: variogram
  • Next by thread: Re: variogram