Does the derivative of log have a Dirac delta term? Dirac writes down the following formula on page 61 of his "Principles of quantum mechanics":
$\frac{d}{dx}\log x = \frac{1}{x} -i\pi\delta(x)$, see http://adsabs.harvard.edu/abs/1947pqm..book.....D for the exact reference (but no text). What is the best way of formalizing this to a mathematician's satisfaction?
 A: Here is another context where something like this shows up, though I don't know how or if it's related to your question. Consider the simple left $\mathscr{D}$ module on $\mathbf{A}^1$ generated by $\text{log}x$, and similarly for $1/x$ and $\delta(x)$
$$\mathscr{D}\cdot\text{log}x\ =\  \mathscr{D}/\mathscr{D}\partial x\partial \ = \ k[x]\log x +k[x,x^{-1}],$$
$$\mathscr{D}\cdot 1/x\ =\  \mathscr{D}/\mathscr{D}\partial x \ = \ k[x,x^{-1}],$$
$$\mathscr{D}\cdot\delta(x)\ =\  \mathscr{D}/\mathscr{D}x \ = \ k[\partial]\delta(x)$$
where the global sections of $\mathscr{D}$ is the algebra $k[x,\partial]$ with $[x,\partial]=1$. There is an exact sequence of $\mathscr{D}$ modules
$$0 \ \longrightarrow \ \mathscr{D}\cdot 1/x \ \longrightarrow \ \mathscr{D}\cdot\log x\ \longrightarrow \ \mathscr{D}\cdot \delta(x)\ \longrightarrow \ 0$$
which in plain language just means that the subspace $k[x,x^{-1}]$ is preserved by $x$ and $\partial$.
Note that to get this $``\log=1/x+\delta"$ principle to work you really have to work with the whole $\mathscr{D}$ modules, not just consider elements of them. Indeed, the element $\log x\in\mathscr{D}\cdot\log x$ just satisfies $\partial \log x=1/x$.
A: $$
 \lim_{\epsilon \rightarrow0}  \int_{-\epsilon}^{+\epsilon}\frac{d\ln x}{dx} dx
