Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Fokker-Planck Equation with Small Variation Steps

Open In Colab

I have always wanted to approach the problem of wealth distribution from the perspective of Markov processes and related methods, and this is what I will do through the article “Fokker-Planck Description of Wealth Dynamics and the Origin of Pareto’s Law”.

Let us recall that, for a single variable, we obtained the equation

P(x,t)t=2x2[DP(x,t)]+x[DβU(x)xP(x,t)].\frac{\partial P(x,t)}{\partial t} = \frac{\partial^{2}}{\partial x^{2}} \left[ D P(x,t) \right] + \frac{\partial}{\partial x} \left[ D\beta \frac{\partial U(x)}{\partial x} P(x,t) \right].

In this case, we assumed a constant diffusion coefficient,

A=D,A=D,

and a drift term determined by a conservative potential,

B=DβU(x)x.B = D\beta \frac{\partial U(x)}{\partial x}.

More generally, the equation can be written as

Pt=2x2[A(x)P]+x[B(x)P].\frac{\partial P}{\partial t} = \frac{\partial^{2}}{\partial x^{2}} \left[ A(x)P \right] + \frac{\partial}{\partial x} \left[ B(x)P \right].

Thus, in one dimension, the temporal evolution of the probability density is determined by the spatial derivatives of two fluxes: a diffusive flux, associated with random fluctuations, and a drift flux, associated with the deterministic tendency imposed by external forces.

When xx varies through small stochastic steps Δx\Delta x, we define the diffusion coefficient as

A=12Δx2,A = \frac{1}{2} \left\langle \Delta x^{2} \right\rangle,

and the drift coefficient as

B=Δx.B = \left\langle \Delta x \right\rangle.

In the literature, one typically finds the notation

P˙(r,t)=122DP(CP).\dot{P}(\mathbf{r},t) = \frac{1}{2} \nabla^{2} \boldsymbol{D}P - \nabla\cdot \left( \boldsymbol{C}P \right).

Furthermore, we can write

P˙(r,t)=A(r,t)+B(r,t),\dot{P}(\mathbf{r},t) = \nabla\cdot \boldsymbol{A}(\mathbf{r},t) + \nabla\cdot \boldsymbol{B}(\mathbf{r},t),

that is, the temporal evolution of the probability is given by the divergence of the sum of two fluxes: a diffusive flux and a flux generated by external forces.

Before proceeding, however, we will first seek to understand how this equation is derived.

Fokker-Planck Equation with Small Variation Steps

This derivation is based on the work of Professor Heff Moehlis, “Derivation of the Fokker-Planck Equation”.

Let us denote by

{X(t):t0}\left\{ X(t):t\geq0 \right\}

a one-dimensional stochastic process with

t1>t2>t3,t_{1}>t_{2}>t_{3},

that is, the ordering is opposite to the usual notation. If t2t_{2} represents the present, then t1t_{1} corresponds to the future and t3t_{3} to the past.

  • P(X1,t1;X2,t2)P(X_{1},t_{1};X_{2},t_{2}) is the probability that X(t1)=X1X(t_{1})=X_{1} and X(t2)=X2X(t_{2})=X_{2}, that is, the joint probability distribution.

  • P(X1,t1X2,t2)P(X_{1},t_{1}|X_{2},t_{2}) is the probability that X(t1)=X1X(t_{1})=X_{1} given that X(t2)=X2X(t_{2})=X_{2}, that is, the transition probability.

Therefore,

P(X1,t1;X2,t2)=P(X1,t1X2,t2)P(X2,t2).P(X_{1},t_{1};X_{2},t_{2}) = P(X_{1},t_{1}|X_{2},t_{2}) P(X_{2},t_{2}).

The joint probability that the system is in state X2X_{2} at time t2t_{2} and in state X1X_{1} at the later time t1t_{1} is equal to the product of the probability that the system is in X2X_{2} at time t2t_{2} and the conditional probability that, given the system is in X2X_{2} at t2t_{2}, it evolves to state X1X_{1} at time t1t_{1}.

This is the standard relation for joint probabilities,

P(AB)=P(AB)P(B).P(A\cap B)=P(A|B)P(B).

Let us assume that X(t)X(t) is a Markov process:

P(X1,t1X2,t2;X3,t3)=P(X1,t1X2,t2).P(X_{1},t_{1}|X_{2},t_{2};X_{3},t_{3}) = P(X_{1},t_{1}|X_{2},t_{2}).

That is, the probability that the system transitions to state X1X_{1} depends only on its immediately preceding state X2X_{2}. Information about earlier states does not provide any additional information.

For a Markov process, the Chapman-Kolmogorov equation is satisfied:

P(X1,t1X3,t3)=P(X1,t1X2,t2)P(X2,t2X3,t3)dX2.P(X_{1},t_{1}|X_{3},t_{3}) = \int P(X_{1},t_{1}|X_{2},t_{2}) P(X_{2},t_{2}|X_{3},t_{3}) dX_{2}.

The Chapman-Kolmogorov equation establishes that the probability of the system evolving from state X3X_{3} at time t3t_{3} to state X1X_{1} at time t1t_{1} can be obtained by considering all possible intermediate states X2X_{2} at time t2t_{2}. For each intermediate state, we multiply the probability of the system evolving from X3X_{3} to X2X_{2} by the probability of evolving from X2X_{2} to X1X_{1}, and then integrate over all possible values of X2X_{2}, that is, over all possible intermediate states.

Let us assume that the transition probabilities do not depend on the absolute time, but only on the elapsed time interval. Therefore, for simplicity of notation,

P(X1,t1t2X2)P(X1,t1X2,t2).P(X_{1},t_{1}-t_{2}|X_{2}) \equiv P(X_{1},t_{1}|X_{2},t_{2}).

We can then write

P(Y,tX)P(Y,tX,0),P(Y,t|X) \equiv P(Y,t|X,0),

that is, we have

X(0)=Y,X(t)=X.X(0)=Y, \qquad X(t)=X.

Let us begin by considering

h(Y)P(Y,tX)tdY=I.\int h(Y) \frac{\partial P(Y,t|X)}{\partial t} dY = I.

The function h(Y)h(Y) has a finite interval of support,

Y[a,b],Y\in[a,b],

such that outside this interval,

h(Y)=0.h(Y)=0.

This is apparently what is meant by the term ``compact support’’ in the article.

Writing

P(Y,tX)t=limΔt0P(Y,t+ΔtX)P(Y,tX)Δt,\frac{\partial P(Y,t|X)}{\partial t} = \lim_{\Delta t\rightarrow0} \frac{ P(Y,t+\Delta t|X) - P(Y,t|X) } {\Delta t},

and substituting into the integral, while using the Chapman-Kolmogorov equation, we obtain

I=limΔt0h(Y)P(Y,t+ΔtX)P(Y,tX)ΔtdY=limΔt01Δt[h(Y)P(Y,t+ΔtX)dYh(Y)P(Y,tX)dY]=limΔt01Δt[h(Y)(P(Y,ΔtZ)P(Z,tX)dZ)dYh(Y)P(Y,tX)dY].\begin{align} I &= \lim_{\Delta t\rightarrow0} \int h(Y) \frac{ P(Y,t+\Delta t|X) - P(Y,t|X) } {\Delta t} dY\\ &= \lim_{\Delta t\rightarrow0} \frac{1}{\Delta t} \left[ \int h(Y) P(Y,t+\Delta t|X) dY - \int h(Y) P(Y,t|X) dY \right]\\ &= \lim_{\Delta t\rightarrow0} \frac{1}{\Delta t} \left[ \int h(Y) \left( \int P(Y,\Delta t|Z) P(Z,t|X) dZ \right) dY - \int h(Y) P(Y,t|X) dY \right]. \end{align}

That is, initially we had only a direct transition from XX to YY, separated by a time interval t+Δtt+\Delta t. By applying the Chapman--Kolmogorov equation, we introduce an intermediate state ZZ at time tt, decomposing the trajectory into two successive transitions. The first describes the evolution from XX to ZZ, whose time interval is t0=tt-0=t, whereas the second describes the evolution from ZZ to YY, whose interval is (t+Δt)t=Δt(t+\Delta t)-t=\Delta t. Since the process is homogeneous in time, the transition probability depends only on the duration of the interval and not on the absolute time at which it occurs. Therefore,

P(Y,t+ΔtZ,t)=P(Y,ΔtZ).P(Y,t+\Delta t|Z,t) = P(Y,\Delta t|Z).

Notice that only the second transition is rewritten in this way; the total interval between XX and YY remains t+Δtt+\Delta t.

Since the integral runs over all possible states, the integration variable does not represent a specific state, but only an index that enumerates all possible states. Therefore, we can replace YY by ZZ (or any other symbol), provided that the replacement is made consistently throughout the entire integral. Thus, we can rewrite the integral over dYdY as an integral over dZdZ in the second term:

I=limΔt01Δt[h(Y)(P(Y,ΔtZ)P(Z,tX)dZ)dYh(Z)P(Z,tX)dZ]=limΔt01Δt[P(Z,tX)(h(Y)P(Y,ΔtZ)dYh(Z))dZ].\begin{align} I &= \lim_{\Delta t\rightarrow0} \frac{1}{\Delta t} \left[ \int h(Y) \left( \int P(Y,\Delta t|Z) P(Z,t|X) dZ \right) dY - \int h(Z) P(Z,t|X) dZ \right] \\ &= \lim_{\Delta t\rightarrow0} \frac{1}{\Delta t} \left[ \int P(Z,t|X) \left( \int h(Y)P(Y,\Delta t|Z)dY - h(Z) \right) dZ \right]. \end{align}

Now, since

+P(Y,ΔtZ)dY=1,\int_{-\infty}^{+\infty} P(Y,\Delta t|Z)dY=1,

because there is a 100%100\% probability that the system evolves from state ZZ to some state (we are integrating over all possible states), and since h(Z)h(Z) does not depend on YY, we have

h(Z)f(Y)dY=h(Z)f(Y)dY.h(Z)\int f(Y)dY = \int h(Z)f(Y)dY.

Therefore,

