Evaluating commutator of $[\operatorname{sign}(X),\, \operatorname{sign}(P)]$ I wish to evaluate the following commutator: $[\operatorname{sign}(X),\, \operatorname{sign}(P)]$.
Is there a general method for evaluating $[\operatorname{f}(X), \operatorname{f}(P)]$? I thought of a Taylor expansion but $\operatorname{sign}(x)$ is discontinuous on $x=0$.
How would you evaluate this commutator?
 A: I) The CCR reads
$$\tag{1} [\hat{X},\hat{P}]~=~i\hbar ~{\bf 1}. $$
We can imitate the Dirac delta function and the signum function via the following integral representations$^1$
$$\tag{2}  \delta(\hat{X})~=~ \int_{\mathbb{R}} \! \frac{{\rm d}p}{2\pi\hbar} \exp\left(\frac{p\hat{X}}{i\hbar}\right), \qquad  
\delta(\hat{P})~=~ \int_{\mathbb{R}} \! \frac{{\rm d}x}{2\pi\hbar} \exp\left(\frac{i x\hat{P}}{\hbar}\right), $$
$$\tag{3}  {\rm sgn}(\hat{X})~=~ \int_{\mathbb{R}} \! \frac{i{\rm d}p}{\pi p} \exp\left(\frac{p\hat{X}}{i\hbar}\right),  \qquad 
{\rm sgn}(\hat{P})~=~ \int_{\mathbb{R}} \! \frac{{\rm d}x}{i\pi x} \exp\left(\frac{ix\hat{P}}{\hbar}\right). $$
The sought-for commutator can e.g. be written in $\hat{X}\hat{P}$-ordered form
$$\tag{4}   [{\rm sgn}(\hat{X}),{\rm sgn}(\hat{P})]
~=~ \iint_{\mathbb{R}^2} \! \frac{{\rm d}x~{\rm d}p}{\pi^2 xp}
\left[1-\exp\left(\frac{px}{i\hbar}\right)\right]
\exp\left(\frac{p\hat{X}}{i\hbar}\right)
\exp\left(\frac{ix\hat{P}}{\hbar}\right). $$
In eq. (4) we have used the following truncated Baker-Campbell-Hausdorff formula
$$\tag{5} e^{\hat{A}}e^{\hat{B}}
~=~e^{[\hat{A},\hat{B}]}e^{\hat{B}}e^{\hat{A}}, $$
which holds if the commutator $[\hat{A},\hat{B}]$ commutes with both the operators $\hat{A}$ and $\hat{B}$.
II) On a wavefunction $\psi(x)=\langle x |\psi\rangle $ in the Schrödinger position representation, 
$$\tag{6} \hat{X}~=~x, \qquad \hat{P}~=~\frac{\hbar}{i}\frac{\partial}{\partial x}, $$
we have
$$\tag{7} \langle x |{\rm sgn}(\hat{P}) |\psi\rangle~=~ \int_{\mathbb{R}} \! \frac{{\rm d}y}{i\pi y}\langle x+y |\psi\rangle, $$
and therefore the matrix element of the sought-for commutator becomes
$$\tag{8} \langle x |[{\rm sgn}(\hat{X}),{\rm sgn}(\hat{P})] |\psi\rangle
~=~ \int_{\mathbb{R}} \! \frac{{\rm d}y}{i\pi y}\left({\rm sgn}(x)-{\rm sgn}(x+y)\right)\psi(x+y).$$
--
$^1$ The Cauchy principal value is implicitly assumed in pertinent places.
A: Here is my answer (I have had time to answer only today). First of all, in general, if $A$ is a self-adjoint operator in the Hilbert space $H$  with spectrum $\sigma(A)\subset R$ (actually a closed normal operator would be enough), and $f: \sigma(A) \to C$ is a Borel measurable function (so for instance continuous up to a finite number of points would be OK), $f(A)$ is defined as:
$$f(A) := \int_{\sigma(A)} f(\lambda) dP^{(A)}(\lambda)\:,\qquad (1)$$
where $\{P^{(A)}_E\}_{E \in {\cal B}(R)}$ is the so-called  spectral measure of $A$ (for instance see http://planetmath.org/spectralmeasure). The $P_E$ are orthogonal projectors labelled by Borel sets $E$. Actually it turns out that $P_E=0$ if $E\cap \sigma(A)= \emptyset$, in this sense the measure is concentrated on the spectrum of $A$. Physically speaking $\sigma(A)$ is the set of the values that the observable $A$ can assume. 
The fact that $A$ is sefl-adjoint guarantees  the existence of the above mentioned notions and the feasibility of the construction I go to summarize. 
The integral in (1) is defined in a way similar to that used for Riemann or Lebesgue integrals, first defining the integral of a function $s$ attaining a finite number of values $s_1,\ldots, s_n$ on corresponding sets $E_1,\ldots, E_n$:
$$S(A) := \int_{\sigma(A)} s(\lambda) dP^{(A)}(\lambda) := \sum_{i=1}^n s_i P_{E_i} \qquad (1)'$$ 
and then taking the limit over a sequence of such functions $S_j$ point-wise tending to $f$ as $j \to +\infty$:
$$\int_{\sigma(A)} f(\lambda) dP^{(A)}(\lambda) \psi := \lim_{j\to +\infty} \int_{\sigma(A)} s(\lambda) dP^{(A)}(\lambda)\psi\:. \quad (2)$$
The notion of convergence is that of the Hilbert space of the theory. The given definition makes precise the domain of $f(A)$: It is given by the vectors $\psi \in H$ such that the limit in (2) exists. 
It is worth stressing that:
(a) the operator $f(A)$ is bounded (that is continuous) and defined on the whole Hilbert space, if the function $f$ is bounded over $\sigma(A)$;
(b) it holds: $$A = \int_{\sigma(A)} \lambda dP^{(A)}(\lambda)$$
and this identity completely determines $\{P_E^{(A)}\}_{E\in {\cal B}(R)}$ for a given self-adjoint opertor $A$. It also arises taking (a) into accoutn, that $A$ is bounded if (and only if) the map $\lambda \to \lambda$ is bounded over $\sigma(A)$ that, in turn, means that $\sigma(A)$ is bounded.
To answer to the general question of the OP, the above given definition of $f(A)$ is that one has to use to compute things like $[f(X), f(P)]$.
If $f$ is not bounded the domains of $f(X)$ and $f(P)$ are not the whole Hilbert space, and thus great care has to be used in computing the commutator above, since it is defined only in a common invariant domain.
However, this is not the case for $f= sgn$, since it is bounded.
Let us pass to the computation of $[sgn(X), sgn(P)]$ that, consequently,  is a bounded operator as well.
If $A=X$ (position operator in $L^2(R)$), its spectral measure is quite trivial:
$$(P^{(X)}_E \psi)(x):= \chi_{E}(x)\psi(x)\:,\qquad (3)$$
where $\chi_E(x)=1$ if $x\in E$ and $\chi_E(x)=0$ if $x\not \in E$. Consequently, exploiting (1)' (because $sgn$ assumes only three values (respectively $-1$ in $E_1=(-\infty,0)$, $0$ in  $E_2= \{0\}$, $1$ in $E_3= (0,+\infty)$), one immediately sees that:
$$(sgn(X) \psi)(x) = sgn(x) \psi(x)\:. \qquad (4)$$
We have next to focus on the momentum operator $P$. In the following I will assume $\hbar=1$ for the sake of notational simplicity. Henceforth ${\cal F}: L^2(R) \to L^2(R)$ is the Fourier transform, defined on $L^1$ functions (and than extended by $L^2$ continuity into an unitary map on $L^2$) by the usual integral formula:
$${\cal F}: \psi(x) \mapsto \hat{\psi}(p) := \frac{1}{\sqrt{2\pi}}\int_R e^{-ipx} \psi(x) dx\:.$$
With these definitions, it turns out that the spectral measure of $P$ is
$$(P^{(P)}_E \psi)(x) := {\cal F}^{-1}\left( \chi_E \cdot \hat{\psi}\right)(x)$$
In other words: in momentum representation, the spectral measure of $P$  exactly coincides with that of $X$ in position representation.
As the spectral theory is "covariant" under unitary transformations, it implies in particular that $sgn(P)$ in momentum representation is again defined as:
$$\left(sgn(P)_{momentum} \hat{\psi}\right)(p) = sgn(p) \hat{\psi}(p)\:,$$
so that, coming back to the position representation:
$$sgn(P)\psi = {\cal F}^{-1} \left(sgn(p) \hat{\psi}(p)\right)\:. \quad (5) $$
We are in a position to compute the wanted commutator. I will assume that $\psi \in {\cal S}(R)$ the Schwartz space, because, in this case the Fourier transform can be computed as the usual integral and since that space is dense in $L^2$ so that the final result can be achieved simply taking a limit (as the commutator being bounded as stressed above). With that choice of $\psi$ all integration can be safely swapped. I do not enter into details.
Exploiting (4) and (5) (and interchanging integrals) we have almost immediately:
$$\left(sgn(X)sgn(P) \psi\right)(x)= \int\int \frac{e^{ip(x-y)}}{2\pi} sgn(p) sgn(x) \psi(y) dy dp$$
and
$$\left(sgn(P)sgn(X) \psi\right)(x)=  \int\int \frac{e^{ip(x-y)}}{2\pi} sgn(p)sgn(y) \psi(y) dy dp\:.$$
Taking the difference and inserting an $\epsilon$ prescription to separate integrals, we have:
$$\left([sgn(X),sgn(P)]\psi \right)(x) =  \lim_{\epsilon \to 0^+}\int \left(\int \frac{e^{ip(x-y) -|p| \epsilon}}{2\pi} sgn(p) dp\right) 
(sgn(x) -sgn(y)) \psi(y) dy $$
Computing the integral (please check the values of the coefficients) we finally get:
$$\left([sgn(X),sgn(P)]\psi \right)(x) =  \lim_{\epsilon \to 0^+}\frac{1}{i\pi}\int_R 
\frac{(x-y)(sgn(x) -sgn(y))}{(x-y)^2 + \epsilon^2} \psi(y) dy \:.$$
Formally, it is possible to introduce the so-called Cauchy principal value:
$$\frac{1}{2}\frac{(x-y)}{(x-y)^2 + 0^2} =  Vp \frac{1}{x-y}$$
so the found identity can be re-arranged in terms of the Cauchy principal value as done in the other answer.
A: Why is this commutator needed? I would start by trying to evaluate $$\int\!dx'\,dp'\, \langle \phi |\operatorname{sgn}(x) |x'\rangle\langle x'|p'\rangle\langle p'|\operatorname{sgn}(p) |\psi\rangle$$
and then each integral gets split up, e.g., 
$$-\int_{-\infty}^0\!dx'\,dp'\, \langle \phi |x'\rangle\langle x'|p'\rangle\langle p'|\operatorname{sgn}(p) |\psi\rangle + \int_{0}^\infty\!dx'\,dp'\, \langle \phi |x'\rangle\langle x'|p'\rangle\langle p'|\operatorname{sgn}(p) |\psi\rangle$$
and similarly for $p'$, giving you 4 integrals.  The other half of the commutator is 
$$- \int\!dx'\,dp'\, \langle \phi |\operatorname{sgn}(p) |p'\rangle\langle p'|x'\rangle\langle x'|\operatorname{sgn}(x) |\psi\rangle$$
Keep in mind that $\langle p'|x'\rangle = \frac{1}{\sqrt{2\pi\hbar}}e^{-i p x}$ so that when you subtract the last 4 integrals from the first 4, you will need to relabel a coordinate to be able to cancel things out.
