class_docstr: Tests for methods in root_finder_newton module.
class_docstr_tok: ["Tests","for","methods","in","root_finder_newton","module","."]
docstr: Tests that we can determine when max_iterations was too small.
docstr_tok: ["Tests","that","we","can","determine","when","max_iterations","was","too","small","."]
code: def test_too_low_max_iterations(self):
      """Tests that we can determine when max_iterations was too small."""
  
      # Set up the problem of finding the square roots of three numbers.
      constants = np.array([4.0, 9.0, 16.0])
      initial_values = np.ones(len(constants))
  
      def objective_and_gradient(values):
          objective = values**2 - constants
          gradient = 2.0 * values
          return objective, gradient
  
      # Obtain and evaluate a tensor containing the roots.
      _, converged, failed = self.evaluate(
          newton_root(
              objective_and_gradient, initial_values, max_iterations=1
          )
      )
  
      # Reference values - we should neither have converged nor failed.
      converged_bench = np.array([False, False, False])
      failed_bench = np.array([False, False, False])
  
      # Assert that the values we obtained are close to the true values.
      np.testing.assert_array_equal(converged, converged_bench)
      np.testing.assert_array_equal(failed, failed_bench)
  
file_path: tf-quant-finance/tf_quant_finance/math/root_search/newton_test.py
imports: from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  import tf_quant_finance
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 3 for calling the RootFinderNewtonTest obj's underlying member method code with example usage: obj.test_too_low_max_iterations() and returns: objective,  gradient