code: def diff2(self, i, j):
          
  
          old_val = copy(self[j])
  
          if not self.stochastic_indices[i][
                  0] in self.stochastic_indices[j][0].moral_neighbors:
              return 0.
  
          def diff_for_diff(val):
              self[j] = val
              return self.diff(i)
  
          d = derivative(
              func=diff_for_diff,
              x0=old_val,
              dx=self.eps[j],
              n=1,
              order=self.diff_order)
  
          self[j] = old_val
          return d
docs: N.diff2(i,j)
  
          Mixed second derivative. Differentiates wrt both indices.