docs: def experiment(qnum, repetitions=100):
      """Execute the phase estimator cirquit with multiple settings and
      show results.
      """
  
      def example_gate(phi):
          """An example unitary 1-qubit gate U with an eigen vector |0> and an
          eigen value exp(2*Pi*i*phi)
          """
  
          gate = cirq.SingleQubitMatrixGate(
              matrix=np.array([[np.exp(2*np.pi*1.0j*phi), 0], [0, 1]]))
          return gate
  
      print('Estimation with {}qubits.'.format(qnum))
      print('Actual, Estimation (Raw binary)')
      errors = []
      fold_func = lambda ms: ''.join(np.flip(ms, 0).astype(int).astype(str))
      for phi in np.arange(0, 1, 0.1):
          result = run_estimate(example_gate(phi), qnum, repetitions)
          hist = result.histogram(key='phase', fold_func=fold_func)
          estimate_bin = hist.most_common(1)[0][0]
          estimate = (sum([float(s)*0.5**(order+1)
                           for order, s in enumerate(estimate_bin)]))
          print('{:0.4f}, {:0.4f} ({})'.format(phi, estimate, estimate_bin))
          errors.append((phi-estimate)**2)
      print('RMS Error: {:0.4f}\n'.format(np.sqrt(sum(errors)/len(errors))))