Given a curve $f(x)$ (for $x \in [0,1]$), and a line $y=a$, let $U$ be the total area below $f$ and above $a$, and let $L$ be the total area above $f$ and below $a$. If $L=U$, this means that $a =\int_0^1 f(x) dx$.

Or if $f(x)$ is a sequence of $n$ numbers, this means $a$ is their mean. Equivalently, $U = \sum \max(f(x)-a,0) \; dx$, $L = \sum \max(a-f(x),0) \; dx$.

What I want instead is the value $a$ for which $c \cdot L = U$, for some constant $c>0$.

This can be computed approximately by binary search or exactly with a more cumbersome algorithm, but: is there a closed-form expression for this value? And: has this value been studied?

(The motivation is a battery-charging problem, where $a$ is the constant level of energy available, and $f$ is the energy usage at each moment, so $L$ corresponds to charging into the battery, and $U$ corresponds to discharging from the battery. Because of charge/discharge inefficiencies, after charging 1 unit in, you'll only be able to discharge, say, .5 units out. (For this interpretation to make sense, you might assume f is monotonically increasing.))


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.