A textbook I'm reading from has the following text explaining the concept of Expected Value of a continuous random variable:
Suppose the weight of a bullock on a cattle ranch is described by the continuous random variable $W$ with probability density function $f(w)$ and that the rancher can sell a bullock of weight $w$ for $g(w)$ dollars.
Consider a small interval $[w_i,w_{i+1}]$ of width $\Delta w_i$. The probability that the bullock has a weight in this interval is $$ \int_{w_i}^{w_{i+1}}f(w)dw \approx f(w_i)\Delta w_i $$ The earning on the bullock weighing in this interval is approximately $g(w_i)$.
Understandable so far. Then it says
The Riemann Sum $$ \sum g(w_i)f(w_i)\Delta w_i $$ then approximates the amount the rancher would receive for a steer. Assuming the bullock has a maximum weight (say $b$), $f$ is zero outside the finite interval $[0,b]$. Then taking the limit of the Riemann Sum as the width of the interval approaches zero gives $$\int_{-\infty}^{\infty}g(w)f(w)dw$$ This integral estimates how much the rancher can expect to earn for a typical bullock on the ranch and is the expected value of the function $g$.
My problem: How does the sum $\sum g(w_i)f(w_i)\Delta w_i$ represent the price of a typical bullock?
What does $g(w_i)f(w_i)\Delta w_i$ represent?
$f(w_i)\Delta w_i$ is the prob. of a randomly chosen bullock weighing somewhere in $w_i$ and $w_{i+1}$ and $g(w_i)$ is the price of the randomly chosen bullock weighing somewhere in $w_i$ and $w_{i+1}$.
$g(w_i)f(w_i)\Delta w_i$ looks like scaling the cost of the bullock by the factor $f(w_i)\Delta w_i$ (which is $<1$). I don't know what this has to do with the topic at hand.
Or
Should I see it as $g(w_i)$ weighted by the probability of realizing that price and hence the sum gives the weighted average of prices that are possible? Does that even make sense?
I'm totally lost. Help please!
Perhaps a simple example can illustrate things better?
Say a typical bullock has probability $0.7$ of weighing between $1$ and $2$, and probability $0.3$ of weighing between $2$ and $3$. A bullock that weighs $1$ sells for $\$200$, and a bullock that weighs $2$ sells for $\$300$ (i.e. $g(1)=\$200$ and $g(2)=\$300$). How can we use this to calculate the typical bullock price?
Making the (very simplifying) assumption that all bullocks between $1$ and $2$ sell for $\$200$ and all bullocks between $2$ and $3$ sell for $\$300$, we get $$ \text{typical price}\approx 0.7\cdot\$200+0.3\cdot\$300=\$230 $$ Ok. But that weight distribution was very coarse. Let's improve it. Say a bullock has probability $0.2$ to weigh between $1$ and $1.5$ and probability $0.5$ to weigh between $1.5$ and $2$. Further that it has probability $0.25$ of weighing between $2$ and $2.5$ and probability $0.05$ of weighing between $2.5$ and $3$.
Say the price for a $1.5$ bullock is $\$250$ and the price for a $2.5$ bullock is $\$400$. Then by a similar simplification and the same logic, the typical price is approximately $$ 0.2\cdot\$200+0.5\cdot\$250+0.25\cdot\$300+0.05\cdot\$400=\$260 $$ Assuming some niceness about the price function $g$ (usually continuity), we see that as we keep subdividing the weight intervals we look at, we will get better and better results.
This is the exact idea behind the Riemann sum in that argument. The only detail I've left out is how to get the probabilities. These don't appear directly in your $\sum g(w_i)f(w_i)\Delta w_i$. But $f(w_i)\Delta w_i$ is an approximation to this probability, which also gets better and better as we keep subdividing the weight intervals. After all, that's one of the more common way to make sense of what the values of a probability density function like $f$ mean in the first place.