title: Find the "peak" of a set of data
body: <p>I have a set of data, for which I'd like to find an average peak. I've done some testing in Numbers.app to see what I'm after and if I make a chart of the dataset it has a feature it calls "polynomial trendline" which draws a curve of the data and the peak of that curve looks exactly like the point/value I'm after. </p>
  
  <p>So how could I programmatically calculate that curve and find that tangent on the curve?</p>
  
  <p>I've been looking around on wikipedia and found topics like "Normal distribution" and "Polynomial regression" which seems very much related, but I've always found it hard to follow the equations on wikipedia so I'm hoping maybe someone here could give me a programatic example.</p>
  
  <p>Here's a couple of charts to illustrate what I'm after. The green dots are the data points and the blue line is the "polynomial trendline" (of order 6). <strike>The "peak" of that trendline is what I'm after.</strike> </p>
  
  <p><img src="https://i.stack.imgur.com/KiqfB.png" alt="Example with even dataset">
  <img src="https://i.stack.imgur.com/IQwgf.png" alt="Example with uneven dataset"></p>
  
  <p><strong>Updated question:</strong></p>
  
  <p>After some answers I realize my question need to be rephrased as the problem is not really how to find the peak of the curve but more of how to generate that blue curve from the green points so I can find where in the dataset the "weight" lies. <em>The goal is to get a sort of 'average maximum'</em>.</p>
  
  <p>I guess another question would be "what is this particular problem actually called?" ;)</p>