Example of function such that integral of $|x(t)|$ is $<+\infty$, and integral of $|x(t)|^2$ is $\infty$ I'm trying to look for an example of a function such that:
$$
1.
\displaystyle{\int \limits_{- \infty }^{+ \infty }} \lvert x(t) \rvert \, dt < + \infty $$
$$
2.
\displaystyle{\int \limits_{- \infty }^{+ \infty }} \lvert x(t) \rvert^2 \, dt = + \infty
$$
Thank you for your willingness.
 A: $x(t)=\frac 1 {\sqrt t}$ for $0<t<1$ and $0$ for all other values of $t$.
A: You have asked two questions now looking for examples of functions with certain properties with respect to integrability or square integrability.  Let me provide a slightly more general way of thinking about these problems.

Definition: Let $f : \mathbb{R} \to \mathbb{R}$.  The $L^p$-norm of $f$ is defined by
  $$ \|f\|_p := \left( \int_{-\infty}^{+\infty} |f(x)|\,\mathrm{d}x \right)^{1/p}. $$

In this question, you are looking for an example of a function $f$ such that
$$ \|f\|_1 < +\infty \qquad\text{and}\qquad \|f\|_2 = +\infty, \tag{1}$$
while this other question you asked is looking for examples of a function $f$ such that
$$ \|f\|_1 = +\infty \qquad\text{and}\qquad \|f\|_2 < +\infty. \tag{2}$$
These two questions are very closely linked.

Generally speaking, there are two features of functions which will tend to make them hard to integrate.  These are "spikes" and "tails".
Spikes
By a "spike," I mean that the function blows up somewhere in its domain.  For example, the function $x \mapsto 1/x$ blows up around 0.  Suppose that the function $f$ has a "spike} at $x=a$.  That is, suppose that
$$ \lim_{x\to a} |f(x)| = +\infty. $$
Then on some neighborhood of $a$, we will have $|f(x)|>1$, which implies that the function will be dominated by its square.  More rigorously, there exists some $r > 0$ such that
$$ 1 < |f(x)| < |f(x)|^2 \qquad\text{for all $x \in (a-r, a+r)$}. $$
But then
$$ \int_{a-r}^{a+r} |f(x)|\,\mathrm{d}x < \int_{a-r}^{a+r} |f(x)|^2\,\mathrm{d}x. $$
The intuition of this is that "spikes" become less integrable as you increase $p$.  That is, if $f$ is "spikey," then (roughly speaking)
$$ \|f\|_p < \|f\|_q $$
whenever $p < q$.  So in order to find a function which satisfies (1), we should be looking for a "spikey" function (which is also not too heavy tailed, as described below).
Tails
If a function $f$ is defined on $\mathbb{R}$ and we are to have any hope that
$$ \|f\|_p < \infty $$
for some value of $p$, then it must be the case that $\lim_{x\to\pm\infty} f(x) = 0$.  Otherwise, the integral will diverge.  This is a description of the asymptotic behaviour, or the "tails", of the function.  Since the function goes to zero at infinity, there must be some number $M$ so large that $|x| > M$ implies that $|f(x)| < 1$.  But then
$$ 1 > |f(x)| > |f(x)|^2 \qquad \text{for all $|x|>M$.} $$
But then (working only on the right half-line)
$$ \int_{M}^{+\infty} |f(x)|\,\mathrm{d}x > \int_{M}^{+\infty} |f(x)|^2\,\mathrm{d}x. $$
Here, the intuition is that "tails" become more integrable as $p$ is increased.  That is, if $f$ is "heavy tailed", then (again, roughly speaking)
$$ \|f\|_p > \|f\|_q $$
whenever $p < q$.  So in order to find a function which satisfies (2), we should be looking for a "heavy tailed" function (which is also not too spikey).

