How to calculate the MLE for Gilbert's Sine Distribution? $$ f(x) = \frac{\pi}{2b}\sin\left(\pi\frac{x-a}{b}\right),~~x\in[a,a+b]$$
So it's a pretty simple distribution, which is just a scaled sine wave. As an experiment, I was trying to find the MLE estimates of $a$ and $b$ but I can't find it for $b$ and the result for $a$ doesn't seem to work. Intuitively, you want to move $a$ and $b$ closer to the point $x. $
$$\frac{\partial\textrm{ MLE}}{\partial a}=-\frac{\pi^2\cos\left(\pi\frac{x-a}{b}\right)}{2b^2};$$
root/zero found at $a = \frac{2x+b}2.$
$$\frac{\partial\textrm{ MLE}}{\partial b}=-\frac{\pi\cdot \left(\sin\left(\pi\frac{x-a}{b}\right)b+ (\pi x-\pi a) \cos\left(\pi\frac{x-a}{b}\right)\right)}{2b^3}.$$

Firstly, without imposing a parameter range for $a$ we are obviously going to get a non-unique MLE, since we can shift it by increments of $2 \pi$ without any change to the distribution (i.e., the parameter is non-identifiable within these equivalence classes).  Given observations $x_1,...,x_n \sim \text{IID GilbertSine}(a,b)$ you can write the resulting likelihood function as:
$$\begin{align}
L_\mathbf{x}(a,b)
&= \prod_{i=1}^n \frac{\pi}{2b} \cdot \sin \bigg( \pi \cdot \frac{x_i-a}{b} \bigg) \cdot \mathbb{I}(a \leqslant x_i \leqslant a+b) \\[6pt]
&= \mathbb{I}(a \leqslant x_{(1)}) \cdot \mathbb{I}(a+b \geqslant x_{(n)}) \cdot \frac{\pi^n}{2^n b^n} \prod_{i=1}^n \sin \bigg( \pi \cdot \frac{x_i-a}{b} \bigg). \\[6pt]
\end{align}$$
Consequently, over the support of this distribution (i.e., when $a < x_{(1)}$ and $a+b > x_{(n)}$) the log-likelihood function is:
$$\ell_\mathbf{x}(a,b)
= \text{const} - n\log(b) + \sum_{i=1}^n \log \sin \bigg( \pi \cdot \frac{x_i-a}{b} \bigg),$$
and the score function is:
$$\begin{align}
s_\mathbf{x}(a,b) \equiv \nabla \ell_\mathbf{x}(a,b)
&= - \frac{\pi}{b} \begin{bmatrix} 
\sum_i \frac{\cos(\pi(x_i-a)/b)}{\sin(\pi(x_i-a)/b)} \\
\frac{n}{\pi} + \sum_i \frac{x_i-a}{b} \frac{\cos(\pi(x_i-a)/b)}{\sin(\pi(x_i-a)/b)} \\
\end{bmatrix}. \\[6pt]
\end{align}$$
Any MLE $(\hat{a},\hat{b})$ will occur at a critical point satisfying the nonlinear equations:
$$\sum_{i=1}^n \frac{\cos(\pi(x_i-a)/b)}{\sin(\pi(x_i-a)/b)} = 0
\quad \quad \quad \quad \quad 
\sum_{i=1}^n \frac{x_i-a}{b} \cdot \frac{\cos(\pi(x_i-a)/b)}{\sin(\pi(x_i-a)/b)} = - \frac{n}{\pi}.$$
You would need to use numeric methods to solve this equation to obtain the MLE.
