docstr: Asserts that interpolation of 4th order polynomial is exact.
docstr_tok: ["Asserts","that","interpolation","of","4th","order","polynomial","is","exact","."]
code: def test_polynomial_fit(self, dtype):
      """Asserts that interpolation of 4th order polynomial is exact."""
      coefficients = [
          1 + 2j,
          0.3 - 1j,
          3.5 - 3.7j,
          0.5 - 0.1j,
          0.1 + 0.1j,
      ]
      coefficients = [tf.cast(c, dtype) for c in coefficients]
  
      def f(x):
          components = []
          for power, c in enumerate(reversed(coefficients)):
              components.append(c * x**power)
          return tf.add_n(components)
  
      def f_prime(x):
          components = []
          for power, c in enumerate(reversed(coefficients[:-1])):
              components.append(c * x ** (power) * (power + 1))
          return tf.add_n(components)
  
      coeffs = rk_util._fourth_order_interpolation_coefficients(
          f(0.0), f(10.0), f(5.0), f_prime(0.0), f_prime(10.0), 10.0
      )
      times = np.linspace(0, 10, dtype=np.float32)
      y_fit = tf.stack(
          [
              rk_util.evaluate_interpolation(coeffs, 0.0, 10.0, t)
              for t in times
          ]
      )
      y_expected = f(times)
      self.assertAllClose(y_fit, y_expected)
  
file_path: probability/tensorflow_probability/python/math/ode/runge_kutta_util_test.py
imports: from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math.ode import runge_kutta_util
label_desc: Use image node_id 1 for calling the RungeKuttaUtilTest obj's underlying member method code with example usage: obj.test_polynomial_fit(dtype) and returns: tf, tf