I have a function of x
:
f[x_] := Abs[Extract[list, x + n] - Extract[list, x]]
I then apply this:
g = Length[Cases[Map[f, Table[i, {i, Length[list] - n}]], 0]]
This counts the number of occurences when two letters are the same at a distance of n
in the list.
However, I wish to be able to alter the value of n
, and map the values of g
as n
takes the value of 1,2,3,..
etc. Is there a way to do this? I simply want Mathematica to let n
be 1
, apply g
, let n
be 2
, apply g
... etc and then to map the results?
Any replies are greatly appreciated!