code: public double linearInterpolateX( double yValue ) {
  
          double first = yList[0];
          double last = yList[yList.length - 1];
  
          // check out of range
          if (first <= last) {
              if (yValue < yList[0] || yValue > yList[yList.length - 1]) {
                  return Double.NaN;
              }
              isInverse = false;
          } else {
              // inverse proportional
              if (yValue > yList[0] || yValue < yList[yList.length - 1]) {
                  return Double.NaN;
              }
              isInverse = true;
          }
  
          for( int i = 0; i < yList.length; i++ ) {
              double y2 = yList[i];
              // if equal to a number in the array
              if (NumericsUtilities.dEq(y2, yValue)) {
                  return xList[i];
              }// else interpolate
              else if ((!isInverse && y2 > yValue) || (isInverse && y2 < yValue)) {
                  double y1 = yList[i - 1];
                  double x1 = xList[i - 1];
                  double x2 = xList[i];
  
                  double x = (x2 - x1) * (yValue - y1) / (y2 - y1) + x1;
                  return x;
              }
          }
          return Double.NaN;
      }
docs: A simple interpolation between existing numbers.
  
  @param yValue the value for which we want the x
  @return the x value