code: def _cubicmin(a, fa, fpa, b, fb, c, fc):
      # finds the minimizer for a cubic polynomial that goes through the
      #  points (a,fa), (b,fb), and (c,fc) with derivative at a of fpa.
      #
      # if no minimizer can be found return None
      #
      # f(x) = A *(x-a)^3 + B*(x-a)^2 + C*(x-a) + D
  
      C = fpa
      D = fa
      db = b - a
      dc = c - a
      if (db == 0) or (dc == 0) or (b == c):
          return None
      denom = (db * dc) ** 2 * (db - dc)
      d1 = empty((2, 2))
      d1[0, 0] = dc**2
      d1[0, 1] = -(db**2)
      d1[1, 0] = -(dc**3)
      d1[1, 1] = db**3
      [A, B] = numpy.dot(
          d1, asarray([fb - fa - C * db, fc - fa - C * dc]).flatten()
      )
      A /= denom
      B /= denom
      radical = B * B - 3 * A * C
      if radical < 0:
          return None
      if A == 0:
          return None
      xmin = a + (-B + sqrt(radical)) / (3 * A)
      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 10 for calling a global function with example usage: _cubicmin(a, fa, fpa, b, fb, c, fc) and returns: xmin, None, None, None