<s>[INST] Stuck and confused with $\int \frac{u^{1/2}}{(u+1)^2} du$ I'm trying to find the expectation value $\langle x^2 \rangle_{\psi}$ for
$$\psi(x,0) = \sqrt{\frac{2}{\pi}}a \cdot \frac{1}{x^2+a^2}$$
and I know the result is $a^2$. I'm terribly stuck integrating this. Currently:
$$\langle x^2 \rangle_{\psi} = \int\limits_{-\infty}^{\infty}\, \psi^* x^2 \psi \, dx$$
$$= \left(\frac{2a^2}{\pi}\right) \int_{-\infty}^{\infty}\frac{x^2}{(x^2+a^2)^2} dx = \left(\frac{2a^2}{\pi}\right) \int_{-\infty}^{\infty} \frac{1}{a^2} \frac{(x/a)^2}{((x/a)^2+1)^2}dx = \left(\frac{4a}{\pi}\right) \int^\infty_0 \frac{u^2 }{(u^2+1)^2} du$$
where the change of variable $u=x/a$ is used.
With $v=u^2$, $u=\sqrt{v}$ and $du=\tfrac{dv}{2\sqrt{v}}$ and then,
$$\langle x^2 \rangle_{\psi} = \left(\frac{2a}{\pi}\right) \int^\infty_0 \frac{v^{1/2}}{(v+1)^2}dv = \frac{2a}{\pi} \int^\infty_0 \frac{v}{(v+1)^2}v^{1/2} \frac{dv}{v}$$
Then I checked the latter integral in Wolfram Mathematica but the results doesn't seem to match (not $\pi a$) and this is confusing me a lot. Any suggestions with this?
Also: is it possible to solve it analytically?
 [/INST] The term $\langle x^2\rangle_\psi$ as defined by the OP can be obtained through standard method of integration of rational functions.
Here is one method:
$$
\int \frac{x^2}{(x^2+a^2)^2}\,dx =\int \frac{dx}{x^2+a^2} -a^2\int\frac{dx}{(x^2+a^2)^2}
$$
Setting $I_n=\int\frac{dx}{(x^2+a^2)^n}$, we get by integration by parts the recurrence formula
$$ I_{n+1}=\frac{1}{2na^2}\frac{x}{(x^2+a^2 )^n}+\frac{2n-1}{2na^2}I_n$$
For $n=1$ we obtain
$$ I_2=\frac{1}{2a^2}\frac{x}{x^2+a^2} +\frac{1}{2a^3}\arctan(x/a) + C $$
Putting things together, we het
$$
\frac{2a^2}{\pi}\int^\infty_{-\infty}\frac{x^2\,dx}{(x^2+a^2)^2}=\frac{2a^2}{\pi}\Big(\frac{1}{2a}\arctan(x/a)-\frac{1}{2}\frac{x}{x^2+a^2}\Big)\Big|^\infty_{-\infty}=a
$$

The OP, through a couple of change of variables, reduced the quantity of interest to calculating the integral $$\int^\infty_0 \frac{u^{1/2}}{(u+1)^2}\,du=\int^\infty_0 \frac{u}{(u+1)^2}u^{1/2}\,\frac{du}{u}$$
This integral can be obtained by calculus of residues. In this instance, the Mellin transform comes to mind (See Marsden's basic complex analysis, or Lang's complex analysis).

The Mellin transform of a function $f$ is defines as $M_f(s)=\int^\infty_0 f(x) x^s\,\frac{dx}{x}$, $s>0$. Under  the following conditions

*

*$f$ is analytic on the complex plane, except for a finite number of poles none of which lies on the positive real axis.

*There are $0<c<s<b$ such that $f(z)=O(z^{-b})$ as $z\rightarrow\infty$, and $f(z)=O(z^{-c})$ as $z\rightarrow0$
we have that
$$\int^\infty_0 f(x) x^{s-1}\,dx = -\frac{\pi e^{-\pi i s}}{\sin \pi s}\sum^N_{j=1} \operatorname{Res}_{z_j}(f(z) z^{s-1})$$
where $z_1,\ldots, z_N$ are the poles of $f$ in $\mathbb{C}\setminus\{0\}$, and $z^{(s-1)}=e^{(s-1)\log z}$ with $\log$ is the logarithmic function with branch $0<\operatorname{arg}(z <2\pi$.


For the integral in the OP, it is easy to check that $f(z)=\frac{z}{(z+1)^2}$ satisfies condition (1) and (2) with $s=1/2$.
$g(z)=f(z) z^{1/2 -1}$ has a pole at $z=-1$, and
$$\operatorname{Res}_{-1}(g)=1\cdot e^{-\tfrac12\pi i} -(\tfrac12-1)e^{-\tfrac32 \pi i}=-\tfrac{i}{2}$$
Hence
$$
\int^\infty_0 \frac{u^{1/2}}{(u+1)^2}\,du =-\frac{\pi e^{-\tfrac12\pi i}}{\sin\tfrac12 \pi}(-\tfrac{i}{2})=\frac{\pi}{2}
$$
Thus the quantity $\langle x^2\rangle_{\psi}$, as defined by the OP, is
$\frac{2a}{\pi}\frac{\pi}{2}=a$.

Edit:
It seems that the OP is missing a factor $a$ in the normalization factor.
$$
\begin{align}
1=\int^\infty_{-\infty}\psi^*\psi&=c\int^\infty_{-\infty}\frac{dx}{(x^2+a^2)^2}\\
&=c\Big( \frac{1}{2a^2}\frac{x}{(x^2+a^2)^2}+\frac{1}{2a^3}\arctan(x/a)\Big)\Big|^\infty_{-\infty}\\
&=\frac{\pi}{2a^3}c
\end{align}
$$
implies that $c=\frac{2a^3}{\pi}$. The OP has $\frac{2a^2}{\pi}$
</s>