title: Looking for a js solver library to minimize a functions return value by varying an argument
body: <p>Is there a Javascript library that allows me to pass the following function, for it to find the alpha that results in the smallest return value.</p>
  
  <pre><code>var RMSE = runLES(this.monthlyData, this.alpha);
  </code></pre>
  
  <p>I cannot find anything in my searches because all the words relate to other more common problems in Javascript (e.g. 'minimizer' -> minifying, 'solver' -> solving equations, etc.).</p>
  
  <p>Or does anyone have tips on how I would implement this myself?</p>
  
  <p>EDIT: 
  This is the function body:</p>
  
  <pre><code>function runLES(data, alpha) {
      var errors = new Array(data.length - 2);
      for (var i = 2; i &lt; data.length; i++) {
          var Y1 = 2 * data[i - 1].noSeasonSales;
          var Y2 = data[i - 2].noSeasonSales;
          var E1 = 2 * (1 - alpha) * data[i - 1].error;
          var E2 = Math.pow(1 - alpha, 2) * data[i - 2].error;
          data[i].forecast = Y1 - Y2 - E1 + E2;
          data[i].error = data[i].noSeasonSales - data[i].forecast;
          errors[i - 2] = data[i].error;
      }
      return getRMSE(errors);
  }
  </code></pre>
  
  <p>RMSE is the root of the variance plus squared mean of the errors. (Just a number).</p>