code: def golden(func, args=(), brack=None, tol=_epsilon, full_output=0):
      """Given a function of one-variable and a possible bracketing interval,
      return the minimum of the function isolated to a fractional precision of
      tol.
  
      :Parameters:
  
      func - objective function
      args - additional arguments (if present)
      brack : a triple (a,b,c) where (a<b<c) and
          func(b) < func(a),func(c).  If bracket is two numbers (a, c) then they are
          assumed to be a starting interval for a downhill bracket search
          (see bracket); it doesn't always mean that obtained solution will satisfy a<=x<=c
      tol : number
          x tolerance stop criterion
      full_output : number
          0 for false
          1 for true
  
      :SeeAlso:
  
        fmin, fmin_powell, fmin_cg,
               fmin_bfgs, fmin_ncg -- multivariate local optimizers
        leastsq -- nonlinear least squares minimizer
  
        fmin_l_bfgs_b, fmin_tnc,
               fmin_cobyla -- constrained multivariate optimizers
  
        anneal, brute -- global optimizers
  
        fminbound, brent, golden, bracket -- local scalar minimizers
  
        fsolve -- n-dimenstional root-finding
  
        brentq, brenth, ridder, bisect, newton -- one-dimensional root-finding
  
        fixed_point -- scalar fixed-point finder
  
      Notes
  
      ---------------------------------------
  
      Uses analog of bisection method to decrease the bracketed interval.
      """
      if brack is None:
          xa, xb, xc, fa, fb, fc, funcalls = bracket(func, args=args)
      elif len(brack) == 2:
          xa, xb, xc, fa, fb, fc, funcalls = bracket(
              func, xa=brack[0], xb=brack[1], args=args
          )
      elif len(brack) == 3:
          xa, xb, xc = brack
          if xa > xc:  # swap so xa < xc can be assumed
              dum = xa
              xa = xc
              xc = dum
          assert (xa < xb) and (xb < xc), "Not a bracketing interval."
          fa = func(*((xa,) + args))
          fb = func(*((xb,) + args))
          fc = func(*((xc,) + args))
          assert (fb < fa) and (fb < fc), "Not a bracketing interval."
          funcalls = 3
      else:
          raise ValueError(
              "Bracketing interval must be length 2 or 3 sequence."
          )
  
      _gR = 0.61803399
      _gC = 1.0 - _gR
      x3 = xc
      x0 = xa
      if abs(xc - xb) > abs(xb - xa):
          x1 = xb
          x2 = xb + _gC * (xc - xb)
      else:
          x2 = xb
          x1 = xb - _gC * (xb - xa)
      f1 = func(*((x1,) + args))
      f2 = func(*((x2,) + args))
      funcalls += 2
      while abs(x3 - x0) > tol * (abs(x1) + abs(x2)):
          if f2 < f1:
              x0 = x1
              x1 = x2
              x2 = _gR * x1 + _gC * x3
              f1 = f2
              f2 = func(*((x2,) + args))
          else:
              x3 = x2
              x2 = x1
              x1 = _gR * x2 + _gC * x0
              f2 = f1
              f1 = func(*((x1,) + args))
          funcalls += 1
      if f1 < f2:
          xmin = x1
          fval = f1
      else:
          xmin = x2
          fval = f2
      if full_output:
          return xmin, fval, funcalls
      else:
          return xmin
  
imports: import numpy
  from numpy import atleast_1d, eye, mgrid, argmin, zeros, shape, empty, squeeze, isscalar, vectorize, asarray, absolute, sqrt, Inf, asfarray, isinf
  from mystic import linesearch
  from collections.abc import Callable
  import builtins
label_desc: Use image node_id 23 for calling a global function with example usage: golden(func, args, brack, tol, full_output) and returns: xmin,  fval,  funcalls, xmin