title: Finding similarities in a multidimensional array
body: <p>Consider a sales department that sets a sales goal for each day. The total goal isn't important, but the overage or underage is. For example, if Monday of week 1 has a goal of 50 and we sell 60, that day gets a score of +10. On Tuesday, our goal is 48 and we sell 46 for a score of -2. At the end of the week, we score the week like this:</p>
  
  <pre><code>[0,0]=10,[0,1]=-2,[0,2]=1,[0,3]=7,[0,4]=6
  </code></pre>
  
  <p>In this example, both Monday (0,0) and Thursday and Friday (0,3 and 0,4) are "hot"</p>
  
  <p>If we look at the results from week 2, we see:</p>
  
  <pre><code>[1,0]=-4,[1,1]=2,[1,2]=-1,[1,3]=4,[1,4]=5
  </code></pre>
  
  <p>For week 2, the end of the week is hot, and Tuesday is warm. </p>
  
  <p>Next, if we compare weeks one and two, we see that the end of the week tends to be better than the first part of the week. So, now let's add weeks 3 and 4: </p>
  
  <pre><code>[0,0]=10,[0,1]=-2,[0,2]=1,[0,3]=7,[0,4]=6
  [1,0]=-4,[1,1]=2,[1,2]=-1,[1,3]=4,[1,4]=5
  [2,0]=-8,[2,1]=-2,[2,2]=-1,[2,3]=2,[2,4]=3
  [3,0]=2,[3,1]=3,[3,2]=4,[3,3]=7,[3,4]=9
  </code></pre>
  
  <p>From this, we see that the end of the week is better theory holds true. But we also see that end of the month is better than the start. Of course, we would want to next compare this month with next month, or compare a group of months for quarterly or annual results.</p>
  
  <p>I'm not a math or stats guy, but I'm pretty sure there are algorithms designed for this type of problem. Since I don't have a math background (and don't remember any algebra from my earlier days), where would I look for help? Does this type of "hotspot" logic have a name? Are there formulas or algorithms that can slice and dice and compare multidimensional arrays? </p>
  
  <p>Any help, pointers or advice is appreciated!</p>