code: def minimize_quadratic_1d(a, b, lb, ub, c=0):
      """Minimize a 1-D quadratic function subject to bounds.
  
      The free term `c` is 0 by default. Bounds must be finite.
  
      Returns
      -------
      t : float
          Minimum point.
      y : float
          Minimum value.
      """
      t = [lb, ub]
      if a != 0:
          extremum = -0.5 * b / a
          if lb < extremum < ub:
              t.append(extremum)
      t = np.asarray(t)
      y = t * (a * t + b) + c
      min_index = np.argmin(y)
      return t[min_index], y[min_index]
  
imports: from math import copysign
  import numpy
  from numpy.linalg import norm
  from scipy.linalg import cho_factor, cho_solve, LinAlgError
  from scipy.sparse import issparse
  from scipy.sparse.linalg import LinearOperator, aslinearoperator
label_desc: Use image node_id 6 for calling a global function with example usage: minimize_quadratic_1d(a, b, lb, ub, c) and returns: t,  y