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