code: def critical_damping_parameters(theta, order=2):
      r"""Computes values for g and h (and k for g-h-k filter) for a
      critically damped filter.
  
      The idea here is to create a filter that reduces the influence of
      old data as new data comes in. This allows the filter to track a
      moving target better. This goes by different names. It may be called the
      discounted least-squares g-h filter, a fading-memory polynomal filter
      of order 1, or a critically damped g-h filter.
  
      In a normal least-squares filter we compute the error for each point as
  
      .. math::
  
          \epsilon_t = (z-\\hat{x})^2
  
      For a crically damped filter we reduce the influence of each error by
  
       .. math::
  
           \\theta^{t-i}
  
      where
  
       .. math::
  
           0 <= \\theta <= 1
  
      In other words the last error is scaled by theta, the next to last by
      theta squared, the next by theta cubed, and so on.
  
      Parameters
      ----------
  
      theta : float, 0 <= theta <= 1
          scaling factor for previous terms
  
      order : int, 2 (default) or 3
         order of filter to create the parameters for. g and h will be
         calculated for the order 2, and g, h, and k for order 3.
  
      Returns
      -------
      g : scalar
          optimal value for g in the g-h or g-h-k filter
  
      h : scalar
          optimal value for h in the g-h or g-h-k filter
  
      k : scalar
          optimal value for g in the g-h-k filter
  
      Examples
      --------
  
      .. code-block:: Python
  
          from filterpy.gh import GHFilter, critical_damping_parameters
  
          g,h = critical_damping_parameters(0.3)
          critical_filter = GHFilter(0, 0, 1, g, h)
  
      References
      ----------
  
      Brookner, "Tracking and Kalman Filters Made Easy". John Wiley and
      Sons, 1998.
  
      Polge and Bhagavan. "A Study of the g-h-k Tracking Filter".
      Report No. RE-CR-76-1. University of Alabama in Huntsville.
      July, 1975
  
      """
      if theta < 0 or theta > 1:
          raise ValueError("theta must be between 0 and 1")
  
      if order == 2:
          return (1.0 - theta**2, (1.0 - theta) ** 2)
  
      if order == 3:
          return (
              1.0 - theta**3,
              1.5 * (1.0 - theta**2) * (1.0 - theta),
              0.5 * (1 - theta) ** 3,
          )
  
      raise ValueError("bad order specified: {}".format(order))
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import numpy
  from numpy import dot
  from filterpy.common import pretty_str
label_desc: Use image node_id 3 for calling a global function with example usage: critical_damping_parameters(theta, order) and returns: unknown,  unknown, unknown,  unknown,  unknown