Sorry, this is a question that I couldn't answer yet.
Let $f(x) = \frac{x}{x+5} $
I would like to find the median for $f(x)$ over the interval [0,5].
One way to find the median is to take the middle value of x over [0,5]. In my case, it would be 2.5. Hence, the median of $f(x)$ would be simply
$\frac{2.5}{7.5}= 0.33333$
Another possible solution would be:
$\frac{\textrm{50 percent of the area}}{\textrm{total area}}= \frac{\int_{0}^{m}\frac{x}{x+5} dx}{\int_{0}^{5} \frac{x}{x+5 }dx}=0.5$
In other words, the median for the function is found with the value m that gives 50% of the area on the interval [0,5]. We can find it iteratively. Using R, I have got:
$\frac{\textrm{50 percent of the area}}{\textrm{total area}}=\frac{0.767132}{1.534264} =0.5$.
The value m that gives 50% of the area is 3.303068. Hence, the median for the function would be:
$ \frac{3.303068}{3.303068+5} =0.397813$
Should both approaches give similar results? If not, which one would be correct?
Cheers!
Tyler
The second one. However, you can compute it correctly: $$ \int_{0}^x \frac{t}{t+5}\mathrm{d}t=\frac{1}{2}\int_{0}^5 \frac{t}{t+5}\mathrm{d}t. $$ Now $$ \int_{0}^x \frac{t}{t+5}\mathrm{d}t=\int_{0}^x \left(1-\frac{5}{t+5}\right)\mathrm{d}t=x-5\int_0^x \frac{1}{t+5}\mathrm{d}t=x-5\log \frac{x+5}{5} $$ and in particular $$ \int_{0}^5 \frac{t}{t+5}\mathrm{d}t=5-5\log 2. $$ Hence $$ x-5\log \frac{x+5}{5}=\frac{1}{2}(5-5\log 2). $$ Make the substitution $x=5e^y-5$ so that $$ 5e^y-5-5y=\frac{5-5\log 2}{2} \implies e^y-y=\frac{3-\log 2}{2} $$ Set $z=-e^y$. Then the above can be rewritten as $$ -z-\log(-z)=\log\left(\frac{1}{ze^z}\right)=\frac{3-\log 2}{2} \implies ze^z=\mathrm{exp}\left(\frac{\log 2-3}{2}\right). $$ Hence $$ z=W\left(\mathrm{exp}\left(\frac{\log 2-3}{2}\right)\right) $$ so that $$ x=5e^y-5=-5(1+z)=5\left(1+W\left(\mathrm{exp}\left(\frac{\log 2-3}{2}\right)\right)\right). $$
Ps. Here $W$ is the Lambert W function.