Question: We have a given equation:

$$\int\_0^\alpha f(x)\ dx = \theta$$

with $f(x)$ and $\theta$ given.

$$\theta>0,$$
$$f(x) > 0 \text{ for all } x$$

What would be the most generic way to calculate $\alpha$? Numerical methods are allowed. 

If no generic way exists, how could we calculate it for eg. $f(x) = \sin^2 x + 1$?

Answer: 
Treat $a,\,a^\ast$ as independent variables so$$\operatorname{Re}a=\frac{a+a^\ast}{2},\,\operatorname{Im}a=\frac{a-a^\ast}{2i}\implies\partial\_a=\frac12\partial\_{\operatorname{Re}a}+\frac{1}{2i}\partial\_{\operatorname{Im}a}.$$Since $\operatorname{Re}z=e^{bt}(\operatorname{Re}a\cdot\cos\omega t-\operatorname{Im}a\cdot\sin\omega t)$, $$\partial\_a\operatorname{Re}z=\frac12 e^{bt}\cos\omega t-\frac{1}{2i}e^{bt}\sin\omega t=\frac12 e^{(b+i\omega)t}.$$Dividing out $dz/da=e^{(b+i\omega)t}$, the first equation requires $$\operatorname{Re}^\prime(z)=\frac12,$$which makes sense because $\operatorname{Re}z=\frac{z+z^\ast}{2}$. Similarly, you can show $\partial\_a\operatorname{Im}z=\frac{1}{2i}e^{(b+i\omega)t}$, whence$$\operatorname{Im}^\prime z=\frac{1}{2i},$$which makes sense because $\operatorname{Im}z=\frac{z-z^\ast}{2i}$.
The solution can be found by using the Cauchy-Riemann equations:

\begin{align\*}
Re'(z(t)) &= \frac{\partial\text{Re}(\text{Re}(z(t)))}{\partial\text{Re}(a)} + i\frac{\partial\text{Im}(\text{Re}(z(t)))}{\partial\text{Re}(a)}\\
&= \frac{\partial\text{Im}(\text{Re}(z(t)))}{\partial\text{Im}(a)} + i\frac{\partial\text{Re}(\text{Re}(z(t)))}{\partial\text{Im}(a)}\\
\end{align\*}

\begin{align\*}
Im'(z(t)) &= \frac{\partial\text{Re}(\text{Im}(z(t)))}{\partial\text{Re}(a)} + i\frac{\partial\text{Im}(\text{Im}(z(t)))}{\partial\text{Re}(a)}\\
&= \frac{\partial\text{Im}(\text{Im}(z(t)))}{\partial\text{Im}(a)} + i\frac{\partial\text{Re}(\text{Im}(z(t)))}{\partial\text{Im}(a)}\\
\end{align\*}

Where the real part of $z(t)$ is $$\text{Re}(z(t)) = \text{Re}(a)\exp(bt)\cos(\omega t) - \text{Im}(a)\exp(bt)\sin(\omega t)$$ and the imaginary part of $z(t)$ is $$\text{Im}(z(t)) = \text{Re}(a)\exp(bt)\sin(\omega t) + \text{Im}(a)\exp(bt)\cos(\omega t)$$

and therefore $$Re'(z(t)) = \exp(bt)\cos(\omega t)$$ and $$Im'(z(t)) = \exp(bt)\sin(\omega t)\text{.}$$

For the whole solution, we have to apply the chain rule, which then finally yields
\begin{align\*}
\frac{\partial}{\partial a}Re(z(t)) &= \exp(bt)\cos(\omega t)\exp((b+i\omega)t)\\
&= \exp((2b+i\omega)t)\cos(\omega t)
\end{align\*} and 
\begin{align\*}
\frac{\partial}{\partial a}Im(z(t)) &= \exp(bt)\sin(\omega t)\exp((b+i\omega)t)\\
&= \exp((2b+i\omega)t)\sin(\omega t)\text{.}
\end{align\*}