This is a question that occurred to me when actually filling such a bowl.

I saw this post, which however does not seem to give a final formula for the water level/height vs time.

Here is how I approached it (and why I still have a doubt about it).

Knowing (e.g. from here) that the filled volume as a function of the sphere's radius $r$ and cap height (= water level) $h$ is:

$$V = \frac {\pi h^2} 3 (3 r - h)$$

and assuming that the volumetric flow rate is $F$, at a time $t$, the volume of water must be:

$$V = F t$$

Equating the two:

$$F t = \frac {\pi h^2} 3 (3 r - h)$$

Solving this equation for $h$ should give the desired $h(t)$.
However, the expression I got was very complicated, so I tried some simplifications.

The maximal possible time is the one at which the hemisphere is full ($h = r$):

$$F t_{max} = \frac {\pi r^2} 3 (3 r - r) = \frac {2 \pi r^3} 3$$


$$T = \frac t {t_{max}}$$


$$t = \frac {2 \pi T r^3} {3 F}$$


$$H= \frac h r$$


$$h = H r$$

Replacing $t$ and $h$ with their expressions in terms of $T$ and $H$, which are both bound to $[0,1]$, and cancelling out the constants:

$$2 T = 3 H^2 - H^3$$

Implicit plot of this equation:

enter image description here

This shows that the level rises faster at the beginning, and more slowly as $T$ approaches $1$, as expected intuitively.

However, if I ask my CAS to solve this equation for $H$, I get 3 solutions, the first 2 with imaginary terms, and the last one without imaginary terms, but clearly not the applicable one, as $H$ is always greater than $1$.

So my question is: when I know that the intended variable $H$ I am solving this cubic equation for is real and bounded to $[0,1]$, how can I obtain (or identify) the correct solution?

Note that the CAS I am using allows to calculate a 'realpart' and 'imagpart' of an expression, and when I substitute numerical values of $T$ I can see that the 'imagpart' of all 3 solutions approaches $0$, whereas only the realpart of one of them is within $[0,1]$. So in a way I know which solution is the correct one.
But I am looking for a cleverer method and for an expression of the solution that does not have imaginary terms in it, assuming it is possible to find it.

EDIT added solution from CAS

$$H = 1 + ( - \frac 1 2 - \frac {\sqrt {3} i} 2 ) (-T + i \sqrt {2-T} \sqrt T +1)^{1/3} + \frac {- \frac 1 2 + \frac {\sqrt {3} i} 2} {(-T + i \sqrt {2-T} \sqrt T +1)^{1/3}}$$

The real part calculated by the CAS is:

$$H = 1 + \sqrt 3 \sin {(\frac {atan2 (\sqrt {2-T} \sqrt T, 1-T)} 3}) - \cos {(\frac {atan2 (\sqrt {2-T} \sqrt T, 1-T)} 3})$$

Definition of $atan2(y,x)$ by the CAS:

$$atan2(y,x) = \arctan(\frac y x) = z, z \in [-\pi, \pi]$$

The imaginary part reduces to $0$, as expected.

EDIT 2 further simplification

Knowing that:

$$\sin(a) \sin(b) - \cos(a) \cos(b) = -\cos(a+b)$$

and noting that:

$$\sin(\frac {\pi} 3) = \frac {\sqrt 3} 2$$

$$\cos(\frac {\pi} 3) = \frac {1} 2$$

it follows that:

$$H = 1 + 2 \sin(\frac {\pi} 3) \sin {(\frac {atan2 (\sqrt {2-T} \sqrt T, 1-T)} 3}) - 2 \cos(\frac {\pi} 3) \cos {(\frac {atan2 (\sqrt {2-T} \sqrt T, 1-T)} 3}) =$$

$$= 1 - 2 \cos {(\frac {\pi + atan2 (\sqrt {2-T} \sqrt T, 1-T)} 3})$$


2 Answers 2


This is cubic equation with three real solutions, hence it's impossible to avoid imaginary numbers in the solution.

I'd suggest using an iterative algorithm: $$ H_0=0,\quad H_{n+1}=\sqrt{2T\over3-H_{n}} $$ which should converge fast to the desired solution.

  • $\begingroup$ Thanks; I am not familiar at all with cubic equations. It puzzles me that we know the solution is real, but we cannot eliminate imaginary numbers upfront. And the CAS uses trigonometric functions to express the real part. $\endgroup$ Oct 15, 2022 at 17:24
  • 2
    $\begingroup$ @user6376297 See here: en.wikipedia.org/wiki/Casus_irreducibilis $\endgroup$ Oct 15, 2022 at 18:09

