docstr: Tests the equation used as reference for a few further tests.
  
  We solve the heat equation `u_t = u_xx + u_yy` on x = [0...1], y = [0...1]
  with boundary conditions `u(x, y, t=0) = (1/2 - |x-1/2|)(1/2-|y-1/2|), and
  zero Dirichlet on all spatial boundaries.
  
  The exact solution of the diffusion equation with zero-Dirichlet rectangular
  boundaries is `u(x, y, t) = u(x, t) * u(y, t)`,
  `u(z, t) = sum_{n=1..inf} b_n sin(pi n z) exp(-n^2 pi^2 t)`,
  `b_n = 2 integral_{0..1} sin(pi n z) u(z, t=0) dz.`
  
  The initial conditions are taken so that the integral easily calculates, and
  the sum can be approximated by a few first terms (given large enough `t`).
  See the result in _reference_heat_equation_solution.
  
  Using this solution helps to simplify the tests, as we don't have to
  maintain complicated boundary conditions in each test or tweak the
  parameters to keep the "support" of the function far from boundaries.
docstr_tok: ["Tests","the","equation","used","as","reference","for","a","few","further","tests",".","We","solve","the","heat","equation","`","u_t","=","u_xx","+","u_yy","`","on","x","=","[","0","...","1","]",",","y","=","[","0","...","1","]","with","boundary","conditions","`","u","(","x",",","y",",","t=0",")","=","(","1\/2","-","|x-1\/2|",")","(","1\/2-|y-1\/2|",")",",","and","zero","Dirichlet","on","all","spatial","boundaries",".","The","exact","solution","of","the","diffusion","equation","with","zero-Dirichlet","rectangular","boundaries","is","`","u","(","x",",","y",",","t",")","=","u","(","x",",","t",")","*","u","(","y",",","t",")","`",",","`","u","(","z",",","t",")","=","sum_","{","n=1","..","inf","}","b_n","sin","(","pi","n","z",")","exp","(","-n^2","pi^2","t",")","`",",","`","b_n","=","2","integral_","{","0","..","1","}","sin","(","pi","n","z",")","u","(","z",",","t=0",")","dz.","`","The","initial","conditions","are","taken","so","that","the","integral","easily","calculates",",","and","the","sum","can","be","approximated","by","a","few","first","terms","(","given","large","enough","`","t","`",")",".","See","the","result","in","_reference_heat_equation_solution",".","Using","this","solution","helps","to","simplify","the","tests",",","as","we","do","n't","have","to","maintain","complicated","boundary","conditions","in","each","test","or","tweak","the","parameters","to","keep","the","``","support","''","of","the","function","far","from","boundaries","."]
code: def testReferenceEquation(self):
      """Tests the equation used as reference for a few further tests.
  
      We solve the heat equation `u_t = u_xx + u_yy` on x = [0...1], y = [0...1]
      with boundary conditions `u(x, y, t=0) = (1/2 - |x-1/2|)(1/2-|y-1/2|), and
      zero Dirichlet on all spatial boundaries.
  
      The exact solution of the diffusion equation with zero-Dirichlet rectangular
      boundaries is `u(x, y, t) = u(x, t) * u(y, t)`,
      `u(z, t) = sum_{n=1..inf} b_n sin(pi n z) exp(-n^2 pi^2 t)`,
      `b_n = 2 integral_{0..1} sin(pi n z) u(z, t=0) dz.`
  
      The initial conditions are taken so that the integral easily calculates, and
      the sum can be approximated by a few first terms (given large enough `t`).
      See the result in _reference_heat_equation_solution.
  
      Using this solution helps to simplify the tests, as we don't have to
      maintain complicated boundary conditions in each test or tweak the
      parameters to keep the "support" of the function far from boundaries.
      """
      grid = grids.uniform_grid(
          minimums=[0, 0],
          maximums=[1, 1],
          sizes=[201, 301],
          dtype=tf.float32,
      )
      ys, xs = grid
  
      final_t = 0.1
      time_step = 0.002
  
      def second_order_coeff_fn(t, coord_grid):
          del t, coord_grid
          return [[-1, None], [None, -1]]
  
      initial = _reference_2d_pde_initial_cond(xs, ys)
      expected = _reference_2d_pde_solution(xs, ys, final_t)
      actual = 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,
      )[0]
  
      self.assertAllClose(expected, actual, 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 18 for calling the MultidimParabolicEquationStepperTest obj's underlying member method code with example usage: obj.testReferenceEquation() and returns: list