I'm attempting to find a function that will output a value for the height $h$ (which can also be represented as $y$) of water in a sphere of radius $r$ being filled at a constant rate.
For finding the volume of a sphere until a certain point ($h$) I have chosen to use integration and add the areas of all spheres up until that certain point to do so, we will use the formula $\pi r^2$ and modify it into $\pi r_y^2$ where $r_y$ is the radius of the circular slice of our sphere at height $y$. To do this accurately, we use integration to add an infinite amount of circles to form a sphere. That equation looks like so:
$$ V=\int_{-r}^h\pi r_y^2 \,dx $$
The work I've done so far has been broken into 2 major parts:
1.) Finding $r_y^2$
To find $r_y^2$, I've rearranged the equation of a circle to solve for $y$ and give a singular value, making it into a usable function for finding the radius of a circle at any given x coordinate between $-r$ and $r$:
$$ x^2+y^2=r^2 $$
$$ y^2=r^2-x^2 $$
$$ y=\pm\sqrt{r^2-x^2} $$
We only care about the absolute value to give us the value of $r$ so that last equation becomes:
$$ f(x)=\sqrt{r^2-x^2} $$
Which gives the shape:
$y=\sqrt{r^2-x^2}$ on Desmos.com">
Now that we have a function for finding $r_y^2$ (although the equation is in terms of $x$ the equation will work nonetheless which will be demonstrated soon) we are good to move on to step 2.
2.) Solving for height $h$
We can use our equation for volume $V$ which adds the areas of all circles under a point $y=h$ in that sphere and plug in our new function for finding the radius of a circle at a different height in our sphere:
$$ V=\int_{-r}^h\pi r_y^2 \,dx $$
$$ V=\int_{-r}^h\pi f(x)^2 \,dx $$
$$ V=\int_{-r}^h\pi \sqrt{r^2 - x^2}^2 \,dx $$
$$ V=\int_{-r}^h\pi(r^2 - x^2) \,dx $$
Before going any further, to make sure that this equation is correct in finding the volume of a sphere of radius $r$, we will use $h=r$ and solve to see if we get the volume of a sphere equation $\frac{4}3 \pi r^2$:
$$ V = \int_{-r}^r\pi(r^2 - x^2) \,dx $$
$$ =\pi\left(\int_{-r}^hr^2 - x^2 \,dx\right) $$
$$ =\pi\left(\int_{-r}^hr^2 \,dx - \int_{-r}^rx^2 \,dx \right) $$
$$ =\pi\left([r^2 x]_{-r}^r - [\frac{1}3 x^3]_{-r}^r \right) $$
$$ =\pi\left(r^2 [x]_{-r}^r - \frac{1}3 [x^3]_{-r}^r \right) $$
$$ =\pi\left(r^2 [r - (-r)] - \frac{1}3 [r^3 - (-r)^3] \right) $$
$$ =\pi\left(r^2 [r + r] - \frac{1}3 [r^3 + r^3] \right) $$
$$ =\pi\left(2r^3 - \frac{2r^3}3 \right) $$
$$ =\pi\left(\frac{6r^3}3 - \frac{2r^3}3 \right) $$
$$ =\pi\left(\frac{4r^3}3 \right) $$
$$ =\pi \cdot \frac{4}3 \cdot r^3 $$
$$ V = \frac{4}3 \pi r^3 $$
Now that we know this equation is effective at finding the volume of a sphere, we will attempt to solve for $h=h$ rather than $h=r$. We will take it from the 5$^{th}$ equation onwards though as all of the steps for finding the indefinite integral are the same until there:
$$ V = \pi\left(r^2 [x]_{-r}^h - \frac{1}3 [x^3]_{-r}^h \right) $$
$$ V = \pi\left(r^2 [h - (-r)] - \frac{1}3 [h^3 - (-r^3)] \right) $$
$$ V = \pi\left(r^2 [h + r] - \frac{1}3 [h^3 + r^3] \right) $$
$$ V = \pi\left(hr^2 + r^3 - \left(\frac{h^3}3 + \frac{r^3}3 \right) \right) $$
$$ V = \pi\left(hr^2 + r^3 - \frac{h^3}3 - \frac{r^3}3 \right) $$
$$ \frac{V}\pi = hr^2 + r^3 - \frac{h^3}3 - \frac{r^3}3 $$
$$ \frac{V}\pi - r^3 + \frac{r^3}3 = hr^2 - \frac{h^3}3 $$
$$ \frac{V}\pi - r^3 + \frac{r^3}3 = 3hr^2 - h^3 $$
$$ h(3r^2 - h^2) = \frac{V}\pi - r^3 + \frac{r^3}3 $$
$$ h(3r^2 - h^2) = \frac{3V}{3\pi} - \frac{3r^3\pi}{3\pi} + \frac{r^3\pi}{3\pi} $$
$$ h(3r^2 - h^2) = \frac{3V - 3r^3\pi + r^3\pi}{3\pi} $$
$$ h(3r^2 - h^2) = \frac{3V - 2r^3\pi}{3\pi} $$
This is as far as I've gotten. I've attempted going further by making a quadratic equation in the form $ax^2 + bx + c = 0$ where $x$ is replaced with $r$ and I solve for $r$ to place that equation back in, but that lead to the equation $0 = 0$, which means I did it right, it's just not what I'm looking for. I also realised later that it's required for $r$ to be in the equation for finding $h$ so to get rid of it would defeat the purpose of this equation. Assuming $V$ and $r$ are known variables which will be plugged in, how do you solve the equation we came up with in terms of $h$?
$$ h(3r^2 - h^2) = \frac{3V - 2r^3\pi}{3\pi} $$
P.S. I have put it into Wolfram Alpha and it gave me some extremely complicated answers. Here's the link to the answer. If the link isn't working, type this into Wolfram Alpha and click "=": "h(3r^(2) - h^(2)) = (3V - 2r^(2)pi)/pi solve h".
Cardano is not the best way to go here. Try the trigonometric solution. Your equation is already depressed, so you can ignore that part. Your equation has $$p = -3r^2\\q = \frac{3V - 2r^3\pi}{3\pi}$$$p < 0$, so the solutions will involve real numbers only.