'Parameters
f_0, f_1, f_2, f_3, f_4, f_c, f_v, f_a : array_like
System of equations holding the general system form.
Supply empty array or Matrix if the parameter
doesn\'t exist.
q : array_like
The generalized coordinates.
u : array_like
The generalized speeds
q_i, u_i : array_like, optional
The independent generalized coordinates and speeds.
q_d, u_d : array_like, optional
The dependent generalized coordinates and speeds.
r : array_like, optional
The input variables.
lams : array_like, optional
The lagrange multipliers'

def __init__(self, f_0, f_1, f_2, f_3, f_4, f_c, f_v, f_a, q, u, q_i=None, q_d=None, u_i=None, u_d=None, r=None, lams=None):

    self.f_0 = Matrix(f_0)
    self.f_1 = Matrix(f_1)
    self.f_2 = Matrix(f_2)
    self.f_3 = Matrix(f_3)
    self.f_4 = Matrix(f_4)
    self.f_c = Matrix(f_c)
    self.f_v = Matrix(f_v)
    self.f_a = Matrix(f_a)
    self.q = Matrix(q)
    self.u = Matrix(u)
    none_handler = (lambda x: (Matrix(x) if x else Matrix()))
    self.q_i = none_handler(q_i)
    self.q_d = none_handler(q_d)
    self.u_i = none_handler(u_i)
    self.u_d = none_handler(u_d)
    self.r = none_handler(r)
    self.lams = none_handler(lams)
    self._qd = self.q.diff(dynamicsymbols._t)
    self._ud = self.u.diff(dynamicsymbols._t)
    dup_vars = set(self._qd).intersection(self.u)
    self._qd_dup = Matrix([(var if (var not in dup_vars) else Dummy()) for var in self._qd])
    l = len(self.f_c)
    m = len(self.f_v)
    n = len(self.q)
    o = len(self.u)
    s = len(self.r)
    k = len(self.lams)
    dims = collections.namedtuple('dims', ['l', 'm', 'n', 'o', 's', 'k'])
    self._dims = dims(l, m, n, o, s, k)
    self._setup_done = False
