title: Riemann left sum
body: <p>Trying to figure out how to implement the left sum. Been working on this for hours and have no idea, please help. I get <code>0.0</code> from the left sum. The <code>middleSum</code> is ok and i use it to check if the <code>leftSum</code> works. But it doesnt.<strong>*EDIT</strong> the leftSum method is not true, I am still figuring it out ,it would be nice if someone would help and explain how to do the leftSum</p>
  
  <pre><code>public static double middleSum(Function fct, double a, double b, int n) {
      double deltaX = (b - a) / n;
      double x = a + deltaX / 2.0;
      double sum = 0.0;
  
      for (int i = 0; i &lt; n; i++) {
          sum = sum + fct.f(x);
          x = x + deltaX;
      }
  
      return sum * deltaX;
  }
  
  public static double lefSum(Function fct, double a, double b, int n) {
      double deltaX = (b - a) / n;
      double x=0.0;
      double sum = 0.0;
      for (int i = 0; i &lt; n; i++) {
          x=(i-1)/n;
  
          sum += fct.f(x) * deltaX;
      }
  
      return sum;
  }
  </code></pre>