code: def test_linearize_pendulum_lagrange_minimal():
      q1 = dynamicsymbols("q1")  # angle of pendulum
      q1d = dynamicsymbols("q1", 1)  # Angular velocity
      L, m, t = symbols("L, m, t")
      g = 9.8
  
      # Compose world frame
      N = ReferenceFrame("N")
      pN = Point("N*")
      pN.set_vel(N, 0)
  
      # A.x is along the pendulum
      A = N.orientnew("A", "axis", [q1, N.z])
      A.set_ang_vel(N, q1d * N.z)
  
      # Locate point P relative to the origin N*
      P = pN.locatenew("P", L * A.x)
      P.v2pt_theory(pN, N, A)
      pP = Particle("pP", P, m)
  
      # Solve for eom with Lagranges method
      Lag = Lagrangian(N, pP)
      LM = LagrangesMethod(
          Lag, [q1], forcelist=[(P, m * g * N.x)], frame=N
      )
      LM.form_lagranges_equations()
  
      # Linearize
      A, B, inp_vec = LM.linearize([q1], [q1d], A_and_B=True)
  
      assert simplify(A) == Matrix([[0, 1], [-9.8 * cos(q1) / L, 0]])
      assert B == Matrix([])
  
      # Check an alternative solver
      A, B, inp_vec = LM.linearize(
          [q1], [q1d], A_and_B=True, linear_solver="GJ"
      )
  
      assert simplify(A) == Matrix([[0, 1], [-9.8 * cos(q1) / L, 0]])
      assert B == Matrix([])
  
file_path: sympy/sympy/physics/mechanics/tests/test_linearize.py
imports: from sympy import symbols, Matrix, cos, sin, atan, sqrt, Rational
  from sympy.core.sympify import sympify
  from sympy.simplify.simplify import simplify
  from sympy.solvers.solvers import solve
  from sympy.physics.mechanics import dynamicsymbols, ReferenceFrame, Point, dot, cross, inertia, KanesMethod, Particle, RigidBody, Lagrangian, LagrangesMethod
  from sympy.testing.pytest import slow
label_desc: Use image node_id 4 for calling a global function with example usage: test_linearize_pendulum_lagrange_minimal() without return types