Parameter estimation for Stochastic differential equation

For geometric Brownian motion we have (by solving the SDE) $$\log X_{t_i}=\log X_{t_{i-1}}+\tilde\mu(t_i-t_{i-1})+\sigma(B_{t_i}-B_{t_{i-1}}),\quad i=1,..,n$$ where $\tilde\mu=\mu-\frac{\sigma^2}{2}$. Hence the conditional distribution of $X_{t_i}$ given $X_{t_{i-1}}$ is log-normal with mean equal to $\log X_{t_{i-1}}+\tilde\mu(t_i-t_{i-1})$ and variance $\sigma^2 (t_i-t_{i-1})$. Suppose that $X_0=x_0$ is fixed (the calculations are very similar if $X_0$ is itself lognormal, just add another term), the log of the joint density of the vector $(X_{t_1},...,X_{t_n})$ at $x_1,...,x_n$ takes the following form: $$\log p(x_1,...,x_n)=-\sum_{i=1}^n\log x_i-\frac{n}{2}\log 2\pi\sigma^2-\frac{1}{2}\sum_{i=1}^n\log\Delta t_i-\frac{1}{2}\sum_{i=1}^n\frac{(\log x_i-\log x_{i-1}-\tilde\mu\Delta t_i)^2}{\sigma^2\Delta t_i},$$ where we introduced $\Delta t_i=t_i-t_{i-1}$. Differentiating this wrt. $\mu$, we obtain $$\partial_{\tilde\mu}\log p=\frac{1}{\sigma^2}\Big(\log x_n-\log x_0-\tilde\mu(t_n-t_0)\Big)=0\quad\Longrightarrow\quad\tilde\mu=\frac{\log x_n-\log x_0}{t_n-t_0},$$ and by using this, we can also solve the other equation: $$\partial_{\sigma^2}\log p=\frac{1}{2\sigma^2}\Big(\frac{1}{\sigma^2}\sum_{i=1}^n\frac{(\log x_i-\log x_{i-1}-\tilde\mu\Delta t_i)^2}{\Delta t_i}-n\Big)=0$$ $$\quad\Longrightarrow\quad\sigma^2=\frac{1}{n}\sum_{i=1}^n\frac{(\log x_i-\log x_{i-1}-\tilde\mu\Delta t_i)^2}{\Delta t_i}.$$