I=limΔt01Δt[P(Z,tX)(h(Y)P(Y,ΔtZ)dYh(Z)P(Y,ΔtZ)dY)dZ]=limΔt01Δt[P(Z,tX)P(Y,ΔtZ)(h(Y)h(Z))dYdZ].\begin{align} I &= \lim_{\Delta t\rightarrow0} \frac{1}{\Delta t} \left[ \int P(Z,t|X) \left( \int h(Y)P(Y,\Delta t|Z)dY - \int h(Z)P(Y,\Delta t|Z)dY \right) dZ \right] \\ &= \lim_{\Delta t\rightarrow0} \frac{1}{\Delta t} \left[ \int P(Z,t|X) \int P(Y,\Delta t|Z) \left( h(Y)-h(Z) \right) dYdZ \right]. \end{align}

We now perform a Taylor expansion of h(Y)h(Y) around ZZ:

h(Y)=n=0h(n)(Z)n!(YZ)n=h(Z)+n=1h(n)(Z)n!(YZ)nh(Y) = \sum^{\infty}_{n=0} \frac{h^{(n)}(Z)}{n!} (Y-Z)^{n} = h(Z) + \sum^{\infty}_{n=1} \frac{h^{(n)}(Z)}{n!} (Y-Z)^{n}

Therefore,

I=limΔt01Δt[P(Z,tX)P(Y,ΔtZ)(h(Z)+n=1h(n)(Z)n!(YZ)nh(Z))dYdZ]=P(Z,tX)n=0[1n!limΔt01ΔtP(Y,ΔtZ)(YZ)ndY]h(n)(Z)dZ.\begin{align} I &= \lim_{\Delta t\rightarrow0} \frac{1}{\Delta t} \left[ \int P(Z,t|X) \int P(Y,\Delta t|Z) \left( h(Z) + \sum^{\infty}_{n=1} \frac{h^{(n)}(Z)}{n!} (Y-Z)^{n} - h(Z) \right) dYdZ \right] \\ &= \int P(Z,t|X) \sum^{\infty}_{n=0} \left[ \frac{1}{n!} \lim_{\Delta t\rightarrow0} \frac{1}{\Delta t} \int P(Y,\Delta t|Z) (Y-Z)^{n} dY \right] h^{(n)}(Z) dZ . \end{align}

Defining the jump moments as

D(n)(Z)=1n!limΔt01Δt(YZ)nP(Y,ΔtZ)dY,D^{(n)}(Z) = \frac{1}{n!} \lim_{\Delta t\rightarrow0} \frac{1}{\Delta t} \int (Y-Z)^{n} P(Y,\Delta t|Z) dY ,

we can understand the idea of a jump by recalling that

X(t+Δt)X(t)=YZ.X(t+\Delta t)-X(t)=Y-Z .

Therefore, we obtain

h(Y)P(Y,tX)tdY=n=1P(Z,tX)D(n)h(n)(Z)dZ.\int h(Y) \frac{\partial P(Y,t|X)}{\partial t} dY = \sum^{\infty}_{n=1} \int P(Z,t|X) D^{(n)} h^{(n)}(Z) dZ .

Each term of the sum is then

P(Z,tX)D(n)h(n)(Z)dZ=Fn(Z)h(n)(Z)dZ,\int P(Z,t|X) D^{(n)} h^{(n)}(Z) dZ = \int F_{n}(Z) h^{(n)}(Z) dZ ,

where

Fn(Z)=P(Z,tX)D(n).F_{n}(Z) = P(Z,t|X)D^{(n)} .

For n=1n=1, applying integration by parts, we choose

u=F1(Z)=P(Z,tX)D(1)(du=F1(1)dZ)u=F_{1}(Z) = P(Z,t|X)D^{(1)} \qquad \left( du=F_{1}^{(1)}dZ \right)

and

dv=h(1)(Z)dZ(v=h(Z)).dv=h^{(1)}(Z)dZ \qquad (v=h(Z)).
udv=uvvdu,\int u\,dv=uv-\int v\,du ,

we have

+F1(Z)h(1)(Z)dZ=[h(Z)F1(Z)]++h(Z)F1(1)dZ.\int^{+\infty}_{-\infty} F_{1}(Z)h^{(1)}(Z)dZ = \left[ h(Z)F_{1}(Z) \right]^{+\infty}_{-\infty} - \int^{+\infty}_{-\infty} h(Z)F^{(1)}_{1}dZ .

Since the test function h(Z)h(Z) has compact support, the boundary term vanishes, because it is zero outside the region of interest. Therefore, we are left with

+F1(Z)h(1)(Z)dZ=+h(Z)F1(1)dZ.\int^{+\infty}_{-\infty} F_{1}(Z)h^{(1)}(Z)dZ = - \int^{+\infty}_{-\infty} h(Z)F^{(1)}_{1}dZ .

For n=2n=2, applying integration by parts once more, we choose

u=F2(Z)=P(Z,tX)D(2)(du=F2(1)dZ)u=F_{2}(Z) = P(Z,t|X)D^{(2)} \qquad \left( du=F^{(1)}_{2}dZ \right)

and

dv=h(2)(Z)dZ(v=h(1)(Z)).dv=h^{(2)}(Z)dZ \qquad \left( v=h^{(1)}(Z) \right).

Therefore,

+F2(Z)h(2)(Z)dZ=+h(1)(Z)F2(1)dZ.\int^{+\infty}_{-\infty} F_{2}(Z)h^{(2)}(Z)dZ = - \int^{+\infty}_{-\infty} h^{(1)}(Z)F^{(1)}_{2}dZ .

Again, due to the fact that h(Z)h(Z) has compact support, we have that h(1)(Z)=0h^{(1)}(Z)=0 outside its support, that is, at the boundaries of the integration domain. Performing another integration by parts, with

u=F2(1)=P(Z,tX)D(2)(du=F2(2)dZ)u=F^{(1)}_{2} = P(Z,t|X)D^{(2)} \qquad \left( du=F^{(2)}_{2}dZ \right)

and

dv=h(1)(Z)dZ(v=h(Z)),dv=h^{(1)}(Z)dZ \qquad \left( v=h(Z) \right),

we obtain

+F2(Z)h(2)(Z)dZ=+h(Z)F2(2)dZ.\int^{+\infty}_{-\infty} F_{2}(Z)h^{(2)}(Z)dZ = \int^{+\infty}_{-\infty} h(Z)F^{(2)}_{2}dZ .

Therefore, in general,

Fn(Z)h(n)(Z)dZ=(1)nh(Z)Fn(n)dZ\int F_{n}(Z)h^{(n)}(Z)dZ = (-1)^{n} \int h(Z)F^{(n)}_{n}dZ

or equivalently,

Fn(Z)h(n)(Z)dZ=h(Z)(Z)nP(Z,tX)D(n)dZ.\int F_{n}(Z)h^{(n)}(Z)dZ = \int h(Z) \left( -\frac{\partial}{\partial Z} \right)^{n} P(Z,t|X)D^{(n)} dZ .

Therefore,

h(Y)P(Y,tX)tdY=n=1P(Z,tX)D(n)h(n)(Z)dZ=h(Z)n=1(Z)nD(n)P(Z,tX)dZ.\int h(Y) \frac{\partial P(Y,t|X)}{\partial t} dY = \sum^{\infty}_{n=1} \int P(Z,t|X) D^{(n)} h^{(n)}(Z) dZ = \int h(Z) \sum^{\infty}_{n=1} \left( -\frac{\partial}{\partial Z} \right)^{n} D^{(n)} P(Z,t|X) dZ .

Moving the left-hand side to the right and again using YZY\rightarrow Z on the left:

h(Z)P(Z,tX)tdZh(Z)n=1(Z)nD(n)P(Z,tX)dZ=0\int h(Z) \frac{\partial P(Z,t|X)}{\partial t} dZ - \int h(Z) \sum^{\infty}_{n=1} \left( -\frac{\partial}{\partial Z} \right)^{n} D^{(n)} P(Z,t|X) dZ = 0

or

h(Z)(P(Z,tX)tn=1(Z)nD(n)P(Z,tX))dZ=0.\int h(Z) \left( \frac{\partial P(Z,t|X)}{\partial t} - \sum^{\infty}_{n=1} \left( -\frac{\partial}{\partial Z} \right)^{n} D^{(n)} P(Z,t|X) \right) dZ = 0 .

Since h(Z)h(Z) is an arbitrary function, in order for this integral to vanish, we must have

P(Z,tX)tn=1(Z)nD(n)P(Z,tX)=0.\frac{\partial P(Z,t|X)}{\partial t} - \sum^{\infty}_{n=1} \left( -\frac{\partial}{\partial Z} \right)^{n} D^{(n)} P(Z,t|X) = 0 .

Writing

P(X,t)P(X,tX0,0),P(X,t) \equiv P(X,t|X_{0},0),

that is, this is the probability density of finding the system in state XX at time tt, given that it was in state X0X_{0} at time 0. Therefore,

P(X,t)tn=1(X)nD(n)P(X,t)=0.\frac{\partial P(X,t)}{\partial t} - \sum^{\infty}_{n=1} \left( -\frac{\partial}{\partial X} \right)^{n} D^{(n)} P(X,t) = 0 .

Considering a delta distribution as the initial condition at X0X_{0}, the probability of obtaining XX at the initial time is

P(X,0)=δ(XX0),P(X,0)=\delta(X-X_{0}),

which means that, at the initial instant, the random variable XX assumes the value X0X_{0} with unit probability. The entire probability distribution is concentrated at X0X_{0}, being represented by the Dirac delta distribution.

Therefore, for D(n)D^{(n)}:

D(n)(Z)=1n!limΔt01Δt(YZ)nP(Y,ΔtZ)dYD^{(n)}(Z) = \frac{1}{n!} \lim_{\Delta t\rightarrow0} \frac{1}{\Delta t} \int (Y-Z)^{n} P(Y,\Delta t|Z) dY

For Z=X0Z=X_{0}, we have

D(n)(X0)=1n!limΔt01Δt(XX0)nP(X,ΔtX0)dX=1n!limΔt01Δt(ΔX)nP(X,ΔtX0)dX.\begin{align} D^{(n)}(X_{0}) &= \frac{1}{n!} \lim_{\Delta t\rightarrow0} \frac{1}{\Delta t} \int (X-X_{0})^{n} P(X,\Delta t|X_{0}) dX \\ &= \frac{1}{n!} \lim_{\Delta t\rightarrow0} \frac{1}{\Delta t} \int (\Delta X)^{n} P(X,\Delta t|X_{0}) dX . \end{align}

Using the definition of expectation values,

