I've been thinking recently and have confused myself a little bit as to the difference between sums and integrals.
I understand that an integral is a Riemann sum where you take the limit as the difference in whatever you are integrating with respect to becomes infinitesimally small.
However, I was thinking recently about how one would sum up all the values along a line/curve. For example, let's say I have a function f(x) that takes in a point and gives the electrical charge at that given point (Assume we are talking about a one dimensional system that just has x values). How would I sum up all the charges along a given interval [a,b].
I initially thought this would be an integral, but wouldn't that give the area under the curve because you are multiplying by $dx$, which isn't exactly what we are looking for? Unless it is, which is why I'm confused as I can't tell if that's what I would want for this situation.
Another thing that is obvious is to literally just add up all the values such as: $$f_1(x) + f_2(x) + f_3(x) + \ldots f_n(x).$$
This seems to be more of what I might be thinking about but what would be a way to do this "algorithmically" so to speak, where you don't have to literally add up an infinite amount of numbers.
Would you just us a normal sum, or would there be a different way?