code: def quadratic_minimizer(
      x_a, y_a, y_prime_a, x_b, y_b, bound_size_ratio=0.1
  ):
      """
      Finds the minimizer for a quadratic polynomial that
      goes through the points (x_a, y_a), (x_b, y_b) with derivative
      at x_a of y_prime_a.
  
      Parameters
      ----------
      x_a : float or tensorflow variable
          Left point ``a`` in the ``x`` axis.
  
      y_a : float or tensorflow variable
          Output from function ``y`` at point ``a``.
  
      y_prime_a : float or tensorflow variable
          Output from function ``y'`` (``y`` derivative) at point ``a``.
  
      x_b : float or tensorflow variable
          Right point ``a`` in the ``x`` axis.
  
      y_b : float or tensorflow variable
          Output from function ``y`` at point ``b``.
  
      bound_size_ratio : float
          Value control acceptable bounds for interpolation. If value
          close to one of the points interpolation result will be ignored.
          The bigger ratio, the more likely to reject interpolation.
          Value needs to be between ``0`` and ``1``. Defaults to ``0.1``.
  
      Returns
      -------
      object
          Tensorfow variable that after evaluation is equal to
          point ``x`` which is minimizer for quadratic function.
      """
  
      if not 0 <= bound_size_ratio < 1:
          raise ValueError(
              "Value ``bound_size_ratio`` need to be a float "
              "between 0 and 1, got {}".format(bound_size_ratio)
          )
  
      # The main formula works for the region [0, a] we need to
      # shift function to the left side and put point ``a``
      # at ``0`` position.
      x_range = x_b - x_a
      coef = (y_b - y_a - y_prime_a * x_range) / (x_range ** asfloat(2))
      minimizer = -y_prime_a / (asfloat(2) * coef) + x_a
      bound_size_ratio = asfloat(bound_size_ratio)
  
      return tf.where(
          sequential_or(
              # Handle bad cases
              tf.equal(x_range, 0),
              coef <= 0,
              tf.is_nan(minimizer),
              tf.greater(minimizer, x_b - bound_size_ratio * x_range),
              tf.less(minimizer, x_a + bound_size_ratio * x_range),
          ),
          x_a + asfloat(0.5) * x_range,
          # Since we shifted function's output to the left, we need to shift
          # the result to the right to make it correct for
          # the specified region. That's why we are adding ``x_a``
          # at the end.
          -y_prime_a / (asfloat(2) * coef) + x_a,
      )
  
file_path: neupy/neupy/algorithms/minsearch/wolfe.py
imports: import tensorflow
  from neupy.utils import asfloat
label_desc: Use image node_id 4 for calling a global function with example usage: quadratic_minimizer(x_a, y_a, y_prime_a, x_b, y_b, bound_size_ratio) and returns: tf