D(n)(X0)=1n!limΔt0(ΔX)nΔt.D^{(n)}(X_{0}) = \frac{1}{n!} \lim_{\Delta t\rightarrow0} \frac{ \left\langle (\Delta X)^{n} \right\rangle } {\Delta t}.

Here, (ΔX)n\left\langle(\Delta X)^{n}\right\rangle represents the expected value of (ΔX)n(\Delta X)^{n}, with

ΔX=X(Δt)X0(0),\Delta X=X(\Delta t)-X_{0}(0),

calculated with respect to the transition probability distribution, that is, considering all possible transitions from the state X0X_{0} at time 0 to the states XX at time Δt\Delta t.

Considering that

D(n)(X)=0forn>2,D^{(n)}(X)=0 \qquad \text{for} \qquad n>2,

we obtain

P(X,t)t+X[D(1)P(X,t)](X)2D(2)P(X,t)=0.\frac{\partial P(X,t)}{\partial t} + \frac{\partial}{\partial X} \left[ D^{(1)}P(X,t) \right] - \left( \frac{\partial}{\partial X} \right)^{2} D^{(2)}P(X,t) = 0 .

For n=1n=1 and n=2n=2:

D(1)(X0)=limΔt0ΔXΔt,D(2)(X0)=12limΔt0(ΔX)2Δt.D^{(1)}(X_{0}) = \lim_{\Delta t\rightarrow0} \frac{ \left\langle \Delta X \right\rangle } {\Delta t}, \qquad D^{(2)}(X_{0}) = \frac{1}{2} \lim_{\Delta t\rightarrow0} \frac{ \left\langle (\Delta X)^{2} \right\rangle } {\Delta t}.

Therefore,

P(X,t)t=X[limΔt0ΔXΔtP(X,t)]+2X2[12limΔt0(ΔX)2ΔtP(X,t)]=X[V(X)P(X,t)]+2X2[D(X)P(X,t)].\begin{align} \frac{\partial P(X,t)}{\partial t} &= -\frac{\partial}{\partial X} \left[ \lim_{\Delta t\rightarrow0} \frac{ \left\langle \Delta X \right\rangle } {\Delta t} P(X,t) \right] + \frac{\partial^{2}}{\partial X^{2}} \left[ \frac{1}{2} \lim_{\Delta t\rightarrow0} \frac{ \left\langle (\Delta X)^{2} \right\rangle } {\Delta t} P(X,t) \right] \\ &= -\frac{\partial}{\partial X} \left[ V(X)P(X,t) \right] + \frac{\partial^{2}}{\partial X^{2}} \left[ D(X)P(X,t) \right]. \end{align}

The first term,

V(X)D(1)(X),V(X)\equiv D^{(1)}(X),

is the drift coefficient. It is given by

D(1)(X0)=limΔt0ΔXΔt=limΔt0X(t+Δt)X(t)Δtt=0=Xtt=0.D^{(1)}(X_{0}) = \lim_{\Delta t\rightarrow0} \frac{ \left\langle \Delta X \right\rangle } {\Delta t} = \left. \lim_{\Delta t\rightarrow0} \frac{ \left\langle X(t+\Delta t) \right\rangle - \left\langle X(t) \right\rangle } {\Delta t} \right|_{t=0} = \left. \frac{\partial\left\langle X\right\rangle}{\partial t} \right|_{t=0}.

The coefficient

D(X)D(2)(X)D(X)\equiv D^{(2)}(X)

is the diffusion coefficient.

Recalling that

ΔXt=0=(X(t+Δt)X(t))t=0=X(Δt)X(0)=X(Δt)X0X(Δt)t=0=ΔXt=0+X0\begin{array}{c} \left. \left\langle \Delta X \right\rangle \right|_{t=0} = \left. \left( \left\langle X(t+\Delta t) \right\rangle - \left\langle X(t) \right\rangle \right) \right|_{t=0} = \left\langle X(\Delta t) \right\rangle - \left\langle X(0) \right\rangle = \left\langle X(\Delta t) \right\rangle - \left\langle X_{0} \right\rangle \\[10pt] \left. X(\Delta t) \right|_{t=0} = \left. \Delta X \right|_{t=0} + X_{0} \end{array}

Since X0=X0\left\langle X_{0}\right\rangle=X_{0} is a constant, by convention we will no longer explicitly indicate that we are evaluating at t=0t=0, although this should be understood.

If the variance at time tt, with X0X_{0} as the initial state, is given by

σ2(Δt;X0)=X(Δt)2X(Δt)2=(ΔX+X0)2ΔX+X02=ΔX2+X02+2X0ΔX(X0+ΔX)2=ΔX2+X02+2X0ΔX(ΔX2+X02+2X0ΔX)=ΔX2ΔX2.\begin{align} \sigma^{2}(\Delta t;X_{0}) &= \left\langle X(\Delta t)^{2} \right\rangle - \left\langle X(\Delta t) \right\rangle^{2} \\ &= \left\langle (\Delta X+X_{0})^{2} \right\rangle - \left\langle \Delta X+X_{0} \right\rangle^{2} \\ &= \left\langle \Delta X^{2} + X_{0}^{2} + 2X_{0}\Delta X \right\rangle - \left( X_{0} + \left\langle \Delta X \right\rangle \right)^{2} \\ &= \left\langle \Delta X^{2} \right\rangle + X_{0}^{2} + 2X_{0} \left\langle \Delta X \right\rangle - \left( \left\langle \Delta X \right\rangle^{2} + X_{0}^{2} + 2X_{0} \left\langle \Delta X \right\rangle \right) \\ &= \left\langle \Delta X^{2} \right\rangle - \left\langle \Delta X \right\rangle^{2}. \end{align}

Therefore,

ΔX2=σ2(Δt;X0)+ΔX2.\left\langle \Delta X^{2} \right\rangle = \sigma^{2}(\Delta t;X_{0}) + \left\langle \Delta X \right\rangle^{2}.

Thus,

D(2)(X0)=12limΔt0(ΔX)2Δt=12limΔt0σ2(Δt;X0)+ΔX2Δt=12limΔt0σ2(Δt;X0)Δt+12limΔt0ΔX2Δt.\begin{align} D^{(2)}(X_{0}) &= \frac{1}{2} \lim_{\Delta t\rightarrow0} \frac{ \left\langle (\Delta X)^{2} \right\rangle } {\Delta t} \\ &= \frac{1}{2} \lim_{\Delta t\rightarrow0} \frac{ \sigma^{2}(\Delta t;X_{0}) + \left\langle \Delta X \right\rangle^{2} } {\Delta t} \\ &= \frac{1}{2} \lim_{\Delta t\rightarrow0} \frac{ \sigma^{2}(\Delta t;X_{0}) } {\Delta t} + \frac{1}{2} \lim_{\Delta t\rightarrow0} \frac{ \left\langle \Delta X \right\rangle^{2} } {\Delta t}. \end{align}

Now, regarding the first moment, we had:

D(1)(X0)=limΔt0ΔXΔt.D^{(1)}(X_{0})=\lim_{\Delta t\rightarrow0}\frac{\langle\Delta X\rangle}{\Delta t}.

For a sufficiently small time interval, we can approximate:

D(1)(X0)ΔXΔt,D^{(1)}(X_{0})\approx\frac{\langle\Delta X\rangle}{\Delta t},

or, equivalently,

ΔXD(1)(X0)Δt.\langle\Delta X\rangle\approx D^{(1)}(X_{0})\Delta t.

Therefore, for the second term:

limΔt0ΔX2Δt=limΔt0[D(1)(X0)]2Δt2Δt=limΔt0[D(1)(X0)]2Δt=[D(1)(X0)]2limΔt0Δt=0.\lim_{\Delta t\rightarrow0}\frac{\left\langle \Delta X\right\rangle ^{2}}{\Delta t} = \lim_{\Delta t\rightarrow0} \frac{\left[D^{(1)}(X_{0})\right]^{2}\Delta t^{2}}{\Delta t} = \lim_{\Delta t\rightarrow0} \left[D^{(1)}(X_{0})\right]^{2}\Delta t = \left[D^{(1)}(X_{0})\right]^{2} \lim_{\Delta t\rightarrow0}\Delta t =0.

Now, only the first term remains. If:

σ2tt=0=limΔt0σ2(t+Δt;X0)σ2(t;X0)Δtt=0=limΔt0σ2(Δt;X0)σ2(0;X0)Δt=limΔt0σ2(Δt;X0)Δt.\left.\frac{\partial\sigma^{2}}{\partial t}\right|_{t=0} = \left. \lim_{\Delta t\rightarrow0} \frac{\sigma^{2}\left(t+\Delta t;X_{0}\right)-\sigma^{2}\left(t;X_{0}\right)} {\Delta t} \right|_{t=0} = \lim_{\Delta t\rightarrow0} \frac{\sigma^{2}\left(\Delta t;X_{0}\right)-\sigma^{2}\left(0;X_{0}\right)} {\Delta t} = \lim_{\Delta t\rightarrow0} \frac{\sigma^{2}\left(\Delta t;X_{0}\right)} {\Delta t}.

Since the variance at the initial instant is zero,

σ2(0;X0)=0,\sigma^{2}\left(0;X_{0}\right)=0,

that is, the value is known exactly. Therefore:

D(2)(X0)=12σ2tt=0.D^{(2)}\left(X_{0}\right) = \frac{1}{2} \left. \frac{\partial\sigma^{2}}{\partial t} \right|_{t=0}.

Therefore, we have:

P(X,t)t=X[V(X)P(X,t)]+2X2[D(X)P(X,t)].\frac{\partial P\left(X,t\right)}{\partial t} = -\frac{\partial}{\partial X} \left[V\left(X\right)P\left(X,t\right)\right] + \frac{\partial^{2}}{\partial X^{2}} \left[D\left(X\right)P\left(X,t\right)\right].

With:

V(X0)=X(t;X0)tt=0D(X0)=D(2)(X0)=12σ(t;X0)2tt=0.V\left(X_{0}\right) = \left. \frac{\partial\left\langle X\left(t;X_{0}\right)\right\rangle} {\partial t} \right|_{t=0} \qquad D\left(X_{0}\right) = D^{(2)}\left(X_{0}\right) = \frac{1}{2} \left. \frac{\partial\sigma\left(t;X_{0}\right)^{2}} {\partial t} \right|_{t=0}.

The Yard-Sale Model

Therefore, by setting (x=wx=w), we obtain the equation used in the article:

