docstr: Tests comparing PDEs with expanded derivatives and without.
  
  The equation is
  `u_{t} + [x u]_{x} + [y^2 u]_{y} - [sin(x) u]_{xx} - [cos(y) u]_yy
   + [x^3 y^2 u]_{xy} = 0`.
  Solve the equation, expand the derivatives and solve the equation again.
  Expect the results to be equal.
docstr_tok: ["Tests","comparing","PDEs","with","expanded","derivatives","and","without",".","The","equation","is","`","u_","{","t","}","+","[","x","u","]","_","{","x","}","+","[","y^2","u","]","_","{","y","}","-","[","sin","(","x",")","u","]","_","{","xx","}","-","[","cos","(","y",")","u","]","_yy","+","[","x^3","y^2","u","]","_","{","xy","}","=","0","`",".","Solve","the","equation",",","expand","the","derivatives","and","solve","the","equation","again",".","Expect","the","results","to","be","equal","."]
code: def testCompareExpandedAndNotExpandedPdes(self):
      """Tests comparing PDEs with expanded derivatives and without.
  
      The equation is
      `u_{t} + [x u]_{x} + [y^2 u]_{y} - [sin(x) u]_{xx} - [cos(y) u]_yy
       + [x^3 y^2 u]_{xy} = 0`.
      Solve the equation, expand the derivatives and solve the equation again.
      Expect the results to be equal.
      """
      grid = grids.uniform_grid(
          minimums=[0, 0],
          maximums=[1, 1],
          sizes=[201, 251],
          dtype=tf.float32,
      )
  
      final_t = 0.1
      time_step = 0.002
      y, x = grid
  
      initial = _reference_2d_pde_initial_cond(x, y)  # arbitrary
  
      def inner_second_order_coeff_fn(t, coord_grid):
          del t
          y, x = tf.meshgrid(*coord_grid, indexing="ij")
          return [
              [-tf.math.cos(y), x**3 * y**2 / 2],
              [None, -tf.math.sin(x)],
          ]
  
      def inner_first_order_coeff_fn(t, coord_grid):
          del t
          y, x = tf.meshgrid(*coord_grid, indexing="ij")
          return [y**2, 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
          y, x = tf.meshgrid(*coord_grid, indexing="ij")
          return [
              [-tf.math.cos(y), x**3 * y**2 / 2],
              [None, -tf.math.sin(x)],
          ]
  
      def first_order_coeff_fn(t, coord_grid):
          del t
          y, x = tf.meshgrid(*coord_grid, indexing="ij")
          return [
              y**2 * (1 + 3 * x**2) + 2 * tf.math.sin(y),
              x * (1 + 2 * x**2 * y) - 2 * tf.math.cos(x),
          ]
  
      def zeroth_order_coeff_fn(t, coord_grid):
          del t
          y, x = tf.meshgrid(*coord_grid, indexing="ij")
          return (
              1
              + 2 * y
              + tf.math.sin(x)
              + tf.math.cos(x)
              + 6 * x**2 * y
          )
  
      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: 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 24 for calling the MultidimParabolicEquationStepperTest obj's underlying member method code with example usage: obj.testCompareExpandedAndNotExpandedPdes() and returns: list, list, list, list, unknown