Visualization of Riemann–Stieltjes Integrals The Riemann–Stieltjes integral $\int_a^b f(x)\,dg(x)$ is a generalization of the Riemann integral. It is e.g. heavily used as a starting point for stochastic integration. The approximating Riemann–Stieltjes sums are analogous to the Riemann sums $\sum_{i=0}^{n-1} f(c_i)(g(x_{i+1})-g(x_i))$ where $c_i$ is in the $i$-th subinterval $[x_i,x_{i+1}]$.
The Riemann-sums can be very intuitively visualized by rectangles that approximate the area under the curve.
See e.g. Wikipedia:Riemann sum.
Unfortunately, I cannot find respective intuitive visualizations of the Riemann–Stieltjes sums.
My question: Could anyone provide me with some literature, pictures, links, or especially tools (e.g. Mathematica or even Excel) with which I could play around to get a similar intuition for this more general kind of integral?
 A: First of all, you can think of this integral using almost the same picture. The only difference is that instead of summing just the areas of the rectangles, you first multiply each area by $g(x_{i+1})-g(x_i)$ and then add.
The idea is that we no longer consider the real line as having the same "weight" everywhere; some parts are now "more important" than others. When we did usual integration, we assigned the the piece of the line between $x_i$ and $x_{i+1}$ the weight $x_{i+1}-x_i$, exactly proportional to its length. Now, instead, this same piece is given weight $g(x_{i+1})-g(x_i)$.
In particular, if we picked g so that $g(x)=x$ for all x, we would get the regular integral back. If g were constant, all integrals would become zero; no part of the real line would matter at all.
Final amusing example if g(x)=0 for $x \leq 0$ and g(x)=1 for $x > 0$, then no part of the line matters except the origin. For simplicity, suppose some $x_i=0$. Then, our Riemann-Stjeltes sum will be:
$$\sum_{i=-n}^n f(x_i)\cdot \underbrace{(g(x_{i+1})-g(x_i))}_{\text{not 0 only if }x_i=0} = f(0)$$no matter what our step is. So, the integral of any function f will be f(0). (The function will need to be continuous for integrals to be well-defined, as always)

But, I think what you are really missing is the concept of a measure, at least an intuitive one. It takes a bit of work to learn, but makes understanding all kinds of integration much easier. My favorite source for this is the dirt-cheap book by Kolmogorov-Fomin (you'd need to look at the last couple of chapters, and to reference the first chapters episodically), but it would certainly require some time and might be more than you need. Ideally, just take a graduate-level (or similar) analysis course.
A: i would like to suggest to read the article-
A Geometric Interpretation of the Riemann-Stieltjes Integral
Gregory L. Bullock
The American Mathematical Monthly
Vol. 95, No. 5 (May, 1988), pp. 448-455
Published by: Mathematical Association of America
Article Stable URL: https://www.jstor.org/stable/2322483
(Update 2022-08-22) The (English-version) Wikipedia page on the Riemann-Stieltjes integral also has a few figures illustrating the geometric interpretation from that article. URL: https://en.wikipedia.org/wiki/Riemann%E2%80%93Stieltjes_integral (current revision)
A: It's fairly easy to visualize the Riemann–Stieltjes integral $\int_a^b f(t)\,dg(t)$ [I changed the name of the integration variable for convenience below] if $f\ge0$ and $g$ is nondecreasing. Just draw the graph of the curve $(x,y)=(g(t),f(t))$. The integral is just the area below the curve. (Whenever $g$ makes a jump at some $t_0$, fill in the gap by setting $y=f(t_0)$ there.) The Riemann–Stieltjes sums are now easy to visualize as sums of areas of rectangles (details left as an exercise).
A: This article seems useful to me, gives a good overview of existing interpretations:
https://maa.tandfonline.com/doi/abs/10.1080/07468342.2019.1580109?journalCode=ucmj20#.XPJU16WxVkA
Grobler, Trienko, Visualization of the Riemann-Stieltjes integral, Coll. Math. J. 50, No. 3, 198-209 (2019). ZBL1445.97019, MR3955329.
A: Well the amusing example is fundamental to analytic number theory, because any sum of a smooth function can be written as a stieltjes integral. Here is a typical use: Say we want to estimate the $\sum_{p \leq x} f(p)$ where $f$ is a nice smooth, positive, decreasing function (say faster than $1/x$), and the summation is taken over the primes. Then by Stieltjes non-sense (this is essentially Ilya's example but slightly more elaborate): $\sum_{p \leq x} = \int_{3/2}^{x} f(t) \text{d}\pi(t)$ where $\pi(t)$ is the prime counting function. By using "integration by parts for Stieltjes integrals" the previous integral is equal to $f(x) \pi(x) - \int_{3/2}^{x} \pi(t) \text{d}f(t)$. When $f$ is a nice differentiable function we have that $\text{d}f(t) = f'(t) \text{d}t$. Thus the previous integral simply equals to $f(x) \pi(x) - \int_{3/2}^{x} \pi(t) f'(t) \text{d}t$. Now we know that $\pi(x) \sim \frac{x}{\log(x)}$ so putting this inside the integral and assuming that $f$ is not too bad (i.e let's say $f$ decreasing and in size about $1/x$, but not as small as to make our integral constant) we get that $$\sum_{p \leq x} f(p) \sim - \int_{3/2}^{x} \frac{t f'(t)}{\log(t)} \text{d}t$$ (the minus sign is there because we assume $f$ to be decreasing; in the increasing case the procedure described above doesn't work so well because the term $f(x)\pi(x)$ and the integral $\int_{3/2}^{x} \pi(t)f'(t) \text{d}t$ give a contribution of roughly equal size, so when we approximate $\pi(t)$ we are (usually) left only with the error term). If you take $f(x) = 1/x$ then a simple consequence of the above result is that $$\sum_{p \leq x} \frac{1}{p} \sim \log\log(x)$$. I hope this example was worthwhile... (I know you asked for visualization but I think this is a good example of actual use, maybe it will be helpful)
