How to find the sum of a function within a given range? For example $\sum f(x)$ when $x$ varies from say $0$ to $1$?
My line of reasoning,
Divide the interval $(0,1)$ into small equal parts of length $dx$ and assume (approximate) that the function has a constant value $f(x_c)$ in that interval $dx$ ($x_0$ is either at the beginning of $dx$ or at the end of $dx$).
Now the sum of the function in this interval $dx$ is just $f(x_c) + f(x_c) +.... f(x_c)$ ((i.e.) add $f(x_c)$, $dx$ times) which means the sum of $f(x)$ in the interval $dx$ is approximated to $(f(x_0) \times dx)$ that is, Sum $\approx$ area of the rectangle with height $f(x_0)$ and breadth $dx$.
Move on to the next interval $dx$ and do the same and finally add all these small areas.
So in conclusion the objective, of finding the sum of $f(x)$ in the interval $0 <x< 1$ is approximately equal to the area underneath it?
Is this correct or have I gone wrong somewhere?
Edit:
Context: I'm learning continuous probability distributions and am trying to reason out why area underneath = the probability to be in between the given range (as a sum of all probabilities).
I understand there's no meaning in the phrase "Sum of f(x)" but that's exactly what we are trying to get around with continuous probability distributions aren't we?
Your intuition about summing up infinitesimal probabilities is correct. The values of the probability density function $f_X$ of a continuous random variable $X$ are not actual probabilities, though - the density function is by definition the derivative of the cumulative distribution function. So your observation follows from the fundamental theorem of calculus. That is, $$P(a<X<b)=\int_a^b f_X(x) dx.$$ Remember that $f_X(x)$ is not the same thing as $P(X=x)$. It's better to think of it as $$f_X(x)=\lim_{h\to 0}\frac{P(x<X<x+h)}h.$$