code: def test_find_dynamicsymbols():
      a, b = symbols("a, b")
      x, y, z = dynamicsymbols("x, y, z")
      expr = Matrix(
          [
              [a * x + b, x * y.diff() + y],
              [x.diff().diff(), z + sin(z.diff())],
          ]
      )
      # Test finding all dynamicsymbols
      sol = {x, y.diff(), y, x.diff().diff(), z, z.diff()}
      assert find_dynamicsymbols(expr) == sol
      # Test finding all but those in sym_list
      exclude_list = [x, y, z]
      sol = {y.diff(), x.diff().diff(), z.diff()}
      assert find_dynamicsymbols(expr, exclude=exclude_list) == sol
      # Test finding all dynamicsymbols in a vector with a given reference frame
      d, e, f = dynamicsymbols("d, e, f")
      A = ReferenceFrame("A")
      v = d * A.x + e * A.y + f * A.z
      sol = {d, e, f}
      assert find_dynamicsymbols(v, reference_frame=A) == sol
      # Test if a ValueError is raised on supplying only a vector as input
      raises(ValueError, lambda: find_dynamicsymbols(v))
  
file_path: sympy/sympy/physics/mechanics/tests/test_functions.py
imports: from sympy import sin, cos, tan, pi, symbols, Matrix, S, Function
  from sympy.physics.mechanics import Particle, Point, ReferenceFrame, RigidBody
  from sympy.physics.mechanics import angular_momentum, dynamicsymbols, kinetic_energy, linear_momentum, outer, potential_energy, msubs, find_dynamicsymbols, Lagrangian
  from sympy.physics.mechanics.functions import center_of_mass, _validate_coordinates, _parse_linear_solver
  from sympy.testing.pytest import raises, warns_deprecated_sympy
label_desc: Use image node_id 7 for calling a global function with example usage: test_find_dynamicsymbols() without return types