Integrating square root with condition I am an engineer working on a problem that requires the use of integration to calculate compression force within a segment. I have worked out the formula, I just need help with the integration as I have left school long time ago.
$$
F = \int_{0}^{d} 2eE(1 - y/d) \sqrt{\max(0, 2ry - y^2)}\, dy
$$
$y$ is the variable, the rest are constants with radius $r > 0$.
e - strain;
E - stiffness;
d - neutral axis depth;
y - depth;
F - force
 A: Observe that $\max(0, 2ry - y^2)$ is $0$ except on the interval $[0, 2r]$. Therefore, assuming $r > 0$ and setting $\alpha = \min(d, 2r)$, the integral boils down to
$$\begin{align*}
F &= \int_0^\alpha 2eE(1 - y/d)\sqrt{2ry - y^2}\,\mathrm dy =\\
&= 2eE\int_0^\alpha\sqrt{2ry - y^2}\,\mathrm dy - \frac1d \int_0^\alpha y\sqrt{2ry - y^2}\,\mathrm dy =\\
&= 2eE A - \frac1d B
\end{align*}$$
The first integral involves completing the square and substituting $y - r = r \sin \theta$. We get
$$A = r^2\int_{-\pi}^{\beta}\cos^2\theta\,\mathrm d\theta = \left.r^2\frac{\theta + \sin\theta\cos\theta}{2}\,\right|_{-\pi}^{\beta}$$
with $\beta = \arcsin(\alpha/r - 1)$.
With the same substitution,
$$B = r^2\int_{-\pi}^{\beta}(r + r\sin\theta)\cos^2\theta\,\mathrm d\theta = \left.\frac16 r^3(3\theta - 2\cos^3\theta + 3\sin\theta\cos\theta)\,\right|_{-\pi}^{\beta}$$
After some calculations,
$$\begin{align*}A &= \frac12 r^2 (\beta + \sin\beta\cos\beta + \pi)\\[2ex]
B &= \frac16 r^3(3(\beta + \sin\beta\cos\beta + \pi) - 2(\cos^3\beta + 1))
\end{align*}$$
We can simplify further by noting that $\sin\beta = \beta$ and $\cos\beta = \sqrt{1 - \gamma^2}$, with $\gamma = \alpha/r - 1$.
Note that we also assumed $d > 0$. If instead it is $d < 0$ the result is simply $-F$.
A: Wolfram is kind enough to give you the indefinite integral.

Now it suffices to restrict the integration domain to the interval where $2ry-y^2\ge0$, i.e. $[0,2r]$.

If you prefer to solve "by hand", set $x=r(1-\sin t)$ and the integral will take the form
$$\int (a\sin t+b)\cos^2t\,dt=-\frac a3\cos^3t+\frac b2(\sin t \cos t+t).$$
