The directivity is defined as
\[D(\theta,\psi) = \frac{p(r,\theta,\psi)}{p(r,\theta_m,\psi_m)} = \frac{\hat{u}(k\alpha,k\beta)}{\hat{u}(0,0)},\]
where \(\theta_m\) and \(\psi_m\) are the polar and azimuthal angles corresponding the direction of the beam's maximum. Note that \(\alpha = \sin \theta \cos\psi\) and \(\beta = \sin\theta\sin\psi\). The \(z\) axis is aligned such that \(\theta_m =0\).
The directivity factor is
\[D_i = \frac{\langle I_\text{max} \rangle }{\langle I_\text{mono} \rangle},\]
where \(\langle I_\text{max} \rangle \) is the maximum intensity in the beam (along the \(z\) axis) and \(\langle I_\text{mono} \rangle \) is the intensity at the same distance due to a monopole radiating the same power \(W\).
The directivity index is simply \(\text{DI} = 10 \log_{10} D_i\) (dB).