docs: def ket(i, Ne):
      r"""This function returns the i-th element of the canonical basis
      of a Hilbert space of dimension Ne (in the form of a column vector).
  
      >>> ket(2,4)
      Matrix([
      [0],
      [1],
      [0],
      [0]])
  
      This will return an error if i is not in [1 .. Ne]:
  
      >>> ket(5,3)
      Traceback (most recent call last):
      ...
      ValueError: i must be in [1 .. Ne].
  
      """
      if i not in range(1, Ne+1):
          raise ValueError("i must be in [1 .. Ne].")
      return Matrix([KroneckerDelta(i-1, j) for j in range(Ne)])