- class sympy.physics.mechanics.linearize.Linearizer(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, linear_solver='LU')#
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 [R702].
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.
(Matrix) Matrices of the independent generalized coordinates and speeds.
(Matrix) Matrices of the dependent generalized coordinates and speeds.
(Matrix) Permutation matrix such that [q_ind, u_ind]^T = perm_mat*[q, u]^T
- __init__(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, linear_solver='LU')#
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 does not 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
linear_solver : str, callable
Method used to solve the several symbolic linear systems of the form
A*x=bin the linearization process. If a string is supplied, it should be a valid method that can be used with the
sympy.matrices.matrices.MatrixBase.solve(). If a callable is supplied, it should have the format
x = f(A, b), where it solves the equations and returns the solution. The default is
'LU'which corresponds to SymPy’s
LUsolve()is fast to compute but will often result in divide-by-zero and thus
- linearize(op_point=None, A_and_B=False, simplify=False)#
Linearize the system about the operating point. Note that q_op, u_op, qd_op, ud_op must satisfy the equations of motion. These may be either symbolic or numeric.
op_point : dict or iterable of dicts, optional
Dictionary or iterable of dictionaries containing the operating point conditions for all or a subset of the generalized coordinates, generalized speeds, and time derivatives of the generalized speeds. These will be substituted into the linearized system before the linearization is complete. Leave set to
Noneif you want the operating point to be an arbitrary set of symbols. Note that any reduction in symbols (whether substituted for numbers or expressions with a common parameter) will result in faster runtime.
A_and_B : bool, optional
If A_and_B=False (default), (M, A, B) is returned and of A_and_B=True, (A, B) is returned. See below.
simplify : bool, optional
Determines if returned values are simplified before return. For large expressions this may be time consuming. Default is False.
M, A, B : Matrices,
- Matrices from the implicit form:
[M]*[q', u']^T = [A]*[q_ind, u_ind]^T + [B]*r
A, B : Matrices,
- Matrices from the explicit form:
[q_ind', u_ind']^T = [A]*[q_ind, u_ind]^T + [B]*r
Note that the process of solving with A_and_B=True is computationally intensive if there are many symbolic parameters. For this reason, it may be more desirable to use the default A_and_B=False, returning M, A, and B. More values may then be substituted in to these matrices later on. The state space form can then be found as A = P.T*M.LUsolve(A), B = P.T*M.LUsolve(B), where P = Linearizer.perm_mat.