/// <summary>
 /// Calculates parameters
 /// </summary>
 /// <param name="x">Input</param>
 /// <param name="selection">Selection</param>
 /// <param name="y">Output</param>
 public void Calculate(double[] x, IStructuredSelection selection, double?[] y)
 {
     for (int i = 0; i < parameters.Count; i++)
     {
         string s = parameters[i] as string;
         formula[s] = x[i];
     }
     for (int i = 0; i < this.selection.PointsCount; i++)
     {
         int k = i * vectorDimension;
         foreach (string s in variables)
         {
             formula[s] = this.selection[i, s];
         }
         formula.Reset();
         (formula as IMeasurements).UpdateMeasurements();
         for (int j = 0; j < measurements.Count; j++)
         {
             y[k + j] = (double)measurements[j].Parameter();
         }
     }
 }