code: def internal2external(xi, bounds):
      
  
      xe = np.empty_like(xi)
  
      for i, (v, bound) in enumerate(zip(xi, bounds)):
  
          a = bound[0]  # minimum
          b = bound[1]  # maximum
  
          if a == None and b == None:  # No constraints
              xe[i] = v
  
          elif b == None:  # only min
              xe[i] = a - 1. + np.sqrt(v ** 2. + 1.)
  
          elif a == None:  # only max
              xe[i] = b + 1. - np.sqrt(v ** 2. + 1.)
  
          else:  # both min and max
              xe[i] = a + ((b - a) / 2.) * (np.sin(v) + 1.)
  
      return xe
docs: Convert a series of internal variables to external variables