class_docstr: This object holds the general model form for a dynamic system. This
  model is used for computing the linearized form of the system, while
  properly dealing with constraints leading to  dependent coordinates and
  speeds. The notation and method is described in [1]_.
  
  Attributes
  ==========
  
  f_0, f_1, f_2, f_3, f_4, f_c, f_v, f_a : Matrix
      Matrices holding the general system form.
  q, u, r : Matrix
      Matrices holding the generalized coordinates, speeds, and
      input vectors.
  q_i, u_i : Matrix
      Matrices of the independent generalized coordinates and speeds.
  q_d, u_d : Matrix
      Matrices of the dependent generalized coordinates and speeds.
  perm_mat : Matrix
      Permutation matrix such that [q_ind, u_ind]^T = perm_mat*[q, u]^T
  
  References
  ==========
  
  .. [1] D. L. Peterson, G. Gede, and M. Hubbard, "Symbolic linearization of
         equations of motion of constrained multibody systems," Multibody
         Syst Dyn, vol. 33, no. 2, pp. 143-161, Feb. 2015, doi:
         10.1007/s11044-014-9436-5.
class_docstr_tok: ["This","object","holds","the","general","model","form","for","a","dynamic","system",".","This","model","is","used","for","computing","the","linearized","form","of","the","system",",","while","properly","dealing","with","constraints","leading","to","dependent","coordinates","and","speeds",".","The","notation","and","method","is","described","in","[","1","]","_",".","Attributes","==========","f_0",",","f_1",",","f_2",",","f_3",",","f_4",",","f_c",",","f_v",",","f_a",":","Matrix","Matrices","holding","the","general","system","form",".","q",",","u",",","r",":","Matrix","Matrices","holding","the","generalized","coordinates",",","speeds",",","and","input","vectors",".","q_i",",","u_i",":","Matrix","Matrices","of","the","independent","generalized","coordinates","and","speeds",".","q_d",",","u_d",":","Matrix","Matrices","of","the","dependent","generalized","coordinates","and","speeds",".","perm_mat",":","Matrix","Permutation","matrix","such","that","[","q_ind",",","u_ind","]","^T","=","perm_mat","*","[","q",",","u","]","^T","References","==========","..","[","1","]","D.","L.","Peterson",",","G.","Gede",",","and","M.","Hubbard",",","``","Symbolic","linearization","of","equations","of","motion","of","constrained","multibody","systems",",","''","Multibody","Syst","Dyn",",","vol",".","33",",","no",".","2",",","pp",".","143-161",",","Feb.","2015",",","doi",":","10.1007\/s11044-014-9436-5","."]
docstr: Form the block matrices for composing M, A, and B.
docstr_tok: ["Form","the","block","matrices","for","composing","M",",","A",",","and","B","."]
code: def _form_block_matrices(self):
      """Form the block matrices for composing M, A, and B."""
  
      # Extract dimension variables
      l, m, n, o, s, k = self._dims
      # Block Matrix Definitions. These are only defined if under certain
      # conditions. If undefined, an empty matrix is used instead
      if n != 0:
          self._M_qq = self.f_0.jacobian(self._qd)
          self._A_qq = -(self.f_0 + self.f_1).jacobian(self.q)
      else:
          self._M_qq = Matrix()
          self._A_qq = Matrix()
      if n != 0 and m != 0:
          self._M_uqc = self.f_a.jacobian(self._qd_dup)
          self._A_uqc = -self.f_a.jacobian(self.q)
      else:
          self._M_uqc = Matrix()
          self._A_uqc = Matrix()
      if n != 0 and o - m + k != 0:
          self._M_uqd = self.f_3.jacobian(self._qd_dup)
          self._A_uqd = -(self.f_2 + self.f_3 + self.f_4).jacobian(
              self.q
          )
      else:
          self._M_uqd = Matrix()
          self._A_uqd = Matrix()
      if o != 0 and m != 0:
          self._M_uuc = self.f_a.jacobian(self._ud)
          self._A_uuc = -self.f_a.jacobian(self.u)
      else:
          self._M_uuc = Matrix()
          self._A_uuc = Matrix()
      if o != 0 and o - m + k != 0:
          self._M_uud = self.f_2.jacobian(self._ud)
          self._A_uud = -(self.f_2 + self.f_3).jacobian(self.u)
      else:
          self._M_uud = Matrix()
          self._A_uud = Matrix()
      if o != 0 and n != 0:
          self._A_qu = -self.f_1.jacobian(self.u)
      else:
          self._A_qu = Matrix()
      if k != 0 and o - m + k != 0:
          self._M_uld = self.f_4.jacobian(self.lams)
      else:
          self._M_uld = Matrix()
      if s != 0 and o - m + k != 0:
          self._B_u = -self.f_3.jacobian(self.r)
      else:
          self._B_u = Matrix()
  
file_path: sympy/sympy/physics/mechanics/linearize.py
imports: from sympy import Matrix, eye, zeros
  from sympy.core.symbol import Dummy
  from sympy.utilities.iterables import flatten
  from sympy.physics.vector import dynamicsymbols
  from sympy.physics.mechanics.functions import msubs, _parse_linear_solver
  from collections import namedtuple
  from collections.abc import Iterable
label_desc: Use image node_id 5 for calling the Linearizer obj's underlying member method code with example usage: obj._form_block_matrices() without return types