Fitting a distribution with custom functions

If there is a gradient, otherwise you have to use Slice or Metropolis sampling.