I have found the equation for the average of a function to be $$ \bar{f} = \frac{1}{b-a}\int_a^b f(x) \mathrm{d}x $$ however, this equation doesn't make complete sense to me. I interperet it as being the same as $$ \lim_{n \to \infty} \sum_{i=1}^n f\left(a + i\frac{b-a}{n}\right) $$ This equation would blow up to infinity, since there is an infinite quantity of numbers larger than 0 that are being summed.
The average of a set of numbers is found by adding them up and then dividing the sum by the quantity of numbers added. So, for $n$ numbers, individually represented by $x_i$, their average would be $$ \frac{1}{n}\sum_{i=1}^{n} x_i $$ The way that I understand the first equation, the $\frac{1}{b-a}$ would only remove the $\mathrm{d}x$ from the integral. Each $\mathrm{d}x$ represents a ininitely small interval; if you were to add up the infinite number of these $\mathrm{d}x$'s you would end up with a total value of the full interval $b - a$; therefore, in the original equation, to remove the summed $\mathrm{d}x$'s we simply divide out $b - a$; however, this does not account for the sum of $f(x)$ over the interval $b-a$. When the integral equation is calculated I understand its result as simply the sum of $f(x)$ over the interval. How is it not this? (I know that it can't be, as an infinite sum of numbers larger than 0 would always go to infinity, but I don't understand why it is not.)
If I were to construct an equation to yield the average of a function I would write the following $$ \bar{f} = \lim_{n \to \infty} \frac{1}{n} \sum_{i=1}^{n} f\left(a + i\frac{b-a}{n}\right) $$ How would this get turned into the first equation?
I understand the problem in terms of another definition that states that the average of a function would yield the same area under the curve as that of the original function over the same interval $$ \int_a^b\bar{f}\mathrm{d}x = \int_a^bf(x)\mathrm{d}x $$ but I just cant understand the intution behind the original equation.