#### Previous topic

scipy.special.entr

#### Next topic

scipy.special.kl_div

# scipy.special.rel_entr

`scipy.special.``rel_entr`(x, y) = <ufunc 'rel_entr'>

  Elementwise function for computing relative entropy.

  \[\begin{split}\mathrm{rel\_entr}(x, y) = \begin{cases} x \log(x / y) & x > 0, y > 0 \\ 0 & x = 0, y \ge 0 \\ \infty & \text{otherwise} \end{cases}\end{split}\]

  Parameters: | x : ndarray First input array. y : ndarray Second input array.
  Returns: | res : ndarray Output array.

  See also

  `entr`, `kl_div`

  Notes

  This function is jointly convex in x and y.

  New in version 0.15.0.