Continuity domain for momentum operator I know this is essentially a mathematic question, but I received no answer on math SE. Moreover it has a direct application in physics, so I thought to ask this here too.
The momentum operator in one dimension in quantum mechanics is $P=-i\frac{d}{dx}$ (with $\hbar=1$). Consider it as an operator on $L_2(0,2\pi)$, the space of square-integrable functions on $(0,2\pi)$. It isn't continuous in fact if I consider the sequence
$$
g_n(x)=\frac{e^{inx}}{\sqrt{2\pi n}}
$$
it's a Cauchy sequence but $\{Pg_n\}_n$ does not converge.
I am searching a domain where $P$ is a continuous functional. My professor gave me the example 
$$D_P=\{\varphi \in L_2(0,2\pi):\varphi(0)=\varphi(2\pi) \}$$
but I'm not convinced because if I consider the function $\psi$
\begin{equation}
   \begin{cases}
   -\frac{x}{\sqrt{\pi}}+\sqrt{\pi},\hspace{0.5cm} 0\leq x<\pi\\\sqrt{x-\pi},\hspace{0.5cm} \pi\leq x \leq 2\pi
   \end{cases} 
\end{equation}
it belongs to $D_P$, but if I apply $P$ on it I obtain
\begin{equation}
   \begin{cases}
   \frac{i}{\sqrt{\pi}},\hspace{0.5cm} 0\leq x<\pi\\ -\frac{i}{2\sqrt{x-\pi}},\hspace{0.5cm} \pi\leq x \leq 2\pi
   \end{cases} 
\end{equation}
that is not square-integrable on $(0,2\pi)$.

Am I wrong? If not, which is a correct continuity domain for $P$?
 A: Sorry, the answer to this technical question needs some mathematical technology.
The space you are looking for is $H^1(\mathbb R)$, the first Sobolev Hilbert space. It is made of the functions in $L^2(\mathbb R)$ admitting the weak first derivative represented by a $L^2$ function in turn.
$H^1(\mathbb R)$ is a complex Hilbert space if equipped with the scalar product: $$\langle \psi| \phi \rangle := \int_{\mathbb R} \overline{\psi}(x) \phi(x) dx + \int_{\mathbb R} \overline{\frac{d\psi}{dx}} \frac{d\phi}{dx} dx\qquad (1)$$ where $d/dx$ denotes the weak derivative (see below).
Equivalently, $H^1(\mathbb R)$ can be defined as the space of $L^2$ functions $\psi(x)$ whose Fourier (-Plancherel) transform $\hat{\psi}(k)$ admit finite $L^2$ norm with respect to the measure $(1+ k^2) ~ dk$ instead of the simpler $dk$.
Indeed it holds, where the scalar product is the same as in (1):
$$\langle \psi| \phi \rangle := \int_{\mathbb R} \overline{\hat{\psi}}(k) \hat{\phi}(k)(1+ k^2)  dk \qquad (2)\:.$$
Obviously it also holds: $H^1(\mathbb R)\subset L^2(\mathbb R, dx)$
Sticking to work in the physically sensible Hilbert space $L^2(\mathbb R, dx)$ for QM, it turns out that  $H^1(\mathbb R)$ is the natural domain where the momentum operator is self-adjoint (not only Hermitian or symmetric). However, in that Hilbert space, the momentum operator, whose correct definition is:
$$P = -i \frac{d}{dx}\quad \mbox{in weak sense, and with domain $D(P)= H^1(\mathbb R)$}$$
is always unbounded, i.e. discontinuous.
So, to see $P$ as a bounded (i.e. continuous) operator it is not enough to restrict it to an appropriate domain, but you also have  to change the topology (norm) of the domain, passing from that of the simple $L^2$ to that of $H^1(\mathbb R)$. The topology in the co-domain remains that of $L^2$.
NOTE 1. A (measurable) function $f: \mathbb R \to \mathbb C$ is said to admit weak derivative $\frac{df}{dx}=g$, where $g$ is another (measurable) function, if, for every $h: \mathbb R \to \mathbb C$ of class $C^\infty$ and compactly supported, one has:
$$\int_{\mathbb R} f(x) \frac{dh}{dx} dx = - \int_{\mathbb R} g(x) h(x) dx \:.$$
For instance $f(x)= |x|$ does not admit derivative at $x=0$ however admits weak derivative given by $\mbox{sgn}(x)$. The Dirichlet function
$d(x) = 1$ if $x$ is rational $d(x)= 0$ if $x$ is not rational does not admit a derivative anywhere, but it admits weak derivative given by the zero function.
NOTE 2. If dealing with the particle in $[0,2\pi]$ the situation is analogous. The self-adjointness domain of $P$ is $H^1((0,2\pi))$ and $P$ is defined as before. The only change is that passing in Fourier rep. one has to use Fourier series instead of Fourier transform.  In this case the $H^1((0,2\pi))$ scalar product becomes:
$$\langle \psi | \phi \rangle = \sum_{n \in \mathbb Z} \overline{\psi_n} \phi_n (1+ n^2)\:.$$
In the Hilbert space $H^1((0,2\pi))$ as domain and  with values in $L^2$, $P$ is continuous, otherwise, it is unbounded as usual.
What it is true in the statement of your professor, is that the set of $C^1$ functions on $[0,2\pi]$ with $f(0)= f(2\pi)$ is included in $H^1((0,2\pi))$.
