by ribbonmaster » Sun Feb 25, 2018 5:11 am
I believe I have the answer. I was surprised to go through four pages of comments and not see a definitive answer, and instead it was full of pig poop.
My interpretation of the problem: draw a line and fill below it with black. If you truncate the graph at any width, the width = %black of the graph that is visible (don't truncate the y value, keep the height the same).
A simple summary: the solution is any function ax^b
a, b must be positive
plot under the interval 0 to xmax, where xmax = exp(ln(1/(1+b)/a)/b).
plot with the height from 0 to ymax, where ymax = 1/(1+b)
Example 1: 1*x., plot from 0 to 0.5 in x and 0 to 0.5 in y.
Taking the entire x range, it makes a triangle so 50% fill. And the x value at the right is 50%. Works.
Trying one intermediate value: width = 0.1. Then it makes a smaller triangle with an area 0.1*0.1*1/2. The total area is just width * height = 0.1*0.5. Dividing the black area by the total area gives 10%, same as x=0.1.
Example 2: 1*x^2, plot from 0 to sqrt(1/3) in x and 0 to 1/3 in y.
I'll just show the right hand value: width=sqrt(1/3).
Finding the area in the black using the integral, got 1/3^(5/2).
Total area = width * height = 1/3^(3/2).
Dividing the black by the total area gives 1/3, same as width = 1/3. Works!
Derivation: start with the rule: f(w) = int_0^w f(x) / w / h. That is just stating width = black/total area.
Rearrange h*w*f(w) = int_0^w f(x)
Realize that this is exactly how polynomials integrate.
Derive rules for the appropriate xmax and height in terms of a and b, pretty simple algebra.