code: def find_beta_params_dynamic(d, u10):
      """Define auxiliary distribution taking into account
      kinetic energy of a d-dimensional HMC.
      Make exp(-d/2) quantile to be at u=0.1, and 95% quantile at u=0.5.
      """
  
      u50 = (u10 + 1) / 2.0
  
      def minfunc(params):
          """minimization function"""
          alpha, beta = params
          q10 = scipy.special.betainc(alpha, beta, u10)
          q50 = scipy.special.betainc(alpha, beta, u50)
          return (q10 - np.exp(-d / 2)) ** 2 + (q50 - 0.98) ** 2
  
      r = scipy.optimize.minimize(minfunc, [1.0, 10.0])
      alpha, beta = r.x
      print(
          "Auxiliary Beta distribution(alpha=%.1f, beta=%.1f)"
          % (alpha, beta),
          u10,
      )
  
      return alpha, beta
  
imports: import numpy
  import matplotlib.pyplot
  import scipy.special
  import scipy.stats
label_desc: Use image node_id 6 for calling a global function with example usage: find_beta_params_dynamic(d, u10) and returns: alpha,  beta, unknown