code: def update(self, z):
          
  
          self.n += 1
          # rename for readability
          n = self.n
          dt = self.dt
          x = self.x
          K = self.K
          y = self.y
  
          if self._order == 0:
              K[0] = 1. / n
              y = z - x
              x[0] += K[0] * y
  
          elif self._order == 1:
              K[0] = 2. * (2*n - 1) / (n*(n + 1))
              K[1] = 6. / (n*(n + 1)*dt)
  
              y = z - x[0] - (dt * x[1])
  
              x[0] += (K[0] * y) + (dt * x[1])
              x[1] += (K[1] * y)
  
          else:
              den = n * (n+1) * (n+2)
              K[0] = 3. * (3*n**2 - 3*n + 2) / den
              K[1] = 18. * (2*n-1) / (den*dt)
              K[2] = 60. / (den*dt**2)
  
              y = z - x[0] - (dt * x[1]) - (0.5 * dt**2 * x[2])
  
              x[0] += (K[0] * y) + (x[1] * dt) + (.5 * dt**2 * x[2])
              x[1] += (K[1] * y) + (x[2] * dt)
              x[2] += (K[2] * y)
          return self.x
docs: Update filter with new measurement `z`
  
          Returns
          -------
  
          x : np.array
              estimate for this time step (same as self.x)