My usual goto example of a function which is both spikey and heavy tailed is the function
$$ f(x) = \frac{1}{x}. $$
This function has a spike at zero.  Indeed, we have
$$ \int_{-1}^{1} \left| \frac{1}{x} \right| \,\mathrm{d}x
\ge \int_{0}^{1}  \frac{1}{x}  \,\mathrm{d}x
= \lim_{\varepsilon \to 0^+} \int_{\varepsilon}^{1} \frac{1}{x} \,\mathrm{d}x
= \lim_{\varepsilon\to 0^+} \left[ \log(1) - \log(\varepsilon) \right]
= +\infty. $$
This function is also heavy tailed, since
$$ \int_{1}^{+\infty} \frac{1}{x} \,\mathrm{d}x
= \lim_{M\to+\infty} \int_{1}^{M} \frac{1}{x}\,\mathrm{d}x
= \lim_{M\to+\infty} \left[ \log(M) - \log(1) \right]
= +\infty. $$
On the other hand, this function isn't "too spikey."  In particular, define the function $g$ so that
$$ g(x)^2 = \frac{1}{x} \chi_{(0,1]}(x) = \begin{cases} \frac{1}{x} & \text{if $x \in (0,1]$, and} \\ 0 & \text{otherwise.} \end{cases} $$
In other words, we are defining $g$ so that it is $x \mapsto 1/x$ is "spikier" than $g$.  Since increasing the power of a spikey function makes it less integrable, decreasing the power should make it more integrable.  Cleaning up the notation above, we have
$$ g(x) = \frac{1}{\sqrt{x}} \chi_{(0,1]}(x) = \begin{cases} \frac{1}{\sqrt{x}} & \text{if $x \in (0,1]$, and} \\ 0 & \text{otherwise.} \end{cases} $$
We have already shown that
$$ \|g\|_2 = \int_{0}^{1} \left|\frac{1}{x} \right| \,\mathrm{d}x = +\infty. $$
On the other hand
$$ \|g\|_1
= \int_{0}^{1} \frac{1}{\sqrt{x}}\,\mathrm{d}x
= \lim_{\varepsilon\to 0^+} \int_{\varepsilon} x^{-1/2}\,\mathrm{d}x
= \lim_{\varepsilon\to 0^+} \left[ \frac{1}{2} 1^{1/2} - \frac{1}{2} \varepsilon^{1/2} \right]
= \frac{1}{2} < +\infty. $$
Therefore $g$ is an example of of a function which satisfies (1).
On the other hand, $x \mapsto 1/x$ has a heavy tail, so we can flatten that out by taking higher powers.  So define $h$ by
$$
h(x) = \frac{1}{x} \chi_{[1,\infty)}(x) = \begin{cases} \frac{1}{x} & \text{if $x \ge 1$, and} \\ 0 & \text{otherwise.} \end{cases} $$
It was already shown above that
$$ \|h\|_1 = +\infty. $$
On the other hand,
$$ \|h\|_2
= \int_{1}^{+\infty} \left| \frac{1}{x} \right|^2 \,\mathrm{d}x
= \lim_{M\to+\infty} \int_{1}^{M} x^{-2} \,\mathrm{d}x
= \lim_{M\to+\infty} \left[ -M^{-1} + 1^{-1} \right]
= 1 < +\infty. $$
Therefore $h$ is an example of a function which satisfies (2).

Summary
The function $g : \mathbb{R} \to \mathbb{R}$, defined by the formula
$$ g(x) = \frac{1}{\sqrt{x}} \chi_{(0,1]}(x) = \begin{cases} \frac{1}{\sqrt{x}} & \text{if $x \in (0,1]$, and} \\ 0 & \text{otherwise,} \end{cases} $$
satisfies (1).
The function $h : \mathbb{R} \to \mathbb{R}$, defined by the formula
$$ h(x) = \frac{1}{x} \chi_{[1,\infty)}(x) = \begin{cases} \frac{1}{x} & \text{if $x \ge 1$, and} \\ 0 & \text{otherwise,} \end{cases} $$
satisfies (2).
