code: def polynomial_norm(coeffs):
      r
      num_coeffs, = coeffs.shape
      result = 0.0
      for i in six.moves.xrange(num_coeffs):
          coeff_i = coeffs[i]
          result += coeff_i * coeff_i / (2.0 * i + 1.0)
          for j in six.moves.xrange(i + 1, num_coeffs):
              coeff_j = coeffs[j]
              result += 2.0 * coeff_i * coeff_j / (i + j + 1.0)
      return np.sqrt(result)
docs: r"""Computes :math:`L_2` norm of polynomial on :math:`\left[0, 1\right]`.
  
      We have
  
      .. math::
  
         \left\langle f, f \right\rangle = \sum_{i, j}
             \int_0^1 c_i c_j x^{i + j} \, dx = \sum_{i, j}
             \frac{c_i c_j}{i + j + 1} = \sum_{i} \frac{c_i^2}{2 i + 1}
             + 2 \sum_{j > i} \frac{c_i c_j}{i + j + 1}.
  
      Args:
          coeffs (numpy.ndarray): ``d + 1``-array of coefficients in monomial /
              power basis.
  
      Returns:
          float: The :math:`L_2` norm of the polynomial.