code: def update(self):
      # approximate physics with verlet integration
  
      now = time.perf_counter()
      if self.lasttime is None:
          dt = 0
      else:
          dt = now - self.lasttime
      self.lasttime = now
  
      # limit amount of work to be done between frames
      if not relax.COMPILED:
          dt = self.maxTimeStep
  
      if self.lastpos is None:
          self.lastpos = self.pos
  
      # remember fixed positions
      fixedpos = self.pos[self.fixed]
  
      while dt > 0:
          dt1 = min(self.maxTimeStep, dt)
          dt -= dt1
  
          # compute motion since last timestep
          dx = self.pos - self.lastpos
          self.lastpos = self.pos
  
          # update positions for gravity and inertia
          acc = np.array([[0, -5]]) * dt1
          inertia = (
              dx * (self.damping ** (dt1 / self.mass))[:, np.newaxis]
          )  # with mass-dependent damping
          self.pos = self.pos + inertia + acc
  
          self.pos[self.fixed] = fixedpos  # fixed point constraint
  
          # correct for link constraints
          self.relax(self.relaxPerStep)
      self.stepped.emit()
  
file_path: pyqtgraph/pyqtgraph/examples/verlet_chain/chain.py
imports: import time
  import numpy
  import pyqtgraph
  from .None import relax
label_desc: Use image node_id 4 for calling the ChainSim obj's underlying member method code with example usage: obj.update() without return types