code: def derivs(t, state):
      dydx = np.zeros_like(state)
  
      dydx[0] = state[1]
  
      delta = state[2] - state[0]
      den1 = (M1 + M2) * L1 - M2 * L1 * cos(delta) * cos(delta)
      dydx[1] = (
          M2 * L1 * state[1] * state[1] * sin(delta) * cos(delta)
          + M2 * G * sin(state[2]) * cos(delta)
          + M2 * L2 * state[3] * state[3] * sin(delta)
          - (M1 + M2) * G * sin(state[0])
      ) / den1
  
      dydx[2] = state[3]
  
      den2 = (L2 / L1) * den1
      dydx[3] = (
          -M2 * L2 * state[3] * state[3] * sin(delta) * cos(delta)
          + (M1 + M2) * G * sin(state[0]) * cos(delta)
          - (M1 + M2) * L1 * state[1] * state[1] * sin(delta)
          - (M1 + M2) * G * sin(state[2])
      ) / den2
  
      return dydx
  
imports: import matplotlib.pyplot
  import numpy
  from numpy import cos, sin
  import matplotlib.animation
label_desc: Use image node_id 1 for calling a global function with example usage: derivs(t, state) and returns: dydx