Its been years since I've taken calc and I remember absolute value functions aren't differentiable at 0, but don't remember what I'm supposed to do. I'm trying to solve for $\frac{\partial D}{\partial q_{k}}$ and $\frac{\partial D}{\partial d_{k}}$ (in order to set them to zero to minimize), where $$D=E[|x-Q(x)|]=\sum_{i=1}^{L}\int_{d_{i-1}}^{d_{i}}|x-Q(x)|P_{X}(x)\ dx$$ with L quantization levels: $$x_{q}=Q(x)=q_{i}$$ and L+1 decision levels: $$d_{i-1}<x\le d_{i}$$
I think I have to do this piecewise somehow?