# Find the value of $h$ from a Kepler-type equation

$$V = \frac{0.5r^{2}\cdot \cos^{-1}(\frac{r-h}{r})\cdot 2-\sin\big(\cos^{-1}(\frac{r-h}{r})\cdot 2\big)}{10^{6}}\tag1$$

This is the equation to find the volume of liquid in a tank in the shape of a capsule. Where $h$ is depth of the liquid, $r$ is radius of the cylinder, and $V$ is volume of liquid.

I need to find the depth of liquid, that is $h$ if the volume $V$ is given.

$\color{blue}{Edit:}$

The volume formula for a capsule (a cylinder with a hemisphere at both ends) is,

$$V_c = \pi r^2 H + \frac{4}{3}\pi r^3$$

while that of a tank (a cylinder with a hemi-oblate spheroid at both ends) is,

$$V_t = \pi r^2 H + \frac{4}{3}\pi c r^2$$

with the capsule being the special case $c = r$. For example, the total fill volume with $H = 192$, $c = 18$, $r=36$ is,

$$V_t = 879444.88\;\text{in}^3 = 3807.12\; \text{US gallons}\tag2$$

while the volume of water in a partially filled tank with water depth $h=48\;\text{in}$ is,

$$V_p = 2710\; \text{US gallons}\tag3$$

both values given in the link below.

Tank volume calculator

• @SNEHIL I'm not very good at maths. I'm developing an java application for a petrol pump and I'm stuck here Jul 28, 2015 at 9:24
• HINT: $$V=\frac{\frac{1}{2}r^2\cdot \cos^{-1}\left(\frac{r-h}{r}\right)\cdot 2-\sin\left(\cos^{-1}\left(\frac{r-h}{r}\right)\right)\cdot 2}{10^6}=$$ $$V=\frac{r^2\cos^{-1}\left(\frac{r-h}{r}\right)-2\sqrt{1-\frac{(r-h)^2}{r^2}}}{10^6}$$ Jul 28, 2015 at 9:29
• Only numerical methods will do the job. Are you sure about the formula ? Jul 28, 2015 at 9:39
• Hint: Using $y=\cos^{-1}(\frac{r-h}{r})$ you will get Kepler's equation $M = y - e \sin y$. With the solution $y$ compute $h = r(1-\cos y)$. Jul 28, 2015 at 9:55

$V=10^6(\frac{r^2}{2}2\cos^{-1}(\frac{r-h}{r})-\sin(2\cos^{-1}(\frac{r-h}{r}))$ and $V=2710$, $r=36$ find a function of $h(V)$?

There is no way to obtain the asked volume from the expression $10^6(\frac{r^2}{2}2\cos^{-1}(\frac{r-h}{r})-\sin(2\cos^{-1}(\frac{r-h}{r}))$.

I don't think it requires numerical methods to show this but being as it would have required them to have some way of calculating values of $h$ given a specific volume; I proceed with numerical methods.

Notice $V$ is nearly of the form $x-\sin(x)$ and is of a general Keplarian$^{1}$ form where the eccentric anomoly is commonly sought from the mean anomoly in the gravitation two body problem. This problem of solving $y=x-\sin(x)$ for $x$ is not algebraic. There is no closed or finite algebraic series representing $x=f(y)$. Newton's method which relies on the derivative, can be used to approximate $x=f(y)$ to arbitrary accuracy.

Newton's Method

$x_n=x_{n-1}-\frac{f(x_{n-1})}{f'(x_{n-1})}$

$V=g(x)$ where $g(x)$ is as above, then we can define $f(x)=g(x)-V$ and use Newton's method to find a zero of $f(x)$ because Newton's method finds zeros. $x :f(x)=0$ implies $V=g(x)$ and so if you give me a $V$ I can find the corresponding $x$ value and this is how we can express $g^{-1}(V)=x$. There is no other way in the sense that any other way will be an infinite sequence or recursive sequence.

Note

Label $2\cos^{-1}(\frac{r-h}{r})$ as $x$, then we get a new expression for $V$.

$V=10^6(\frac{r^2}{2}x-\sin(x))$ and $f(x)=10^6(\frac{r^2}{2}x-\sin(x))-V$

$\frac{d}{dx}f(x)=10^6(\frac{r^2}{2}\frac{d}{dx}x-\frac{d}{dx}\sin(x))=10^6(\frac{r^2}{2}-\cos(x))$

$x_n=x_{n-1}-\frac{10^6(\frac{r^2}{2}x_{n-1}-\sin(x_{n-1}))-V}{10^6(\frac{r^2}{2}-\cos(x_{n-1}))}$ (don't you dare cancel those $10^6$ haha)

Java

In java I found it was best to use a for loop, I tried recursive method for elegance but started getting stack overflows at over 1000 iterations.

public static double CalculateX(double Volume, double Radius, double  n, double x)
{
for(int i = 0; i < n; i++)
{

Running this method I found a zero at $x=4182098.763994463$. This is the value $x$ must take on in order for your expression for $V$ to be valid. The problem is that earlier we knew $x=2\cos^{-1}(\frac{r-h}{r})$ and
$2091049.3819972315=\cos^{-1}(a)$ is not possible for any $a \in \Bbb R$. Arc cosine has a range of at most $\pi$. And so we know now for any $h$ this expression can never equal the Volume asked for.
• I've edited the OP's post to give more details. While it is easy to find total volume $(2)$, it is hard to arrive at the value $(3)$ using formula $(1)$. I think there is an error in his formula. Aug 1, 2015 at 7:04