'Returns an instance of the Linearizer class, initiated from the
data in the LagrangesMethod class. This may be more desirable than using
the linearize class method, as the Linearizer object will allow more
efficient recalculation (i.e. about varying operating points).
Parameters
q_ind, qd_ind : array_like, optional
The independent generalized coordinates and speeds.
q_dep, qd_dep : array_like, optional
The dependent generalized coordinates and speeds.'

def to_linearizer(self, q_ind=None, qd_ind=None, q_dep=None, qd_dep=None):

    t = dynamicsymbols._t
    q = self.q
    u = self._qdots
    ud = u.diff(t)
    lams = self.lam_vec
    mat_build = (lambda x: (Matrix(x) if x else Matrix()))
    q_i = mat_build(q_ind)
    q_d = mat_build(q_dep)
    u_i = mat_build(qd_ind)
    u_d = mat_build(qd_dep)
    f_c = self._hol_coneqs
    f_v = self.coneqs
    f_a = f_v.diff(t)
    f_0 = u
    f_1 = (- u)
    f_2 = self._term1
    f_3 = (- (self._term2 + self._term4))
    f_4 = (- self._term3)
    if ((len(q_d) != len(f_c)) or (len(u_d) != len(f_v))):
        raise ValueError(('Must    supply    {:}    dependent    coordinates,    and    ' + '{:}    dependent    speeds').format(len(f_c), len(f_v)))
    if (set(Matrix([q_i, q_d])) != set(q)):
        raise ValueError(('Must    partition    q    into    q_ind    and    q_dep,    with    ' + 'no    extra    or    missing    symbols.'))
    if (set(Matrix([u_i, u_d])) != set(u)):
        raise ValueError(('Must    partition    qd    into    qd_ind    and    qd_dep,    ' + 'with    no    extra    or    missing    symbols.'))
    insyms = set(Matrix([q, u, ud, lams]))
    r = list(find_dynamicsymbols(f_3, insyms))
    r.sort(key=default_sort_key)
    for i in r:
        if (diff(i, dynamicsymbols._t) in r):
            raise ValueError('Cannot    have    derivatives    of    specified                                                                                                                                        quantities    when    linearizing    forcing    terms.')
    return Linearizer(f_0, f_1, f_2, f_3, f_4, f_c, f_v, f_a, q, u, q_i, q_d, u_i, u_d, r, lams)
