Q:

What is the cdf for a partially non-continuous pdf?

Suppose there is a pdf/pmf (?!) which places an atom of size 0.5 on x = 0 and randomizes 
uniformly with probability 0.5 over the interval [0.5,1]. 
Such that...
\begin{equation}
    f(x)=
    \begin{cases}
      0.5, & \text{if}\ x=0 \\
      {1\over (1-0.5)}, & \text{if}\ 0.5 ≤ x ≤ 1 \\
      0, & \text{otherwise}
    \end{cases}
  \end{equation}
Does the corresponding cdf then look like the following?
\begin{equation}
    F(x)=
    \begin{cases}
      0.5, & \text{if}\ x < 0.5 \\
      0.5+0.5\cdot{(x-0.5)\over (1-0.5)}, & \text{if}\ 0.5 ≤ x ≤ 1 \\
      1, & \text{if}\ x > 1
    \end{cases}
  \end{equation}
And how to calculate the expected value of this cdf formally? 
I suppose that 
\begin{equation}
    E(x)={3\over 8}
 \end{equation}
...but I dont know exactly how to formally deal with the intervalls as f(x) is not continuous.
Thank you in advance!

A:

In what sense this is a density function will bear examination. Normally one says $f$ is a probability density function for the distribution of a random variable $X$ if
$$
\Pr(a<X<b) = \int_a^b f(x) \, dx
$$
for all values of $a,b.$ But $\displaystyle \int_a^b \cdots\cdots\,dx$ means an integral with respect to Lebesgue measure, which is the measure that assigns to every interval $(c,d),$ for $c<d,$ its length $d-c.$ That measure assigns $0$ to an interval that is only a point, so the integral of any function over that point is $0.$
However, suppose one integrates with respect to a measure that assigns measure $1$ to the one-point set $\{0\}$ and assigns the length of every interval to that interval if $0$ is not a member of the interval. Then what you've got is a density.
But there's no need to go into that in order to answer your question about the expected value. The c.d.f. is
$$
F(x) = \Pr(X\le x) = \begin{cases} 0 & \text{if } x<0, \\ 1/2 & \text{if } 0\le x \le 1/2, \\ x & \text{if } 1/2<x\le 1, \\ 1 & \text{if } x\ge1.  \end{cases}
$$
The expected value is
$$
\operatorname E(X) = 0 \cdot\Pr(X=0) + \int_{1/2}^1 x\cdot\left(\frac 1 2 \, dx\right) = \frac 3 8.
$$
Suppose $m$ is the measure described above, assigning measure $1/2$ to $\{0\}$ and the length of each interval to the interval if it does not contain $0.$ Then one can write
$$
\operatorname E(X) = \int_{-\infty}^\infty xf(x)\,dm(x)
$$
and its value will be $3/8.$