Pt=w[limΔt0ΔwΔtP]+2w2[12limΔt0ΔwΔwΔtP].\frac{\partial P}{\partial t} = -\frac{\partial}{\partial w} \left[ \lim_{\Delta t\rightarrow0} \frac{\left\langle \Delta w\right\rangle}{\Delta t}P \right] + \frac{\partial^{2}}{\partial w^{2}} \left[ \frac{1}{2} \lim_{\Delta t\rightarrow0} \frac{\left\langle \Delta w\Delta w\right\rangle}{\Delta t}P \right].

In the article, we have:

Pt=w[Δ(w)P]+2w2[12Δ(w)Δ(w)P].\frac{\partial P}{\partial t} = -\frac{\partial}{\partial w} \left[ \left\langle \Delta(w)\right\rangle P \right] + \frac{\partial^{2}}{\partial w^{2}} \left[ \frac{1}{2} \left\langle \Delta(w)\Delta(w)\right\rangle P \right].

Therefore:

Δ(w)=limΔt0ΔwΔtΔ(w)2=limΔt0(Δw)2Δt.\left\langle \Delta(w)\right\rangle = \lim_{\Delta t\rightarrow0} \frac{\left\langle \Delta w\right\rangle}{\Delta t} \qquad \left\langle \Delta(w)^{2}\right\rangle = \lim_{\Delta t\rightarrow0} \frac{\left\langle \left(\Delta w\right)^{2}\right\rangle}{\Delta t}.

To demonstrate this relation, we introduce some additional assumptions. Consider a single realization of the process during a time interval (Δt\Delta t), in which (ΔN\Delta N) transactions occur and the total transferred wealth is (Δw\Delta w). We define the average wealth transferred per transaction in this realization as

Δ(w)1ΔwΔN,\left\langle \Delta(w)_{1}\right\rangle \equiv \frac{\Delta w}{\Delta N},

from which it immediately follows that

Δw=ΔNΔ(w)1.\Delta w = \Delta N\left\langle \Delta(w)_{1}\right\rangle .

Next, we generalize to an ensemble of realizations, in which both (Δw\Delta w) and (ΔN\Delta N) may vary. Taking the mathematical expectation over this ensemble and assuming that the number of transactions occurring within an interval is statistically independent of the average wealth transferred per transaction, we obtain:

The change in notation

Δ(w)1Δ(w)\left\langle \Delta(w)_{1}\right\rangle \rightarrow \left\langle \Delta(w)\right\rangle

indicates that the average is no longer taken within a single realization, but rather over the ensemble.

We have:

Δw=ΔNΔ(w).\left\langle \Delta w\right\rangle =\left\langle \Delta N\right\rangle \left\langle \Delta(w)\right\rangle .

For a Poisson process, we assume that the probability of an event occurring within a small time interval is proportional to the time interval. That is,

ΔN=λΔt,\left\langle \Delta N\right\rangle =\lambda\Delta t,

where the larger the time interval, the higher the probability that an exchange occurs.

Therefore,

Δw=ΔNΔ(w)\left\langle \Delta w\right\rangle = \left\langle \Delta N\right\rangle \left\langle \Delta(w)\right\rangle
Δw=λΔtΔ(w)\left\langle \Delta w\right\rangle = \lambda\Delta t\left\langle \Delta(w)\right\rangle
ΔwΔt=λΔ(w).\frac{\left\langle \Delta w\right\rangle}{\Delta t} = \lambda\left\langle \Delta(w)\right\rangle .

We will then choose the time unit such that the average time between transactions is one. In this scale, the transaction rate is λ=1\lambda=1, so that

ΔN=Δt,\left\langle \Delta N\right\rangle =\Delta t,

that is, there is on average one transaction per unit of time. Therefore:

ΔwΔt=Δ(w)limΔt0ΔwΔt=Δ(w).\frac{\left\langle \Delta w\right\rangle}{\Delta t} = \left\langle \Delta(w)\right\rangle \rightarrow \lim_{\Delta t\rightarrow0} \frac{\left\langle \Delta w\right\rangle}{\Delta t} = \left\langle \Delta(w)\right\rangle .

Since the right-hand side does not depend on Δt\Delta t. An analogous reasoning applies to

Δ(w)2.\left\langle \Delta(w)^{2}\right\rangle .

However, let us take a step back and consider

Δ(w)1ΔwΔN,\left\langle \Delta(w)_{1}\right\rangle \equiv \frac{\Delta w}{\Delta N},

while reinforcing the assumption that we are working with a Poisson process. Consider a single realization of the process during a time interval Δt\Delta t, in which ΔN\Delta N transactions occur:

Δw=i=1ΔNΔ(w)i\Delta w=\sum^{\Delta N}_{i=1}\Delta(w)_{i}
(Δw)2=i,j=1ΔNΔ(w)iΔ(w)j=i=1ΔNΔ(w)i2+(ijΔNΔ(w)jΔ(w)i)\left(\Delta w\right)^{2} = \sum^{\Delta N}_{i,j=1} \Delta(w)_{i}\Delta(w)_{j} = \sum^{\Delta N}_{i=1} \Delta(w)^{2}_{i} + \left( \sum^{\Delta N}_{i\neq j} \Delta(w)_{j}\Delta(w)_{i} \right)

Taking the average, we obtain:

(Δw)2=ΔNΔ(w)E2+ijΔNΔ(w)jΔ(w)i.\left\langle \left(\Delta w\right)^{2}\right\rangle = \left\langle \Delta N\right\rangle \left\langle \Delta(w)^{2}_{E}\right\rangle + \left\langle \sum^{\Delta N}_{i\neq j} \Delta(w)_{j}\Delta(w)_{i} \right\rangle .

For the first term, we repeat the reasoning from the previous case. Since we avoid the case where i=ji=j, if the first summation involves ΔN\Delta N terms, the second sums over ΔN\Delta N values for ii and ΔN1\Delta N-1 values for jj (for example), thereby excluding instances where i=ji=j. Thus, the second summation consists of ΔN(ΔN1)\Delta N(\Delta N-1) terms. Denoting the ensemble average of the terms Δ(w)jΔ(w)i\langle \Delta(w)_j \Delta(w)_i \rangle as ΔΔ(w)E\langle \Delta\Delta(w)_E \rangle, we write:

(Δw)2=ΔNΔ(w)E2+ΔN(ΔN1)ΔΔ(w)E.\left\langle \left(\Delta w\right)^{2} \right\rangle = \left\langle \Delta N\right\rangle \left\langle \Delta(w)^{2}_{E} \right\rangle + \left\langle \Delta N(\Delta N-1) \right\rangle \left\langle \Delta\Delta(w)_{E} \right\rangle .

However, now

ΔN(ΔN1)\left\langle \Delta N(\Delta N-1) \right\rangle

is slightly more complicated than

ΔN=λΔt.\left\langle\Delta N\right\rangle=\lambda\Delta t.

For now, we will use the factorial moment of the Poisson distribution ([Wikipedia]). Using the notation

(x)n=x(x1)(x2)(xn+1),(x)_{n} = x(x-1)(x-2)\dots(x-n+1),

we have:

(N)1=(N1+1)=N(N)_{1} = (N-1+1) = N

and

(N)2=N(N2+1)=N(N1).(N)_{2} = N(N-2+1) = N(N-1).

For a Poisson distribution, we have

(X)n=μn,\left\langle (X)_{n} \right\rangle = \mu^{n},

for a Poisson random variable with mean μ\mu. Therefore:

N=λΔt\left\langle N\right\rangle = \lambda\Delta t

and

N(N1)=(λΔt)2.\left\langle N(N-1) \right\rangle = (\lambda\Delta t)^{2}.

Thus:

(Δw)2=λΔtΔ(w)E2+(λΔt)2ΔΔ(w)E.\left\langle \left(\Delta w\right)^{2} \right\rangle = \lambda\Delta t \left\langle \Delta(w)^{2}_{E} \right\rangle + (\lambda\Delta t)^{2} \left\langle \Delta\Delta(w)_{E} \right\rangle .

Therefore,

limΔt0(Δw)2Δt=λΔ(w)E2+limΔt0λΔtΔΔ(w)E.\lim_{\Delta t\rightarrow0} \frac{ \left\langle \left(\Delta w\right)^{2} \right\rangle }{\Delta t} = \lambda \left\langle \Delta(w)^{2}_{E} \right\rangle + \lim_{\Delta t\rightarrow0} \lambda\Delta t \left\langle \Delta\Delta(w)_{E} \right\rangle .

Finally,

limΔt0(Δw)2Δt=λΔ(w)E2.\lim_{\Delta t\rightarrow0} \frac{ \left\langle \left(\Delta w\right)^{2} \right\rangle }{\Delta t} = \lambda \left\langle \Delta(w)^{2}_{E} \right\rangle .

Therefore, since the second term is proportional to (Δt)2(\Delta t)^{2}, after dividing by Δt\Delta t it remains of order Δt\Delta t, vanishing in the continuous limit. This shows that the second Kramers-Moyal coefficient is determined only by the second moment of the wealth transferred in a single transaction, in complete analogy with the result obtained for the first moment. Choosing the time unit as the average interval between transactions, that is, λ=1\lambda=1, we obtain

Δ(w)2=limΔt0(Δw)2Δt.\left\langle \Delta(w)^{2}\right\rangle = \lim_{\Delta t\rightarrow0} \frac{\left\langle \left(\Delta w\right)^{2}\right\rangle}{\Delta t}.

However, let us pause for a moment and start from the beginning. Suppose that wealth is distributed according to a probability density function (PDF) P(w)P(w). Then,

abP(w)dw\int_{a}^{b}P(w)dw

represents the total population of agents with wealth w[a,b]w\in[a,b], and the fraction of the population with wealth greater than ww is given by

A(w)=wP(w)dw0P(w)dw.A(w)= \frac{\int_{w}^{\infty}P(w')dw'} {\int_{0}^{\infty}P(w)dw}.

Pareto found the following approximation:

Ap(w)={1,w<wmin(wminw)α,wwmin.A_{p}(w)= \begin{cases} 1, & w< w_{min}\\ \left(\frac{w_{min}}{w}\right)^{\alpha}, & w\geq w_{min}. \end{cases}

Before proceeding, it seems interesting to make one more observation. In the description of the model, it is assumed that the commodity possesses an “intrinsic value”, and that when agents exchange with each other, they assign a price different from this intrinsic value, that is, they evaluate it above or below its intrinsic value. This causes a transfer of wealth (measured in intrinsic value) between agents.

In this description, the concept of the agent’s “utility function” is even mentioned to justify this incorrect valuation (it is worth noting that this is explicitly described as an error). It is interesting that, while attempting to preserve the idea of a utility function from marginalist microeconomics, the model simultaneously postulates the existence of an objective value that differs from the price.

However, continuing, we aim to model the exchange of wealth between two agents such that:

  • One agent has wealth ww and another has wealth ww'.

  • The amount to be transferred is a fraction β\beta of the wealth of the poorer agent.

    • The amount of wealth being transferred from ww' to ww is

      Δ(w,w,r)=βrmin(w,w).\Delta(w,w',r)=\beta r\min(w,w').
  • The beneficiary of the exchange is either one of the two agents with equal probability.

    • That is, r=±1r=\pm1 with equal probability.

After the transaction, the wealth of the agents is:

wfinal=w+Δ(w,w,r)w_{final}=w+\Delta(w,w',r)
wfinal=wΔ(w,w,r).w'_{final}=w'-\Delta(w,w',r).

Using a Heaviside step function,

θ(x)={1,x00,x<0,\theta(x) = \begin{cases} 1, & x\geq0\\ 0, & x< 0 \end{cases},

we can write:

Δ(w,w,r)=βr[wθ(ww)+wθ(ww)].\Delta(w,w',r) = \beta r \left[ w\theta(w'-w) + w'\theta(w-w') \right].

That is, if w<ww'< w, only the second term remains, and we have a fraction of ww' being transferred. Conversely, if w<ww< w', only the first term remains.

But what happens when w=ww'=w? In this case, the expression gives twice the value, which may be problematic. For example, if w=w=1w=w'=1 and β=r=1\beta=r=1, then

Δ(w,w,r)=2.\Delta(w,w',r)=2.

This would imply

wfinal=1,w'_{final}=-1,

which is not physically meaningful.

I believe this issue will not affect the equations developed later, since they deal with probability flows. However, a simple way to resolve it is to use another popular definition of the Heaviside function:

θ(x)={1,x>012,x=00,x<0.\theta(x) = \begin{cases} 1, & x>0\\ \frac{1}{2}, & x=0\\ 0, & x< 0 \end{cases}.

With this definition, we can now return to the Fokker-Planck equation:

Pt=w[Δ(w)P]+2w2[12Δ(w)Δ(w)P].\frac{\partial P}{\partial t} = -\frac{\partial}{\partial w} \left[ \left\langle \Delta(w)\right\rangle P \right] + \frac{\partial^{2}}{\partial w^{2}} \left[ \frac{1}{2} \left\langle \Delta(w)\Delta(w)\right\rangle P \right].

Here, .\left\langle .\right\rangle denotes the average over the distribution of step sizes, that is, in this case, the average over the distribution of possible amounts of wealth transferred in an interaction.

The wealth variation of an agent with wealth ww after a transaction has two sources of stochasticity:

  • The wealth ww' of the partner agent must be obtained from a sample of the probability distribution function P(w)P(w').

  • The random variable rr.

We define the average of the function f(w,r)f(w',r) over these two sources of randomness as:

f=1NdwP(w)f(w,1)+f(w,+1)2.\left\langle f\right\rangle = \frac{1}{N} \int dw'P(w') \frac{f(w',-1)+f(w',+1)}{2}.

Since P(w)P(w) is not normalized, P(w)N\frac{P(w')}{N} is only the normalized probability density function. Therefore,

f=[f(w,1)+f(w,+1)2][P(w)N]dw.\left\langle f\right\rangle = \int \left[ \frac{f(w',-1)+f(w',+1)}{2} \right] \left[ \frac{P(w')}{N} \right] dw'.

Now we need to understand why we are calculating the average over the first term inside the brackets. We want an average over both sources of randomness. For a fixed value of ww', there are two possible values of rr with equal probability. Therefore,

fr=f(w,1)+f(w,+1)2.\left\langle f\right\rangle_{r} = \frac{f(w',-1)+f(w',+1)}{2}.

Now, if we calculate the average of fr\left\langle f\right\rangle_{r} over all possible values of ww', we are applying the Law of Total Expectation:

E[f]=Ew[Er(f(w,r)w)].E[f]=E_{w'}\left[E_{r}(f(w',r)|w')\right].

This means that the global average of ff (over both sources of randomness) is calculated in two steps: (i) we fix the partner’s wealth ww' and calculate the average over the variable rr; (ii) we then average these results over all possible values of the partner’s wealth ww', weighted by their probability of occurrence.

It is worth noting that Ei[f]E_i[f] indicates that the average is taken over the variable ii. Therefore,

f=fr[P(w)N]dw\left\langle f\right\rangle = \int \left\langle f\right\rangle_{r} \left[ \frac{P(w')}{N} \right] dw'

or equivalently,

f=f(w,1)+f(w,+1)2P(w)Ndw.\left\langle f\right\rangle = \int \frac{f(w',-1)+f(w',+1)}{2} \frac{P(w')}{N} dw'.

Taking

f=Δ(w),f=\Delta(w),

we obtain:

Δ(w)=Δ(w,w,1)+Δ(w,w,+1)2P(w)Ndw.\left\langle \Delta(w)\right\rangle = \int \frac{ \Delta(w,w',-1)+\Delta(w,w',+1) }{2} \frac{P(w')}{N} dw'.

It is worth noting that, for any pair (w,w)(w,w'),

Δ(w,w,1)+Δ(w,w,+1)=βmin(w,w)+βmin(w,w)=0.\Delta(w,w',-1)+\Delta(w,w',+1) = -\beta\min(w,w') + \beta\min(w,w') = 0.

Therefore,

Δ(w)=0.\left\langle \Delta(w)\right\rangle =0.

Now, taking

f=Δ(w)2,f=\Delta(w)^{2},

we obtain:

Δ(w)2=Δ(w,w,1)2+Δ(w,w,+1)22P(w)Ndw.\left\langle \Delta(w)^{2}\right\rangle = \int \frac{ \Delta(w,w',-1)^{2} + \Delta(w,w',+1)^{2} }{2} \frac{P(w')}{N} dw'.

Therefore, defining

S=Δ(w,w,1)2+Δ(w,w,+1)2,S= \Delta(w,w',-1)^{2} + \Delta(w,w',+1)^{2},

we have

S=(β[wθ(ww)+wθ(ww)])2+(β[wθ(ww)+wθ(ww)])2,S= \left( -\beta \left[ w\theta(w'-w) + w'\theta(w-w') \right] \right)^{2} + \left( \beta \left[ w\theta(w'-w) + w'\theta(w-w') \right] \right)^{2},

which gives

S=2β2[wθ(ww)+wθ(ww)]2.S= 2\beta^{2} \left[ w\theta(w'-w) + w'\theta(w-w') \right]^{2}.

Using the definition

θ(x)={1,x00,x<0,\theta(x) = \begin{cases} 1, & x\geq0\\ 0, & x< 0 \end{cases},

we have that

θ(ww)θ(ww)=0\theta(w'-w)\theta(w-w')=0

for www'\neq w, since one of the two factors is always zero. The cross term survives only when w=ww=w', namely,

2wwθ(ww)θ(ww).2ww'\theta(w'-w)\theta(w-w').

However, this case corresponds to a single point in the integration domain. Since a set composed of a single point has null measure, its contribution to the integral is zero. In one dimension, the measure of a set corresponds to its length; in two dimensions, to its area; in three dimensions, to its volume. More generally, integrals are computed with respect to the measure of the integration domain.

Furthermore, since

θ(x)=θ2(x),\theta(x)=\theta^{2}(x),

we obtain:

S=2β2[w2θ(ww)+w2θ(ww)].S= 2\beta^{2} \left[ w^{2}\theta(w'-w) + w'^{2}\theta(w-w') \right].

Substituting into the expression for the second moment, we obtain:

Δ(w)2=2β2[w2θ(ww)+w2θ(ww)]2P(w)Ndw.\left\langle \Delta(w)^{2}\right\rangle = \int \frac{ 2\beta^{2} \left[ w^{2}\theta(w'-w) + w'^{2}\theta(w-w') \right] }{2} \frac{P(w')}{N} dw'.

Since the first term contributes only for w<w'<\infty with w>ww'>w, and the second term only for w<ww'<w, we have:

Δ(w)2=β2(ww2P(w)Ndw+0ww2P(w)Ndw).\left\langle \Delta(w)^{2}\right\rangle = \beta^{2} \left( \int_{w}^{\infty} w^{2} \frac{P(w')}{N} dw' + \int_{0}^{w} w'^{2} \frac{P(w')}{N} dw' \right).

Rewriting the first term using the definition of A(w)A(w),

A(w)=wP(w)dw0P(w)dw,A(w) = \frac{ \int_{w}^{\infty}P(w')dw' }{ \int_{0}^{\infty}P(w)dw },

and defining

B(w)=120ww2P(w)Ndw,B(w) = \frac{1}{2} \int_{0}^{w} w'^{2} \frac{P(w')}{N} dw',

we obtain:

Δ(w)2=β22(w22A(w)+B(w)).\left\langle \Delta(w)^{2}\right\rangle = \beta^{2} 2 \left( \frac{w^{2}}{2}A(w) + B(w) \right).

where the first term is the Pareto function defined previously. We can therefore write the Fokker-Planck equation as:

Pt=w[Δ(w)P]+2w2[12Δ(w)Δ(w)P]\frac{\partial P}{\partial t} = -\frac{\partial}{\partial w} \left[ \left\langle \Delta(w)\right\rangle P \right] + \frac{\partial^{2}}{\partial w^{2}} \left[ \frac{1}{2} \left\langle \Delta(w)\Delta(w) \right\rangle P \right]
=2w2[12(β22(w22A(w)+B(w)))P]= \frac{\partial^{2}}{\partial w^{2}} \left[ \frac{1}{2} \left( \beta^{2}2 \left( \frac{w^{2}}{2}A(w)+B(w) \right) \right) P \right]
=β22w2[(w22A+B)P].= \beta^{2} \frac{\partial^{2}}{\partial w^{2}} \left[ \left( \frac{w^{2}}{2}A+B \right) P \right].

We can also show the conservation of the population by integrating the left-hand side:

tPdw=Nt=N˙=0,\frac{\partial}{\partial t}\int P\,dw = \frac{\partial N}{\partial t} = \dot{N} = 0,

and the conservation of wealth:

twPdw=Wt=W˙=0.\frac{\partial}{\partial t}\int wP\,dw = \frac{\partial W}{\partial t} = \dot{W} = 0.

Writing

Pt=2F(w)w2=F(w),\frac{\partial P}{\partial t} = \frac{\partial^{2}F(w)}{\partial w^{2}} = F''(w),

where

F(w)=β2(w22A+B)P,F(w) = \beta^{2} \left( \frac{w^{2}}{2}A+B \right) P,

we have

N˙=0+F(w)dw=F()F(0).\dot{N} = \int_{0}^{+\infty} F''(w)\,dw = F'(\infty)-F'(0).

Defining

J(w)=F(w),J(w)=-F'(w),

we identify J(w)J(w) as the probability flux:

Pt=2F(w)w2=Jw.\frac{\partial P}{\partial t} = \frac{\partial^{2}F(w)}{\partial w^{2}} = -\frac{\partial J}{\partial w}.

Therefore, assuming a vanishing net probability flux between the boundaries, we have

0=F()F(0)=N˙.0 = F'(\infty)-F'(0) = \dot{N}.

For W˙\dot{W}, we need to use integration by parts, taking

u=w,du=dw,u=w, \qquad du=dw,

and

dv=F(w)dw,v=F(w).dv=F''(w)dw, \qquad v=F'(w).
W˙=0+wF(w)dw=[wF(w)]0+0+F(w)dw.\dot{W} = \int_{0}^{+\infty} wF''(w)dw = \left[wF'(w)\right]_{0}^{+\infty} - \int_{0}^{+\infty}F'(w)dw.

The second integral has already been shown to be zero. Therefore,

W˙=limwwF(w)limw0wF(w).\dot{W} = \lim_{w\rightarrow\infty}wF'(w) - \lim_{w\rightarrow0}wF'(w).
  • Lower boundary (w0w\rightarrow0): limw0wF(w)\lim_{w\rightarrow0}wF'(w).

Calculating F(w)F'(w) explicitly, we have:

F=β2[(wA+w22A+B)P+(w22A+B)P].F' = \beta^{2} \left[ \left( wA+\frac{w^{2}}{2}A'+B' \right)P + \left( \frac{w^{2}}{2}A+B \right)P' \right].

Taking N=1N=1, we have

A=[wP(w)dw]=P(w),A' = \left[ \int_{w}^{\infty}P(w')dw' \right]' = -P(w),

since P(w)P(w) must vanish at infinity, and

B(w)=12[0ww2P(w)dw]=w22P(w),B'(w) = \frac{1}{2} \left[ \int_{0}^{w}w'^{2}P(w')dw' \right]' = \frac{w^{2}}{2}P(w),

where we have assumed that P(0)P(0) has a finite value at w=0w=0.

Therefore, for w0w\rightarrow0,

F(0)=β2[(0+0+0)P(0)+(0+0)P(0)]=0.F'(0) = \beta^{2} \left[ \left( 0+0+0 \right)P(0) + \left( 0+0 \right)P'(0) \right] = 0.

Therefore,

limw0wF(w)=0,\lim_{w\rightarrow0}wF'(w)=0,

provided that P(0)P(0) and P(0)P'(0) do not diverge too rapidly. Since B(0)=0B(0)=0 trivially, it is sufficient that P(0)P(0) remains finite, which is a reasonable condition.

  • Upper boundary (ww\rightarrow\infty)

Writing

F(w)=β2[(wwP(w)dww22P(w)+w22P(w))P(w)+(w22wP(w)dw+0ww22P(w)dw)P(w)].F'(w) = \beta^{2} \left[ \left( w\int_{w}^{\infty}P(w')dw' -\frac{w^{2}}{2}P(w) +\frac{w^{2}}{2}P(w) \right)P(w) + \left( \frac{w^{2}}{2} \int_{w}^{\infty}P(w')dw' + \int_{0}^{w}\frac{w'^{2}}{2}P(w')dw' \right) P'(w) \right].

For

limwwF(w)=0,\lim_{w\rightarrow\infty}wF'(w)=0,

it is necessary and sufficient that the tail of the distribution P(w)P(w) and its derivative P(w)P'(w) decay sufficiently fast. This is again a reasonable assumption, since no agent can possess infinite wealth.

Moreover, for A()=0A(\infty)=0, we now have a trivial integral, since the integration limits are identical.

In summary, we assume the following regularity conditions:

  • P(w)P(w) is differentiable in a neighborhood of w=0w=0, such that P(0)P(0) and P(0)P'(0) are finite. Consequently,

limw0wP(n)(w)=0,n=0,1.\lim_{w\rightarrow0}wP^{(n)}(w)=0, \qquad n=0,1.
  • P(w)P(w) and P(w)P'(w) decay sufficiently fast as ww\rightarrow\infty, such that all boundary terms vanish, that is,

limwf(w)P(n)(w)=0,\lim_{w\rightarrow\infty}f(w)P^{(n)}(w)=0,

where f(w)f(w) represents any factor arising from the equation.

  • The integrals defining A(w)A(w) and B(w)B(w) must be convergent, that is,

0P(w)dw<\int_{0}^{\infty}P(w)dw<\infty

and

0w2P(w)dw<.\int_{0}^{\infty}w^{2}P(w)dw<\infty .
  • Observation: Saying that a quantity goes to zero “faster” means that, when comparing two functions, one vanishes more rapidly than the other in a given limit. For example, consider A(x)=x A(x)=x, and B(x)=x2 B(x)=x^{-2}, as xx\rightarrow\infty. In this case, A(x)A(x) diverges while B(x)B(x) approaches zero. The function B(x)B(x) approaches zero faster than A(x)A(x) grows, since

limxA(x)B(x)=limxxx2=limx1x=0.\lim_{x\rightarrow\infty}A(x)B(x) = \lim_{x\rightarrow\infty}\frac{x}{x^{2}} = \lim_{x\rightarrow\infty}\frac{1}{x} = 0.

Redistribution

Let us assume that, during a small time increment, the wealth ww is taxed at a rate τ\tau, transferring an amount τw\tau w to the collector. The total amount of wealth collected from all agents is therefore

0τwP(w)dw=τW.\int_{0}^{\infty}\tau wP(w)dw=\tau W.

If we redistribute the total collected tax among the NN agents, then each agent receives the same amount of wealth,

τWN,\frac{\tau W}{N},

and therefore:

Δr(w)=τWNτw=τ(WNw).\Delta_{r}(w) = \frac{\tau W}{N}-\tau w = \tau \left( \frac{W}{N}-w \right).

According to the model description, this quantity represents the transfer rate, that is, the rate at which wealth is transferred. Therefore, the total change in wealth over a given time interval is

ΔT=Δ(w,w,r)+Δr(w)Δt,\Delta_{T} = \Delta(w,w',r) + \Delta_{r}(w)\Delta t,

where Δ(w,w,r)\Delta(w,w',r) is the accumulated wealth change due to exchanges during the interval Δt\Delta t. The difference between Δ(w)\Delta(w) and Δr(w)\Delta_{r}(w) is that the former represents an amount of wealth, while the latter is a rate of change.

Therefore,

ΔT=Δ(w,w,r)+Δr(w)Δt.\left\langle \Delta_{T}\right\rangle = \left\langle \Delta(w,w',r) \right\rangle + \left\langle \Delta_{r}(w)\Delta t \right\rangle .

The first term was already calculated, giving

Δ(w)=0,\left\langle \Delta(w)\right\rangle=0,

while for the second term,

Δr(w)Δt=Δr(w)Δt,\left\langle \Delta_{r}(w)\Delta t \right\rangle = \Delta_{r}(w)\Delta t,

since it is deterministic and not subject to any random variation. Therefore, we now have a drift term:

ΔT=Δr(w)Δt.\left\langle \Delta_{T}\right\rangle = \Delta_{r}(w)\Delta t.

For the second moment, we have:

ΔT2=(Δ(w)+Δr(w)Δt)2\left\langle \Delta_{T}^{2}\right\rangle = \left\langle \left( \Delta(w) + \Delta_{r}(w)\Delta t \right)^{2} \right\rangle
=Δ(w)2+2Δ(w)Δr(w)Δt+Δr(w)2Δt2= \left\langle \Delta(w)^{2} + 2\Delta(w)\Delta_{r}(w)\Delta t + \Delta_{r}(w)^{2}\Delta t^{2} \right\rangle
=Δ(w)2+2Δ(w)Δr(w)Δt+Δr(w)2Δt2.= \left\langle \Delta(w)^{2} \right\rangle + 2 \left\langle \Delta(w) \right\rangle \Delta_{r}(w)\Delta t + \Delta_{r}(w)^{2}\Delta t^{2}.

Since

Δ(w)=0,\left\langle\Delta(w)\right\rangle=0,

we obtain:

ΔT2=Δ(w)2+Δr(w)2Δt2.\left\langle \Delta_{T}^{2}\right\rangle = \left\langle \Delta(w)^{2} \right\rangle + \Delta_{r}(w)^{2}\Delta t^{2}.

Substituting into the Fokker-Planck equation,

Pt=w[limΔt0ΔwΔtP]+2w2[12limΔt0ΔwΔwΔtP]\frac{\partial P}{\partial t} = -\frac{\partial}{\partial w} \left[ \lim_{\Delta t\rightarrow0} \frac{\left\langle \Delta w\right\rangle}{\Delta t} P \right] + \frac{\partial^{2}}{\partial w^{2}} \left[ \frac{1}{2} \lim_{\Delta t\rightarrow0} \frac{\left\langle \Delta w\Delta w\right\rangle}{\Delta t} P \right]
=w[limΔt0τ(WNw)ΔtΔtP]+2w2[12limΔt0Δ(w)2+Δr(w)2Δt2ΔtP]= -\frac{\partial}{\partial w} \left[ \lim_{\Delta t\rightarrow0} \frac{ \tau \left( \frac{W}{N}-w \right) \Delta t }{\Delta t} P \right] + \frac{\partial^{2}}{\partial w^{2}} \left[ \frac{1}{2} \lim_{\Delta t\rightarrow0} \frac{ \left\langle \Delta(w)^{2}\right\rangle + \Delta_{r}(w)^{2}\Delta t^{2} }{\Delta t} P \right]
=w[limΔt0τ(WNw)P]+2w2[12limΔt0(Δ(w)2Δt+Δr(w)2Δt)P]= -\frac{\partial}{\partial w} \left[ \lim_{\Delta t\rightarrow0} \tau \left( \frac{W}{N}-w \right) P \right] + \frac{\partial^{2}}{\partial w^{2}} \left[ \frac{1}{2} \lim_{\Delta t\rightarrow0} \left( \frac{ \left\langle \Delta(w)^{2}\right\rangle }{\Delta t} + \Delta_{r}(w)^{2}\Delta t \right) P \right]
=w[τ(WNw)P]+2w2[12limΔt0(Δ(w)2Δt)P].= -\frac{\partial}{\partial w} \left[ \tau \left( \frac{W}{N}-w \right) P \right] + \frac{\partial^{2}}{\partial w^{2}} \left[ \frac{1}{2} \lim_{\Delta t\rightarrow0} \left( \frac{ \left\langle \Delta(w)^{2}\right\rangle }{\Delta t} \right) P \right].

Since the second term is the one already studied previously, we obtain:

Pt=τw[(WNw)P]+β22w2[(w22A+B)P].\frac{\partial P}{\partial t} = -\tau \frac{\partial}{\partial w} \left[ \left( \frac{W}{N}-w \right) P \right] + \beta^{2} \frac{\partial^{2}}{\partial w^{2}} \left[ \left( \frac{w^{2}}{2}A+B \right) P \right].

Only at this point does the article mention that we should adopt as the time unit the average time between transactions, such that

ΔN=Δt.\left\langle \Delta N\right\rangle=\Delta t.

Now, defining

χ=τβ2,\chi=\frac{\tau}{\beta^{2}},

and rescaling the time according to

β2t=T,\beta^{2}t=T,

we have

Pt=PTTt=β2PT.\frac{\partial P}{\partial t} = \frac{\partial P}{\partial T} \frac{\partial T}{\partial t} = \beta^{2} \frac{\partial P}{\partial T}.

Therefore, we can manipulate the equation as follows:

1β2Pt=τβ2w[(WNw)P]+2w2[(w22A+B)P].\frac{1}{\beta^{2}} \frac{\partial P}{\partial t} = -\frac{\tau}{\beta^{2}} \frac{\partial}{\partial w} \left[ \left( \frac{W}{N}-w \right) P \right] + \frac{\partial^{2}}{\partial w^{2}} \left[ \left( \frac{w^{2}}{2}A+B \right) P \right].

Using

Pt=β2PT,\frac{\partial P}{\partial t} = \beta^{2} \frac{\partial P}{\partial T},

we obtain:

PTβ2β2=χw[(WNw)P]+2w2[(w22A+B)P].\frac{\partial P}{\partial T} \frac{\beta^{2}}{\beta^{2}} = -\chi \frac{\partial}{\partial w} \left[ \left( \frac{W}{N}-w \right) P \right] + \frac{\partial^{2}}{\partial w^{2}} \left[ \left( \frac{w^{2}}{2}A+B \right) P \right].

Therefore,

PT=χw[(WNw)P]+2w2[(w22A+B)P]\boxed{ \frac{\partial P}{\partial T} = -\chi \frac{\partial}{\partial w} \left[ \left( \frac{W}{N}-w \right) P \right] + \frac{\partial^{2}}{\partial w^{2}} \left[ \left( \frac{w^{2}}{2}A+B \right) P \right] }

Stationary state

Writing the probability current as

J=χ(WNw)Pw[(w22A+B)P],J = \chi \left( \frac{W}{N}-w \right) P - \frac{\partial}{\partial w} \left[ \left( \frac{w^{2}}{2}A+B \right) P \right],

we have a stationary state when:

PT=Jw,\frac{\partial P}{\partial T} = -\frac{\partial J}{\partial w},

and therefore,

0=Jw.0= \frac{\partial J}{\partial w}.

Thus,

J=C,J=C,

where CC is a constant.

Considering that, at equilibrium, the probability flux vanishes, we have

J=0.J=0.

Therefore,

χ(WNw)Pw[(w22A+B)P]=0.\chi \left( \frac{W}{N}-w \right) P - \frac{\partial}{\partial w} \left[ \left( \frac{w^{2}}{2}A+B \right) P \right] = 0.

Approximations and numerical solutions

We will try to solve the equation and obtain the same result as the article. According to the authors, the solutions present power-law behavior for large values of ww and a cutoff behavior for small values of ww, in full agreement with Pareto’s observations.

Starting from the stationary equation,

χ(WNw)Pw[(w22A+B)P]=0,\chi \left( \frac{W}{N}-w \right) P - \frac{\partial}{\partial w} \left[ \left( \frac{w^{2}}{2}A+B \right) P \right] = 0,

we choose

N=WN=W

and

χ=1.\chi=1.

We also recall that

A=PA'=-P

and

B=w22P.B'=\frac{w^{2}}{2}P.

Therefore,

P=11ww[(w22A+B)P].P = \frac{1}{1-w} \frac{\partial}{\partial w} \left[ \left( \frac{w^{2}}{2}A+B \right) P \right].

Defining

Q=(w22A+B)P,Q= \left( \frac{w^{2}}{2}A+B \right) P,

and differentiating, we obtain:

Q=(w22A+B)P,Q = \left( \frac{w^{2}}{2}A+B \right) P,
Qw=(wA+w22A+B)P+(w22A+B)P,\frac{\partial Q}{\partial w} = \left( wA+\frac{w^{2}}{2}A'+B' \right)P + \left( \frac{w^{2}}{2}A+B \right)P',

Substituting the relations for AA' and BB',

Qw=(wAw22P+w22P)P+(w22A+B)P,\frac{\partial Q}{\partial w} = \left( wA-\frac{w^{2}}{2}P+\frac{w^{2}}{2}P \right)P + \left( \frac{w^{2}}{2}A+B \right)P',

and therefore,

Qw=wAP+(w22A+B)P.\frac{\partial Q}{\partial w} = wAP + \left( \frac{w^{2}}{2}A+B \right)P'.

From the definition of QQ, the stationary equation gives:

(1w)P=Qw.(1-w)P = \frac{\partial Q}{\partial w}.

Equating the two expressions, we obtain:

(1w)P=wAP+(w22A+B)P(1-w)P = wAP + \left( \frac{w^{2}}{2}A+B \right) P'
(1wwA)P=(w22A+B)P(1-w-wA)P = \left( \frac{w^{2}}{2}A+B \right) P'
(1wwA)P(w22A+B)=P.\frac{ (1-w-wA)P }{ \left( \frac{w^{2}}{2}A+B \right) } = P'.

Therefore, we have the following system of differential equations:

P(w)w=1wwA(w)w22A(w)+B(w)P(w),\frac{\partial P(w)}{\partial w} = \frac{ 1-w-wA(w) }{ \frac{w^{2}}{2}A(w)+B(w) } P(w),
A(w)w=P(w),\frac{\partial A(w)}{\partial w} = -P(w),

and

B(w)w=w22P(w).\frac{\partial B(w)}{\partial w} = \frac{w^{2}}{2}P(w).
  • Low-wealth regime

Let us consider the regime of low wealth, where

P(w)0.P(w)\approx0.

Then,

A(w)w=0\frac{\partial A(w)}{\partial w}=0

and

B(w)w=0.\frac{\partial B(w)}{\partial w}=0.

Furthermore,

B00w22P(w)Ndw=0,B \approx \int_{0}^{0} \frac{w'^{2}}{2} \frac{P(w')}{N} dw' = 0,

while

A0P(w)dw=1.A \approx \int_{0}^{\infty} P(w')dw' = 1.

Therefore, the equation becomes:

P(w)w=12ww22P(w).\frac{\partial P(w)}{\partial w} = \frac{1-2w}{\frac{w^{2}}{2}} P(w).

The solution of this differential equation is

P(w)=cw4e2/w.P(w) = \frac{c}{w^{4}} e^{-2/w}.
  • High-wealth regime

We again have

P(w)0P(w)\approx0
A(w)w=0\frac{\partial A(w)}{\partial w}=0
B(w)w=0\frac{\partial B(w)}{\partial w}=0
B=ww22P(w)Ndw=BB = \int_{w}^{\infty} \frac{w'^{2}}{2} \frac{P(w')}{N} dw' = B_{\infty}
A=P(w)dw=0.A = \int_{\infty}^{\infty} P(w')dw' = 0.

Now we have:

P(w)w=1wBP(w)\frac{\partial P(w)}{\partial w} = \frac{1-w}{B_{\infty}}P(w)

The solution is

P(w)=cexp((2w)w2B)=cexp((2ww2)2B).P(w) = c\exp\left( \frac{(2-w)w}{2B_{\infty}} \right) = c\exp\left( \frac{(2w-w^{2})}{2B_{\infty}} \right).

Since

(w1)21=(w22w+1)1=2ww2,-(w-1)^{2}-1 = -(w^{2}-2w+1)-1 = 2w-w^{2},

then:

P(w)=cexp((w1)212B)P(w) = c\exp\left( \frac{-(w-1)^{2}-1}{2B_{\infty}} \right)
=cexp(12B)exp((w1)22B)= c\exp\left( \frac{-1}{2B_{\infty}} \right) \exp\left( \frac{-(w-1)^{2}}{2B_{\infty}} \right)
P(w)=cexp((w1)22B).P(w) = c\exp\left( \frac{-(w-1)^{2}}{2B_{\infty}} \right).

That is, it is not exactly a power-law distribution. A numerical solution was created with the aid of DeepSeek, ChatGPT and Gemini.

import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import solve_ivp, cumulative_trapezoid
from scipy.optimize import root_scalar

# =====================================================
# PARÂMETROS
# =====================================================

chi = 2

w_start = 0.1
w_end   = 100

# =====================================================
# EVENTO DE PARADA (SINGULARIDADE)
# =====================================================

# Esta função avisa o solver quando o denominador atinge 1e-15
def limite_denominador(w, y):
    P, A, B = y
    denom = 0.5 * w * w * A + B
    return denom - 1e-15

# Comando para interromper a integração quando a função retornar 0
limite_denominador.terminal = True

# =====================================================
# SISTEMA DE EDOS (AGORA MATEMATICAMENTE PURO)
# =====================================================

def ode(w,y):

    P,A,B = y

    denom = 0.5*w*w*A + B

    # A trava artificial foi removida. O solver confia no evento.

    dP = ((chi*(1-w)-w*A)/denom)*P
    dA = -P
    dB = 0.5*w*w*P

    return [dP,dA,dB]

# =====================================================
# MÉTODO DO TIRO
# =====================================================

def shoot(P0):

    sol = solve_ivp(
        ode,
        [w_start, w_end],
        [P0, 1, 0],
        events=limite_denominador,  # <--- Evento adicionado aqui
        rtol=1e-10,
        atol=1e-12
    )

    return sol.y[1,-1]

res = root_scalar(
    shoot,
    bracket=[1e-10,2],
    method='brentq'
)

P0 = res.root

print("P inicial =", P0)

# =====================================================
# SOLUÇÃO FINAL
# =====================================================

sol = solve_ivp(
    ode,
    [w_start, w_end],
    [P0, 1, 0],
    events=limite_denominador, # <--- Evento adicionado aqui
    dense_output=True,         # Permite calcular pontos customizados depois da solução
    rtol=1e-10,
    atol=1e-12
)

# Descobrindo onde a simulação realmente parou (pode ser 100, ou antes)
w_max_real = sol.t[-1]
print(f"Integração concluída até w = {w_max_real}")

# Criando a malha exata de 4000 pontos até o limite real encontrado
w = np.linspace(w_start, w_max_real, 4000)

# Avaliando os resultados nessa nova malha usando a saída densa (sol.sol)
y_densa = sol.sol(w)

P = y_densa[0]
A = y_densa[1]
B = y_densa[2]

P inicial = 1.3656669579129148e-10
Integração concluída até w = 100.0
# @title
# =====================================================
# TESTE 1
# RESÍDUO DA EDO
# =====================================================

Q = (0.5*w**2*A+B)*P

dQ = np.gradient(Q,w)

R = chi*(1-w)*P-dQ

print()
print("========== TESTE 1 ==========")
print("Resíduo máximo =",np.max(np.abs(R)))
print("Resíduo médio  =",np.mean(np.abs(R)))

# =====================================================
# TESTE 2
# RECONSTRUÇÃO DE A
# =====================================================

A_int = np.zeros_like(w)

for i in range(len(w)-1):

    A_int[i] = A_int[i] = np.trapezoid(P[i:], w[i:])

# =====================================================
# TESTE 3
# RECONSTRUÇÃO DE B
# =====================================================

B_int = cumulative_trapezoid(
    0.5*w**2*P,
    w,
    initial=0
)

print()
print("========== TESTE 2 ==========")
print("Erro máximo A =",np.max(np.abs(A-A_int)))
print("Erro máximo B =",np.max(np.abs(B-B_int)))

# =====================================================
# TESTE 4
# HIPÓTESE DO ARTIGO
# A≈1
# B≈0
# =====================================================

# Este 'mask_short_range' é específico para a região de w < 0.3
mask_short_range = w<0.3

print()
print("========== TESTE 3 ==========")

print("A médio =",np.mean(A[mask_short_range]))
print("A mínimo =",np.min(A[mask_short_range]))
print("A máximo =",np.max(A[mask_short_range]))

print()

print("B médio =",np.mean(B[mask_short_range]))
print("B máximo =",np.max(B[mask_short_range]))

# =====================================================
# TESTE 5
# EQUAÇÃO 22
# =====================================================

Qapprox = 0.5*w**2*P

dQapprox = np.gradient(Qapprox,w)

erro22 = np.max(np.abs(dQ[mask_short_range]-dQapprox[mask_short_range]))

print()
print("========== TESTE 4 ==========")
print("Erro aproximação Eq.22 =",erro22)

# =====================================================
# TESTE 6
# EXPOENTE LOCAL
# =====================================================

# Define uma máscara consistente para todos os gráficos log-log e cálculo de alpha
mask_for_log_plots = (P > 1e-15) & (w > 0.1)

alpha = np.gradient(
    np.log(P[mask_for_log_plots]),
    np.log(w[mask_for_log_plots])
)

# =====================================================
# GRÁFICOS
# =====================================================

plt.figure(figsize=(7,5))
plt.plot(w,P)
plt.xlabel("w")
plt.ylabel("P")
plt.grid()

plt.figure(figsize=(7,5))
plt.loglog(w[mask_for_log_plots],P[mask_for_log_plots]) # Usa a máscara consistente
plt.xlabel("w")
plt.ylabel("P")
plt.grid()

plt.figure(figsize=(7,5))
plt.plot(w,A,label="A")
plt.plot(w,A_int,"--",label="A integral")
plt.legend()
plt.grid()

plt.figure(figsize=(7,5))
plt.plot(w,B,label="B")
plt.plot(w,B_int,"--",label="B integral")
plt.legend()
plt.grid()

plt.figure(figsize=(7,5))
plt.plot(w,R)
plt.title("Resíduo da Eq. (21)")
plt.grid()

plt.figure(figsize=(7,5))
plt.plot(w[mask_short_range],dQ[mask_short_range],label="Eq.21")
plt.plot(w[mask_short_range],dQapprox[mask_short_range],'--',label="Eq.22")
plt.xlim(0,0.3)
plt.legend()
plt.grid()

#plt.figure(figsize=(7,5))
#plt.plot(w[mask_for_log_plots],alpha) # Usa a máscara consistente
#plt.axhline(-3,color='r',ls='--',label='Pareto')
#plt.xlabel("w")
#plt.ylabel(r"$d\log P/d\log w$")
#plt.legend()
#plt.grid()


# =====================================================
# DIAGNÓSTICO FINAL - EXPOENTE LOCAL
# =====================================================

========== TESTE 1 ==========
Resíduo máximo = 0.003084306495342054
Resíduo médio  = 1.3438167479948002e-05

========== TESTE 2 ==========
Erro máximo A = 0.002406190124915941
Erro máximo B = 4.542429082963692e-05

========== TESTE 3 ==========
A médio = 0.9996122233846921
A mínimo = 0.9977994902589599
A máximo = 1.0

B médio = 1.3615078697893104e-05
B máximo = 8.335080497379325e-05

========== TESTE 4 ==========
Erro aproximação Eq.22 = 9.806582728119628e-05
<Figure size 700x500 with 1 Axes>
<Figure size 700x500 with 1 Axes>
<Figure size 700x500 with 1 Axes>
<Figure size 700x500 with 1 Axes>
<Figure size 700x500 with 1 Axes>
<Figure size 700x500 with 1 Axes>
# =====================================================
# COMPARAÇÕES TEÓRICAS PARA w PEQUENO E w ALTO
# =====================================================

# --- 1. Ajuste da constante C para w pequeno (Eq. 23) ---
# Escolhe um ponto na região de w pequeno (ex: w ≈ 0.2)
w_ref_small = 0.2
idx_small = np.argmin(np.abs(w - w_ref_small))
C_small = P[idx_small] * (w_ref_small ** (2*(chi+1))) * np.exp(2*chi / w_ref_small)

# Gera a curva teórica para w pequeno
w_teo_small = np.linspace(w_start, 0.5, 200)  # até w=1 para ver a transição
P_teo_small = C_small * w_teo_small ** (-2*(chi+1)) * np.exp(-2*chi / w_teo_small)

# --- 2. Ajuste da constante C para w alto (Gaussiana centrada em w=1) ---
B_inf = B[-1]   # Agora SEM fator empírico!

# Escolhe um ponto na região da cauda (ex: w ≈ 4) para ajustar a constante
w_ref_high = 4.0
idx_high = np.argmin(np.abs(w - w_ref_high))
# Usando a fórmula correta: P = C * exp( chi*(2w - w^2) / (2*B_inf) )
C_high = P[idx_high] / np.exp(chi * (2*w_ref_high - w_ref_high**2) / (2 * B_inf))

# Gera a curva teórica para w alto
w_teo_high = np.linspace(2, 8, 300)
P_teo_high = C_high * np.exp(chi * (2*w_teo_high - w_teo_high**2) / (2 * B_inf))
# Forma equivalente (centrada em 1):
# P_teo_high = C_high * np.exp(-chi * (w_teo_high - 1)**2 / (2 * B_inf))

# --- 3. Gráficos de comparação ---


# (b) Comparação para w alto (log-log)
plt.figure(figsize=(7,5))
plt.loglog(w[mask_for_log_plots], P[mask_for_log_plots], label='Numérico (Eq. 21)')
plt.loglog(w_teo_high, P_teo_high, 'g--', linewidth=2, label=rf'Gaussiana: $\exp(-{chi:.1f} w^2 / (2 B_\infty))$')
plt.xlim(1, 6)
plt.ylim(1E-14, 1)
plt.xlabel('w')
plt.ylabel('P(w)')
plt.title('Comparação para w alto (cauda Gaussiana)')
plt.legend()
plt.grid(True, which='both', linestyle='--')

# (c) Comparação dupla (apenas para visualização geral)
plt.figure(figsize=(7,5))
plt.loglog(w[mask_for_log_plots], P[mask_for_log_plots], label='Numérico (Eq. 21)')
plt.loglog(w_teo_small, P_teo_small, 'r--', label='Eq. 23 (w pequeno)')
plt.loglog(w_teo_high, P_teo_high, 'g--', label='Gaussiana (w alto)')
plt.xlim(0.1, 6)
plt.ylim(5E-15, 2)
plt.xlabel('w')
plt.ylabel('P(w)')
plt.title('Comparação geral com as assíntotas')
plt.legend()
plt.grid(True, which='both', linestyle='--')
plt.show()

# (a) Comparação para w pequeno (log-log)
plt.figure(figsize=(7,5))
plt.loglog(w[mask_for_log_plots], P[mask_for_log_plots], label='Numérico (Eq. 21)')
plt.loglog(w_teo_small, P_teo_small, 'r--', linewidth=2, label=f'Eq. 23: $w^{{-{2*(chi+1)}}} e^{{-2chi/w}}$')
plt.xlim(w_start, 1.0)
plt.xlabel('w')
plt.ylabel('P(w)')
plt.title('Comparação para w pequeno')
plt.legend()
plt.grid(True, which='both', linestyle='--')
<Figure size 700x500 with 1 Axes>
<Figure size 700x500 with 1 Axes>
<Figure size 700x500 with 1 Axes>

Translated with the help of GPT.