= \lim_{\epsilon \rightarrow0}[\ln \epsilon-\ln(-\epsilon)]  \\
\ln(-\epsilon)= \ln\epsilon+ i\Theta \\
$$ choose the principle value for the angle$$
\Theta=\theta= \pi \\ 
\lim_{\epsilon \rightarrow0}  \int_{-\epsilon}^{+\epsilon}d\ln x 
= \lim_{\epsilon \rightarrow0}[\ln \epsilon-\ln(-\epsilon)] =\lim_{\epsilon \rightarrow0}[\ln \epsilon-\ln(\epsilon)-i\pi]=-i\pi
$$
$$\lim_{\epsilon \rightarrow0}  \int_{-\epsilon}^{+\epsilon}\frac{1}{x}dx =0$$
Because 1/x is a odd function, thus its integral vanished.
The left hand side equals to $-i\pi$, thus we need  add $-i\pi$ to the right hand side.
Above all, we can obtain 
$$ \lim_{\epsilon \rightarrow0}  \int_{-\epsilon}^{+\epsilon}\frac{d\ln x}{dx} dx = \lim_{\epsilon \rightarrow0}  \int_{-\epsilon}^{+\epsilon}\frac{1}{x}dx  -i\pi= \lim_{\epsilon \rightarrow0}  \int_{-\epsilon}^{+\epsilon}\frac{1}{x}- i\pi\delta(x)\ dx$$
According to the inside parts of integrals, we finally got 
$$ \frac{d\ln x}{dx} =\frac{1}{x}- i\pi\delta(x) $$
A: Belatedly fleshing out some of my initial comments, the following analysis suggests how naturally Dirac would have concluded that the derivative of $\ln(x)=\ln(|x|)+ i\pi H(-x) $ has a delta function from his exposure to potential theory developed in the 19-th century.
Note first
$$\frac{d}{dz}\ln(z)= \frac{1}{z} = \frac{x-iy}{x^2+y^2},$$
regardless of how the branch cut for the logarithm is chosen. The notion of a Dirac delta function follows naturally from a limiting Cauchy contour integration over a rectangular contour centered symmetrically about the origin whose length is $2L$ and height $2\epsilon.$ Let $f(z)$ be analytic within this contour. Then starting the contour at the lower left corner of the rectangle,
$$\frac{1}{2 \pi i}  \oint_{rect} \frac{f(z)}{z}dz = f(0)$$
$$= \frac{1}{2 \pi i} [ \int_{-L-i\epsilon}^{L-i\epsilon} + \int_{L-i\epsilon}^{L+i\epsilon} + \int_{L+i\epsilon}^{-L+i\epsilon} + \int_{-L+i\epsilon}^{-L-i\epsilon} ] \frac{f(z)}{z}dz.$$
Since we will let $\epsilon$ tend to zero, the two integrals over the vertical edges of the rectangle vanish in the limit, so consider just the two horizontal edges.
$$I(L,\epsilon) = \frac{1}{2 \pi i} [ \int_{-L-i\epsilon}^{L-i\epsilon} +  \int_{L+i\epsilon}^{-L+i\epsilon}]  \frac{f(z)}{z}dx.$$
$$=\frac{1}{2 \pi i} \int_{-L}^{L} [ \frac{f(x-i\epsilon)}{x-i\epsilon} -\frac{f(x+i\epsilon)}{x+i\epsilon} ]dx.$$
Assuming the region of convergence is sufficient for our contour, Taylor series give
$$f(x\pm i\epsilon) = f(0) + f^{'}(0)(x\pm i\epsilon)+ ... .$$
Then our integral reduces to
$$I(L,\epsilon) = \frac{1}{2 \pi i} \int_{-L}^{L} [ \frac{f(0))}{x-i\epsilon} -\frac{f(0)}{x+i\epsilon} ]dx$$
since the first derivative terms will cancel out and the subtraction of other terms in
$$\sum_{n=2}^{\infty} \frac{f^{n}(0)}{n!}[(x-i\epsilon)^{n-1}-(x+i\epsilon)^{n-1}]$$
leave summands of degree one or more in $\epsilon$ and will vanish as epsilon vanishes, so we need consider in the limit only
$$I(L,\epsilon)=f(0)\frac{1}{2 \pi i} \int_{-L}^{L} [ \frac{1}{x-i\epsilon} -\frac{1}{x+i\epsilon} ]dx$$
$$=f(0)\frac{1}{\pi} \int_{-L}^{L}  \frac{\epsilon}{x^2+\epsilon^2} dx$$
$$=f(0)\frac{2}{ \pi} \arctan(L/\epsilon)=f(0)R(L,\epsilon),$$
and as $\epsilon$ tends to zero,
$$ \lim_{\epsilon \rightarrow 0^{+}} \frac{2}{\pi}\arctan(L/\epsilon)=1.$$
Note, of course, if the function is entire and diminishes sufficiently fast at positive and negative infinity, then the contour integrals on the horizontal edges will vanish as $L$ tends to infinity even for finite $\epsilon$ and $R(L,\epsilon)$ will tend to one in this case as well.
We can conclude that the integrand
$$\delta_\epsilon(x) = \frac{1}{\pi} \frac{\epsilon}{x^2+\epsilon^2} $$
is a nascent Dirac delta function, having, in addition to the sifting property in the limit, the requisite properties $\delta_\epsilon(-x)= \delta_\epsilon(x)$ and
$$\lim_{\epsilon \rightarrow 0^{+}} \int_{-L}^{L} f(x) \delta_\epsilon(ax) dx  = \lim_{\epsilon \rightarrow 0} \int_{-L}^{L} f(x) \frac{\delta_\epsilon(x)}{|a|} dx = f(0)/|a|.$$
The integrand
$$\delta_y(x) = \frac{1}{\pi} \frac{y}{x^2+y^2} $$
is called the Poisson kernel associated to the Poisson integral
$$u(x,y) = \int_{-\infty}^{\infty} f(t)\delta_y(x-t)dt,$$
giving the harmonic function $u(x,y)$, i.e., $\nabla^2 u(x,y) = 0$, in the upper half-plane that has the boundary value $f(x)$ on the real axis.
Aside from the origin,
$$\frac{1}{\pi z}= \delta_x(y)-i\delta_y(x),$$
is analytic, so its real and imaginary components, $\delta_x(y)$ and $-\delta_y(x)$, are a harmonic pair. They are proportional to the components of the electric field in any plane intersected orthogonally at the origin by an infinite line of uniform charge density. (Careful, the indices $x,y$ do not represent differentiation here, but rather analytic continuation of the Dirac delta function obtained as $x$ or $y$ tend to zero, within an integral.)
With degrees in electrical engineering, math, and physics from British universities, Dirac was certainly familiar with the Poisson and Dirichlet Laplacian equations and the Poisson and, more generally, Green function integrals in electrostatics as well as Heaviside's contributions to telegraphy and vector analysis.
Note that the electrostatic interpretation with the force on an electron directed away from the wire determines the choice of $\ln(x) = \ln|x|+i \pi H(-x)$ rather than $\ln(x) = \ln(|x|) -i \pi H(-x)$, eliminating the ambiguity of an otherwise arbitrary mathematical choice, and equivalently, the choice of direction (CW or CCW) of the contour of integration and final eval as $f(0)$ rather than $-f(0)$. The purely formal mathematical interpretations don't eliminate this ambiguity.
Some related history:
"The Cauchy-Dirac Delta Function" by Katz and Tall
"7 Green’s Functions and Nonhomogeneous Problems" Chapter 7 of the book Introduction to Partial Differential Equations by Herman. Cf. pages 225 and 262.
"An Essay on the Application of mathematical Analysis to the theories of Electricity and Magnetism" by Green
"Masters of Theory: Cambridge and the Rise of Mathematical Physics" by Andrew Warwick. See p. 508 for a note on Heaviside's influence on Dirac.


