maximize product of two sines with given precision and for smallest time parameter 
Consider the function $f(t)=\text{sin}(\omega_1 t)\text{sin}(\omega_2 t)$, where $\omega_1 \ \text{and}\ \omega_2 \in \mathbb{R} $.
Is there a numerical or analytical solution to the following optimization problem:  

find minimal $t$ so that $f(t)\ge 1-p$, where $p<<1$ is the precision required.


Thanks in advance for any help!
Background: I am solving spin dynamics of an electron, where my spin oscillates with two different frequencies, and am wondering what is the smallest time that I need to flip my spin with a given precision p .
 A: Although it is not a complete answer, my answer provides some partial solution to your problem (existence).
Depending on $w_1$ and $w_2$, the minimizer may not exist.
Let us first consider the maximum of $f(t) = \sin(w_1t)\sin(w_2t)$.
Since, at the maximum, $\sin(w_1t) = \sin(w_2t)$, without loss of generality, suppost $\sin(w_1t) = \sin(w_2t) > 0$. This can only happen when $w_1t + w_2t = \pi$ in mod $2\pi$.
Suppose $w_1+w_2 \ne 0$. (If it is not the case, $f(t) \le 0$). 
Thus, at $\hat{t}_q = (\pi+2\pi q)/(w_1+w_2)$, we have 
$$
f(\hat{t}_q) = \sin^2(w_1\hat{t}_q) = \sin^2\left(\alpha+2\alpha q)\right),\qquad \alpha =\frac{w_1}{w_1+w_2}\pi.
$$
Let us consider the mapping $\phi_\alpha:x \mapsto x + 2\alpha$ in mode $2\pi$.
Then, let consider 
$$
\Omega = \{x_0=\alpha, x_1=\phi_\alpha(x_0),\cdots, x_k = \phi_\alpha(x_{k-1}), \cdots\}.
$$
By Ergodic theorem, if $\alpha/2\pi$ is rational number, $\Omega$ is finite.
If $\alpha/2\pi$ is irrational, $\Omega$ is dense in $(0,2\pi)$.
Therefore, if $\alpha/2\pi$ is rational, and 
$\max_{x \in \Omega} \sin^2x < 1- p$, the solution does not exist.
If $\alpha/2\pi$ is irrational,
there exists $x^* \in \Omega$ such that $|\sin^2 x^* -1| < p$.
