code: def _get_forward_diffs(fun, n):
      """Computes up to nth order forward difference evaluated at 0.
  
      See Theorem 27 of https://arxiv.org/pdf/1808.00087.pdf
  
      Args:
        fun: Function to compute forward differences of.
        n: Number of differences to compute.
  
      Returns:
        Pair (deltas, signs_deltas) of the log deltas and their signs.
      """
      func_vec = np.zeros(n + 3)
      signs_func_vec = np.ones(n + 3, dtype=bool)
  
      # ith coordinate of deltas stores log(abs(ith order discrete derivative))
      deltas = np.zeros(n + 2)
      signs_deltas = np.zeros(n + 2, dtype=bool)
      for i in range(1, n + 3, 1):
          func_vec[i] = fun(1.0 * (i - 1))
      for i in range(0, n + 2, 1):
          # Diff in log scale
          _stable_inplace_diff_in_log(
              func_vec, signs_func_vec, n=n + 2 - i
          )
          deltas[i] = func_vec[0]
          signs_deltas[i] = signs_func_vec[0]
      return deltas, signs_deltas
  
imports: import math
  from typing import Tuple, Union
  import numpy
  from scipy import special
  import six
label_desc: Use image node_id 12 for calling a global function with example usage: _get_forward_diffs(fun, n) and returns: deltas,  signs_deltas