Added 1/29/22:
There is also the closely related hyperfunction approach
$$H(x) = \frac{-1}{2\pi i} (\ln(-x-i0) - \ln(-x+i0)).$$
Grothendieck, Feynman, and no doubt earlier researchers used essentially this approach (see the comment on the “iε” cabbala below).


Added 9/22/22: Historical note on the Heaviside-Dirac delta function
In Section 526 of Electromagnetic Theory Vol. 3, The Solution of Definite Integrals by Differential Transformation, Heaviside reviews his introduction of the delta function/operator in his earlier work.
He defines $t_1 = \frac{\partial}{\partial t}$ and $x_1 = \frac{\partial}{\partial x}$. Then with 1$=H(x) =(1+sign(x))/2$ or $=H(t)$ depending on the context, the Heaviside step function, he calls $t_11$ a unit impulse at $t=0$ and $x_11$ a unit impulse at $x=0$, which, in modern notation, become
$t_11=\partial_tH(t) = \delta(t)$ and $x_11=\partial_xH(x) = \delta(x)$.
Then. for $x,t > 0$, his eqn. (8) for the sifting property of the delta function
$$f(t) = \int_0^\infty \; f(x) \; (e^{-x_1t}x_1)dx$$
may be re-expressed, for any real $x$ and $t$ with $H(0)=1/2$, as
$$H(t)f(t) = \int_{-\infty}^\infty \;H(x) f(x) \; (e^{-t\partial_x}\partial_xH(x))dx = \int_{-\infty}^\infty \;H(x) f(x) \; e^{-t\partial_x}\delta(x)dx$$
$$ =  \int_{-\infty}^\infty \;H(x) f(x) \; \delta(x-t))dx. $$
Heaviside and Dirac, following Heaviside, had the temerity to relate their delta fcts/operators to the derivative of a discontinuous function--a touch of wizardry and the inspiration for a rigorous foundation to generalized functions/distribution theory.
A: In integral form, this amounts to the  Sokhotski-Plemelj theorem:
$\lim_{\epsilon\rightarrow 0^{+}}\int_{-\infty}^{\infty}dx f(x) \frac{d}{dx}\log (x+i\epsilon)=-i\pi f(0)+{\cal P}\int_{-\infty}^{\infty}dx f(x)\frac{1}{x}$.
The symbol ${\cal P}$ indicates that the Cauchy principal value of the integral is to be taken. Formalization then amounts to stating the conditions on $f$ so that the principal value integral exists.
The logarithm for $x<0$ is defined as $\log x= \log(-x) + i\pi$. You can avoid the delta function by including the absolute value signs in the logarithm:
$\int_{-\infty}^{\infty}dx f(x) \frac{d}{dx}\log|x|={\cal P}\int_{-\infty}^{\infty}dx f(x)\frac{1}{x}$.
A: Questions about distributions, usually involving the $\delta$ distribution ("function"), are of frequent occurrence on this and related sites.  Since they are often treated in a rather cavalier fashion, I would like to attempt to answer this query in some detail.
The basic problem lies in the interpretation of the functions $\frac 1 x$ and $\log x$
(notabene not $\log |x|  $) as distributions.  As a preliminary remark, it is not surprising that theoretical physicists are guided by their physical intuition and not by mathematical rigour in dealing with such questions and it is perfectly acceptable for mathematicians to proceed in the same way in  formulating such conjectures.  However, since this is a mathematical forum, one does have the right to expect that the final formulation of the solution conforms to the usual standards of mathematical rigour (as is implied in the OP).  In fact it is rather disquieting that this is often not the case, since this task can be achieved by elementary methods which have been on record in the primary and secondary literature for at least 50 years.
For the example in question (and, indeed, for most of the examples in such forums), one need only be cognisant of the following simple facts about distributions.
$1$.  Every continuous function on the reals, better, every locally integrable function, determines in a natural way a distribution.
$2$.  There is a notion of convergence for distributions.  For our purposes, it suffices to know that if a sequence of continuous functions converges uniformly on compacts, then it converges in the sense of distributions. In fact, local $L^1$ convergence suffices.
$3$.  The dream theorem of every freshman calculus student holds---if a sequence of distributions converges, then the sequence obtained by differentiating term by term also converges.
We can now turn to the above query.  Note that the problem lies in the fact that while the function $\log |x|$, being locally integrable,  determines a distribution, the same is not true a priori for $\frac 1  x$ and $\log x $.  In these two cases, we have to proceed in a more delicate manner.
Firstly, note that the function $\log |x|$ is locally integrable and so is a distribution.  More importantly the same is true for its derivative in the distributional sense.  It is then rather natural to define this derivative to be the distribution $\frac 1 x$.
The case of the distribution $\log x$ is rather more subtle. In this case we resort to the complex logarithm.  y
thus we define, for non-zero $\epsilon $, the distribution $\log(x+i\epsilon)$ to be $\log|x|+i \arctan \frac \epsilon x$ (i.e., we are using the principal branch of the complex logarithm).  We now define the distribution $\log x $ to be the limit of this distribution as $\epsilon$ tends to zero.  At this point, we see that we get different values, depending on whether we consider the limit $\epsilon \to 0_+$ or $\epsilon \to 0_-$.  If we now differentiate this equation we obtain the required formula.
To conclude, a few remarks.
The above approach is due to the portuguese mathematician J. Sebastião e Silva who developed it in the context of his axiomatic approach to the theory of distributions.
Sadly, the definitive monograph on his approach that he was preparing 40 years ago was never completed, due to his premature passing.
However, the elementary part has been presented in the book "An introduction to the theory of distributions" by Campos Ferreira which is based on lectures at the University of Lisbon (ca.  1970) and this contains the material described here.
The above is a special case of the family of distributions $x^\lambda$ for general $\lambda$ (even complex)  which is developed in detail in the above reference.  They
are also described in the standard four volume text of 
Gelfand and 
Silov.
The distribution $\frac 1 x$ is also treated by Laurent Schwartz who used the Hadamard principal value
(the latter was his great uncle by marriage).  The connection with the above approach can easily be established by considering the truncated function $\log_\epsilon$ (which is set equal to zero on the interval $]-\epsilon,\epsilon[$), letting $\epsilon$ tend to zero and differentiating.
The ambiguity in the definition of the distribution $\log x$ is no more disconcerting than that in the definition of the logarithm function for complex arguments.  In a more sophisticated approach this distribution would not be defined on the real line but on the 
natural domain of definition of the latter, i.e., on the unversal covering of the punctured plane. 
A: The question is not meaningful since $\ln x$ is not defined for $x\le 0$. You may define, with derivatives in the distribution sense
$$
f(x)=\ln\vert x\vert\text{ (even)},\quad f'(x)=pv\frac1{x} \text{ (odd, homogeneous degree -1)}
$$
$$
g(x)=\ln(x+i0)=\lim_{\epsilon\rightarrow 0_+}\ln(x+i\epsilon),\quad g'(x)=\frac{1}{x+i0}=
pv\frac1{x}-i\pi \delta, \text{(homogeneous degree -1)}
$$
where the latter formula follows from
$$
\ln(z)=\oint_{[1,z]}\frac{d\xi}{\xi},\quad z\in \mathbb C\backslash \mathbb R_-.
$$
By analytic continuation we have (for $z\in \mathbb C\backslash \mathbb R_-$) $e^{\ln z}=z$ and with $H=\mathbf 1_{\mathbb R_+}$
$$
\ln(x+i0)=\ln\vert x\vert +i\pi H(-x)\Longrightarrow g'(x)=\frac{1}{x+i0}=
pv\frac1{x}-i\pi \delta.
$$
Taking the complex conjugate of $g$ gives you the definition of $\frac{1}{x-i0}$.
