If
$$f(x;\theta) = \frac{1}{\sqrt{2\pi\theta}}e^{-x^2/(2\theta)},$$
what is the maximum likelihood estimator of $\theta$?
(I answered my own question, since writing all this code made me aware the flaws in my original math. Perhaps some may find a use for it. $\LaTeX$ is too much grind to simply delete it...)
The likelihood function is:
$$L(\theta) = (2\pi\theta)^{-\frac{n}{2}}e^{-\sum{x_i^2}/(2\theta)}$$
and the log-likelihood is:
$$l(\theta) = -\frac{n}{2}\ln{(2\pi)}-\frac{n}{2}\ln{(\theta)}-\frac{\sum{x_i^2}}{2\theta}$$
Differentiating:
$$\frac{d l(\theta)}{d\theta} = -\frac{n}{2\theta}+\frac{\sum{x_i^2}}{2\theta^2}$$
Equating to 0 yields:
$$\hat{\theta} = \frac{\sum{x_i^2}}{n}$$