# Total accumulation

My goal is to understand the accumulation of any function (that is, the sum of all output values) within an interval, given its rate function $$r(x)$$ and given the partitioned $$\Delta x$$ intervals. I'm pretty sure this formula is the very definition of a definite integral provided $$\Delta x$$ is infinitesimally small, but the typical definition I always see is $$\int_{a}^{b}f(x)dx=\lim_{n\rightarrow \infty}\sum_{k=1}^nf(a+k\frac{b-a}{n})(\frac{b-a}{n})$$

However, the definition my professor gives is $$\biggr(\sum_{n=1}^{\lfloor\frac{x-a}{\Delta x}\rfloor}r(a+(n-1)\Delta x)\Delta x\biggr)+r(x)(x-\text{left}(x))$$

Where left($$x$$) is $$a+\biggr\lfloor\cfrac{x-a}{\Delta x}\biggr\rfloor \Delta x$$, which seems to be horizontal length leftmost of our current value, $$x$$. Okay so, I know the main facts I have to rely on is that $$\Delta y=m\Delta x$$ and if $$x$$ is within a partitioned interval, $$a+(n-1)\Delta x$$ where $$n$$ is an integer, then $$r_n(x)=r(a+(n-1)\Delta x)$$. Knowing $$\Delta y=\color{red}m\color{blue}{\Delta x}$$, where $$\color{red}{r_n(x)=m}$$, I can say $$y_n=\color{red}{r(a+(n-1)\Delta x)}\color{blue}{\Delta x}$$. Here I understand well how adding the sums of all the $$y_n$$ values will approximate the total accumulation up to the values left of our current interval. But if we define our current intervals horizontal change, then we simply multiply the rate at that point to get the final vertical value and add it to our summation to find the exact accumulation (again, provided our partitions are infinitesimal).

My problem is understanding why left($$x$$) is defined the way it is above, and why we make the upper bound of our sum a floor function as well as our left($$x$$). Everything else I understand. I'm also a little confused how $$n$$ works. For example, say we take one completed interval out of $$n$$ intervals, so $$n=1$$. I would imagine the horizontal length of the first interval is $$a+1\Delta x$$, instead it is $$a+(1-1)\Delta x$$ which gets me a horizontal length of $$a$$. To me this does not make intuitive sense because $$a$$ is only the initial input value. Yet plugging this into $$r$$ makes perfect sense to me because I definitely want to include the vertical length at $$x=a$$. I'm probably overthinking this.

Your function $$\mathrm{left}(x)$$ is just the closest point in the partition $$\{ a,a+\Delta x,\dots,a+N \Delta x \}$$ which is $$\leq x$$.
The floor function in the range of summation is just telling you what the number that I called $$N$$ is: it is the largest integer such that $$a+N\Delta x \leq b$$. You only have to do this because you've chosen to fix $$\Delta x$$ rather than fixing $$N$$ and letting $$\Delta x$$ be determined by that.
The length of the subintervals of the partition is expressed through the factor $$\Delta x$$. The $$a+(n-1) \Delta x$$ is just the evaluation point. In principle the evaluation point on the subinterval $$[a+k\Delta x,a+(k+1)\Delta x]$$ could be anywhere in that interval; in the formula you gave, it is positioned at the left endpoint.
That last term is basically like the others, it is just that that subinterval has a different length than the others; $$x-\mathrm{left}(x)$$ is the "$$\Delta x$$" for that subinterval.