Start at the formula for the volume as a function of the water level $h$: $$V = \frac{\pi h^2}{3}\bigl(3 r - h\bigr), \quad 0 \le h \le 2 r$$ Using $\lambda = h / (2 r)$ (so that $\lambda = 0$ refers to empty, and $\lambda = 1$ is full water level), $ h = 2 r \lambda$, and the formula is written as $$V = 4 \pi r^3 \lambda^2 - \frac{8 \pi r^3}{3} \lambda^3$$

Using $f$ as the fraction of volume in the bowl, $f = 0 \iff V = 0$, $f = 1 \iff V = \frac{4 \pi r^3}{3}$, we have $$f = \frac{V}{\frac{4 \pi r^3}{3}}$$ i.e. $$f = 3 \lambda^2 - 2 \lambda^3 \tag{1}\label{1}$$

Let's say we fill the bowl in unit time, from $\tau = 0$ to $\tau = 1$. If the volumetric flow rate is constant, then $$f = \tau \tag{2}\label{2}$$

Equations $\eqref{1}$ and $\eqref{2}$ give us the relationship between time $\tau$ and relative fill level $\lambda$: $$3 \lambda^2 - 2 \lambda^3 = \tau$$ i.e., in implicit form, $$3 \lambda^2 - 2 \lambda^3 - \tau = 0 \tag{3}\label{3}$$

This is easiest to solve for $\lambda$ numerically, using Newton's method. Start with $$\lambda_0 = \begin{cases} \sqrt{\frac{\tau}{2}}, & \quad 0 \le \tau \le \frac{1}{2} \\ 1 - \sqrt{\frac{1 - \tau}{2}}, & \quad \frac{1}{2} \le \tau \le 1 \\ \end{cases}$$or $$\lambda_0 = \begin{cases} \frac{(2 \tau)^K}{2}, & \quad 0 \le \tau \le \frac{1}{2} \\ 1 - \frac{(2 - 2 \tau)^K}{2}, & \quad \frac{1}{2} \le \tau \le 1 \\ \end{cases}$$which is an even better approximation with $0.5 \lt K \le 0.6$ but slower to compute; and then iterate $$\lambda_{i+1} = \frac{\tau + \lambda_i^2 (3 - 4 \lambda_i)}{6 \lambda_i (1 - \lambda_i)}, \quad 1 \le i \in \mathbb{N} \dots$$ until $\lvert \lambda_{i+1} - \lambda_i \rvert \le \epsilon$. Even for double precision floating point numbers, typically half a dozen iterations converges. Note that the above fails for $\lambda = 0$ and $\lambda = 1$; this is not a problem because $\tau = 0 \iff \lambda = 0$, $\tau = 1/2 \iff \lambda = 1/2$, and $\tau = 1 \iff \lambda = 1$, and only $0 \lt \tau \lt 1$ need to be iterated.

Since this is a cubic polynomial, the algebraic solution using complex numbers exists. There are three possible roots, of which only one fulfills the above: $$\lambda = \frac{1}{2} - \frac{z_1}{2} + z_1 z_2 - \frac{1 - 2 z_2}{2 z_1}, ~ z_1 = \left(\frac{1}{8} - \frac{\tau}{4} + \frac{i}{4}\sqrt{\tau (1 - \tau)} \right)^\frac{1}{3}, ~ z_2 = i \sqrt{\frac{3}{4}}$$ It is defined for $0 \lt \tau \lt \frac{1}{2}$ and for $\frac{1}{2} \lt \tau \lt 1$, and its imaginary part is zero then. We only need the real part: $$\lambda = \frac{1}{2} + \sqrt{\frac{3}{4}} \sin \theta - \frac{1}{2}\cos\theta, \quad \theta = \begin{cases} 0, & \tau = 0 \\ \frac{1}{3}\arctan\left(\frac{\sqrt{\tau (1 - \tau)}}{\frac{1}{2} - \tau}\right), & 0 \lt \tau \lt \frac{1}{2} \\ \frac{\pi}{6}, & \tau = \frac{1}{2} \\ \frac{\pi}{3} - \frac{1}{3}\arctan\left(\frac{\sqrt{\tau (1 - \tau)}}{\tau - \frac{1}{2}}\right), & \frac{1}{2} \lt \tau \lt 1 \\ \frac{\pi}{3}, & \tau = 1 \\ \end{cases} \tag{4}\label{4}$$ With the two-argument form of arcus tangent, $\theta = \operatorname{atan2}\left( \sqrt{\tau (1 - \tau)}, ~ \frac{1}{2} - \tau \right)$ for $0 \le \tau \le 1$.

When using floating-point numbers, say in a computer program, the iterative approach often yields a more precise answer. In many cases, the iterative approach is also faster, because trigonometric functions can be "slow" to evaluate, compared to polynomial expressions.

(Interestingly, $\lambda \approx \frac{3}{\pi} \theta$, with less than $0.01$ absolute error.)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .