Figure    10-7.   Simulated   square-root diffusion   at  maturity    (Euler  scheme)
Figure 10-8    then    shows   the first   10  simulated   paths,  illustrating    the resulting   negative,
averagef   drift   (due    to  x 0     >   )   and the convergence to      =   0.02:
In  [ 24 ]: plt.plot(x1[:,  : 10 ], lw=1.5)
plt.xlabel(‘time’)
plt.ylabel(‘index   level’)
plt.grid(True)
Figure    10-8.   Simulated   square-root diffusion   paths   (Euler  scheme)
Let    us  now get more    exact.  Equation    10-6    presents    the exact   discretization  scheme  for the
square-root    diffusion   based   on  the noncentral  chi-square  distribution        with
degrees    of  freedom and noncentrality   parameter   .
Equation   10-6.   Exact   discretization  for square-root diffusion
The    Python  implementation  of  this    discretization  scheme  is  a   bit more    involved    but still
quite  concise: