code: def sample2d(f, x_args):
      r"""
      Samples a 2d function f over specified intervals and returns two
      arrays (X, Y) suitable for plotting with matlab (matplotlib)
      syntax. See examples\mplot2d.py.
  
      f is a function of one variable, such as x**2.
      x_args is an interval given in the form (var, min, max, n)
      """
      try:
          f = sympify(f)
      except SympifyError:
          raise ValueError(
              "f could not be interpreted as a SymPy function"
          )
      try:
          x, x_min, x_max, x_n = x_args
      except (TypeError, IndexError):
          raise ValueError(
              "x_args must be a tuple of the form (var, min, max, n)"
          )
  
      x_l = float(x_max - x_min)
      x_d = x_l / float(x_n)
      X = np.arange(float(x_min), float(x_max) + x_d, x_d)
  
      Y = np.empty(len(X))
      for i in range(len(X)):
          try:
              Y[i] = float(f.subs(x, X[i]))
          except TypeError:
              Y[i] = None
      return X, Y
  
imports: from sympy.core.sympify import sympify, SympifyError
  from sympy.external import import_module
label_desc: Use image node_id 1 for calling a global function with example usage: sample2d(f, x_args) and returns: X,  Y