# How to calculate the median absolute deviation for a continuous function?

I know that the median value $(\text{Med})$ for a variable $X$ characterised by the contentious PDF function $f_X(x)$ can be calculated by finding $\text{Med}$ in:

$\int^\text{Med}_{-\infty} dF_X(x) = \int^\text{Med}_{-\infty} f_X(x) dx = {1\over2}$

And $F(x)$ is the CDF of $X$. In other-words:

$\text{Med} = F^{-1}(1/2)$

So if $f_X(x) = {1\over b-a}$, i.e a uniform distribution [a,b] we have that:

$\int^\text{Med}_{a} {1\over b-a} dx = {\text{Med}-a\over b-a} = {1\over2}$

and

$Med = {1\over2}(b+a)$

The median absolute deviation is given by

$\text{Mad} = G^{-1}(1/2)$

Where $G$ is the CDF of the |x-M|. How can I find $\text{Mad}$? Is there a similar formula for it?

$G(x)=P(|X-M|\leq x)=P(X\in[M-x;M+x])$
Thus, for a uniform distribution, for $x\leq\frac{b-a}{2}$ :
$G(x)=\frac{2x}{b-a}$
$G(x)=\frac{1}{2}\Leftrightarrow x=\frac{b-a}{4}$