docstr: Tests comparing PDEs with expanded derivatives and without.
  
  Take equation `u_{t} - [x^2 u]_{xx} + [x u]_{x} = 0`.
  Expanding the derivatives yields `u_{t} - x^2 u_{xx} - 3x u_{x} - u = 0`.
  Solve both equations and expect the results to be equal.
docstr_tok: ["Tests","comparing","PDEs","with","expanded","derivatives","and","without",".","Take","equation","`","u_","{","t","}","-","[","x^2","u","]","_","{","xx","}","+","[","x","u","]","_","{","x","}","=","0","`",".","Expanding","the","derivatives","yields","`","u_","{","t","}","-","x^2","u_","{","xx","}","-","3x","u_","{","x","}","-","u","=","0","`",".","Solve","both","equations","and","expect","the","results","to","be","equal","."]
code: def testCompareExpandedAndNotExpandedPdes(self):
      """Tests comparing PDEs with expanded derivatives and without.
  
      Take equation `u_{t} - [x^2 u]_{xx} + [x u]_{x} = 0`.
      Expanding the derivatives yields `u_{t} - x^2 u_{xx} - 3x u_{x} - u = 0`.
      Solve both equations and expect the results to be equal.
      """
      grid = grids.uniform_grid(
          minimums=[0], maximums=[1], sizes=[501], dtype=tf.float32
      )
      xs = grid[0]
  
      final_t = 0.1
      time_step = 0.001
  
      initial = _reference_pde_initial_cond(xs)  # arbitrary
  
      def inner_second_order_coeff_fn(t, coord_grid):
          del t
          x = coord_grid[0]
          return [[-tf.square(x)]]
  
      def inner_first_order_coeff_fn(t, coord_grid):
          del t
          x = coord_grid[0]
          return [x]
  
      result_not_expanded = fd_solvers.solve_forward(
          start_time=0,
          end_time=final_t,
          coord_grid=grid,
          values_grid=initial,
          time_step=time_step,
          inner_second_order_coeff_fn=inner_second_order_coeff_fn,
          inner_first_order_coeff_fn=inner_first_order_coeff_fn,
      )[0]
  
      def second_order_coeff_fn(t, coord_grid):
          del t
          x = coord_grid[0]
          return [[-tf.square(x)]]
  
      def first_order_coeff_fn(t, coord_grid):
          del t
          x = coord_grid[0]
          return [-3 * x]
  
      def zeroth_order_coeff_fn(t, coord_grid):
          del t, coord_grid
          return -1
  
      result_expanded = fd_solvers.solve_forward(
          start_time=0,
          end_time=final_t,
          coord_grid=grid,
          values_grid=initial,
          time_step=time_step,
          second_order_coeff_fn=second_order_coeff_fn,
          first_order_coeff_fn=first_order_coeff_fn,
          zeroth_order_coeff_fn=zeroth_order_coeff_fn,
      )[0]
  
      self.assertAllClose(
          result_not_expanded, result_expanded, atol=1e-3, rtol=1e-3
      )
  
imports: import math
  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 17 for calling the ParabolicEquationStepperTest obj's underlying member method code with example usage: obj.testCompareExpandedAndNotExpandedPdes() and returns: list, list, list, list, unknown