本文整理汇总了Python中sympy.physics.mechanics.Point.norm方法的典型用法代码示例。如果您正苦于以下问题:Python Point.norm方法的具体用法?Python Point.norm怎么用?Python Point.norm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.physics.mechanics.Point
的用法示例。
在下文中一共展示了Point.norm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: simplify
# 需要导入模块: from sympy.physics.mechanics import Point [as 别名]
# 或者: from sympy.physics.mechanics.Point import norm [as 别名]
t_2i = simplify(three.pos_from(one).express(inertial_frame).to_matrix(inertial_frame))
time = symbols('t')
alpha1, alpha2 = dynamicsymbols('a_1, a_2')
accelerations = [alpha1, alpha2]
thetadot_omega_dict = dict(zip([theta1.diff(time), theta2.diff(time)], [omega1, omega2]))
omegadot_alpha_dict = dict(zip([omega1.diff(time), omega2.diff(time)], [alpha1, alpha2]))
com = (t_1i*one_mass + t_2i*two_mass)/(one_mass+two_mass)
com_dot = com.diff(time).subs(thetadot_omega_dict)
com_ddot = com_dot.diff(time).subs(thetadot_omega_dict).subs(omegadot_alpha_dict).as_mutable()
com_ang_acc_norm = symbols('n_c')
norm_dict = dict(zip([com_ang_acc_norm], [com.norm()**2]))
com_ang_acc = (com.cross(com_ddot)/(com_ang_acc_norm)).as_mutable()
des_com_ang_acc_x, des_com_ang_acc_y, des_com_ang_acc, des_com_lddot = symbols('cddot_x, cddot_y, thetaddot_c, lddot_c')
com_ang_acc[2] = com_ang_acc[2] - des_com_ang_acc
com_ang_acc = simplify(com_ang_acc)
com_ddot_mat = sympify('Matrix([\n[-(l_1*m_1*cos(theta1(t)) + l_1*m_2*cos(theta1(t)) + l_2*m_2*cos(theta1(t) + theta2(t)))/(m_1 + m_2), -l_2*m_2*cos(theta1(t) + theta2(t))/(m_1 + m_2), (l_1*m_1*omega1(t)**2*sin(theta1(t)) + l_1*m_2*omega1(t)**2*sin(theta1(t)) + l_2*m_2*omega1(t)**2*sin(theta1(t) + theta2(t)) + 2*l_2*m_2*omega1(t)*omega2(t)*sin(theta1(t) + theta2(t)) + l_2*m_2*omega2(t)**2*sin(theta1(t) + theta2(t)))/(m_1 + m_2)],\n[-(l_1*m_1*sin(theta1(t)) + l_1*m_2*sin(theta1(t)) + l_2*m_2*sin(theta1(t) + theta2(t)))/(m_1 + m_2), -l_2*m_2*sin(theta1(t) + theta2(t))/(m_1 + m_2), -(l_1*m_1*omega1(t)**2*cos(theta1(t)) + l_1*m_2*omega1(t)**2*cos(theta1(t)) + l_2*m_2*omega1(t)**2*cos(theta1(t) + theta2(t)) + 2*l_2*m_2*omega1(t)*omega2(t)*cos(theta1(t) + theta2(t)) + l_2*m_2*omega2(t)**2*cos(theta1(t) + theta2(t)))/(m_1 + m_2)]])')
alpha_virtual_mat = sympify('Matrix([\n[-l_2*m_2*(l_1*cos(theta2(t)) + l_2)/(l_1**2*m_1 + l_1**2*m_2 + 2*l_1*l_2*m_2*cos(theta2(t)) + l_2**2*m_2), (g*l_1*m_1**2*sin(theta1(t)) + 2*g*l_1*m_1*m_2*sin(theta1(t)) + g*l_1*m_2**2*sin(theta1(t)) + g*l_2*m_1*m_2*sin(theta1(t) + theta2(t)) + g*l_2*m_2**2*sin(theta1(t) + theta2(t)) + 2*l_1*l_2*m_1*m_2*omega1(t)*omega2(t)*sin(theta2(t)) + l_1*l_2*m_1*m_2*omega2(t)**2*sin(theta2(t)) + 2*l_1*l_2*m_2**2*omega1(t)*omega2(t)*sin(theta2(t)) + l_1*l_2*m_2**2*omega2(t)**2*sin(theta2(t)) - l_1*m_1*F_cx(t)*cos(theta1(t)) - l_1*m_1*F_cy(t)*sin(theta1(t)) - l_1*m_2*F_cx(t)*cos(theta1(t)) - l_1*m_2*F_cy(t)*sin(theta1(t)) - l_2*m_2*F_cx(t)*cos(theta1(t) + theta2(t)) - l_2*m_2*F_cy(t)*sin(theta1(t) + theta2(t)))/(l_1**2*m_1**2 + 2*l_1**2*m_1*m_2 + l_1**2*m_2**2 + 2*l_1*l_2*m_1*m_2*cos(theta2(t)) + 2*l_1*l_2*m_2**2*cos(theta2(t)) + l_2**2*m_1*m_2 + l_2**2*m_2**2)],\n[ 1, (g*m_1*sin(theta1(t) + theta2(t)) + g*m_2*sin(theta1(t) + theta2(t)) - l_1*m_1*omega1(t)**2*sin(theta2(t)) - l_1*m_2*omega1(t)**2*sin(theta2(t)) - F_cx(t)*cos(theta1(t) + theta2(t)) - F_cy(t)*sin(theta1(t) + theta2(t)))/(l_2*(m_1 + m_2))]])')
com_ddot_subbed_mat = sympify('Matrix([\n[l_2*m_2*((l_1*cos(theta2(t)) + l_2)*(l_1*m_1*cos(theta1(t)) + l_1*m_2*cos(theta1(t)) + l_2*m_2*cos(theta1(t) + theta2(t))) - (l_1**2*m_1 + l_1**2*m_2 + 2*l_1*l_2*m_2*cos(theta2(t)) + l_2**2*m_2)*cos(theta1(t) + theta2(t)))/((m_1 + m_2)*(l_1**2*m_1 + l_1**2*m_2 + 2*l_1*l_2*m_2*cos(theta2(t)) + l_2**2*m_2)), (m_2*(-g*m_1*sin(theta1(t) + theta2(t)) - g*m_2*sin(theta1(t) + theta2(t)) + l_1*m_1*omega1(t)**2*sin(theta2(t)) + l_1*m_2*omega1(t)**2*sin(theta2(t)) + F_cx(t)*cos(theta1(t) + theta2(t)) + F_cy(t)*sin(theta1(t) + theta2(t)))*(l_1**2*m_1**2 + 2*l_1**2*m_1*m_2 + l_1**2*m_2**2 + 2*l_1*l_2*m_1*m_2*cos(theta2(t)) + 2*l_1*l_2*m_2**2*cos(theta2(t)) + l_2**2*m_1*m_2 + l_2**2*m_2**2)*cos(theta1(t) + theta2(t)) - (m_1 + m_2)*(l_1*m_1*cos(theta1(t)) + l_1*m_2*cos(theta1(t)) + l_2*m_2*cos(theta1(t) + theta2(t)))*(g*l_1*m_1**2*sin(theta1(t)) + 2*g*l_1*m_1*m_2*sin(theta1(t)) + g*l_1*m_2**2*sin(theta1(t)) + g*l_2*m_1*m_2*sin(theta1(t) + theta2(t)) + g*l_2*m_2**2*sin(theta1(t) + theta2(t)) + 2*l_1*l_2*m_1*m_2*omega1(t)*omega2(t)*sin(theta2(t)) + l_1*l_2*m_1*m_2*omega2(t)**2*sin(theta2(t)) + 2*l_1*l_2*m_2**2*omega1(t)*omega2(t)*sin(theta2(t)) + l_1*l_2*m_2**2*omega2(t)**2*sin(theta2(t)) - l_1*m_1*F_cx(t)*cos(theta1(t)) - l_1*m_1*F_cy(t)*sin(theta1(t)) - l_1*m_2*F_cx(t)*cos(theta1(t)) - l_1*m_2*F_cy(t)*sin(theta1(t)) - l_2*m_2*F_cx(t)*cos(theta1(t) + theta2(t)) - l_2*m_2*F_cy(t)*sin(theta1(t) + theta2(t))) + (m_1 + m_2)*(l_1*m_1*omega1(t)**2*sin(theta1(t)) + l_1*m_2*omega1(t)**2*sin(theta1(t)) + l_2*m_2*omega1(t)**2*sin(theta1(t) + theta2(t)) + 2*l_2*m_2*omega1(t)*omega2(t)*sin(theta1(t) + theta2(t)) + l_2*m_2*omega2(t)**2*sin(theta1(t) + theta2(t)))*(l_1**2*m_1**2 + 2*l_1**2*m_1*m_2 + l_1**2*m_2**2 + 2*l_1*l_2*m_1*m_2*cos(theta2(t)) + 2*l_1*l_2*m_2**2*cos(theta2(t)) + l_2**2*m_1*m_2 + l_2**2*m_2**2))/((m_1 + m_2)**2*(l_1**2*m_1**2 + 2*l_1**2*m_1*m_2 + l_1**2*m_2**2 + 2*l_1*l_2*m_1*m_2*cos(theta2(t)) + 2*l_1*l_2*m_2**2*cos(theta2(t)) + l_2**2*m_1*m_2 + l_2**2*m_2**2))],\n[l_2*m_2*((l_1*cos(theta2(t)) + l_2)*(l_1*m_1*sin(theta1(t)) + l_1*m_2*sin(theta1(t)) + l_2*m_2*sin(theta1(t) + theta2(t))) - (l_1**2*m_1 + l_1**2*m_2 + 2*l_1*l_2*m_2*cos(theta2(t)) + l_2**2*m_2)*sin(theta1(t) + theta2(t)))/((m_1 + m_2)*(l_1**2*m_1 + l_1**2*m_2 + 2*l_1*l_2*m_2*cos(theta2(t)) + l_2**2*m_2)), (m_2*(-g*m_1*sin(theta1(t) + theta2(t)) - g*m_2*sin(theta1(t) + theta2(t)) + l_1*m_1*omega1(t)**2*sin(theta2(t)) + l_1*m_2*omega1(t)**2*sin(theta2(t)) + F_cx(t)*cos(theta1(t) + theta2(t)) + F_cy(t)*sin(theta1(t) + theta2(t)))*(l_1**2*m_1**2 + 2*l_1**2*m_1*m_2 + l_1**2*m_2**2 + 2*l_1*l_2*m_1*m_2*cos(theta2(t)) + 2*l_1*l_2*m_2**2*cos(theta2(t)) + l_2**2*m_1*m_2 + l_2**2*m_2**2)*sin(theta1(t) + theta2(t)) - (m_1 + m_2)*(l_1*m_1*sin(theta1(t)) + l_1*m_2*sin(theta1(t)) + l_2*m_2*sin(theta1(t) + theta2(t)))*(g*l_1*m_1**2*sin(theta1(t)) + 2*g*l_1*m_1*m_2*sin(theta1(t)) + g*l_1*m_2**2*sin(theta1(t)) + g*l_2*m_1*m_2*sin(theta1(t) + theta2(t)) + g*l_2*m_2**2*sin(theta1(t) + theta2(t)) + 2*l_1*l_2*m_1*m_2*omega1(t)*omega2(t)*sin(theta2(t)) + l_1*l_2*m_1*m_2*omega2(t)**2*sin(theta2(t)) + 2*l_1*l_2*m_2**2*omega1(t)*omega2(t)*sin(theta2(t)) + l_1*l_2*m_2**2*omega2(t)**2*sin(theta2(t)) - l_1*m_1*F_cx(t)*cos(theta1(t)) - l_1*m_1*F_cy(t)*sin(theta1(t)) - l_1*m_2*F_cx(t)*cos(theta1(t)) - l_1*m_2*F_cy(t)*sin(theta1(t)) - l_2*m_2*F_cx(t)*cos(theta1(t) + theta2(t)) - l_2*m_2*F_cy(t)*sin(theta1(t) + theta2(t))) - (m_1 + m_2)*(l_1*m_1*omega1(t)**2*cos(theta1(t)) + l_1*m_2*omega1(t)**2*cos(theta1(t)) + l_2*m_2*omega1(t)**2*cos(theta1(t) + theta2(t)) + 2*l_2*m_2*omega1(t)*omega2(t)*cos(theta1(t) + theta2(t)) + l_2*m_2*omega2(t)**2*cos(theta1(t) + theta2(t)))*(l_1**2*m_1**2 + 2*l_1**2*m_1*m_2 + l_1**2*m_2**2 + 2*l_1*l_2*m_1*m_2*cos(theta2(t)) + 2*l_1*l_2*m_2**2*cos(theta2(t)) + l_2**2*m_1*m_2 + l_2**2*m_2**2))/((m_1 + m_2)**2*(l_1**2*m_1**2 + 2*l_1**2*m_1*m_2 + l_1**2*m_2**2 + 2*l_1*l_2*m_1*m_2*cos(theta2(t)) + 2*l_1*l_2*m_2**2*cos(theta2(t)) + l_2**2*m_1*m_2 + l_2**2*m_2**2))]])')
tccom_ddot_mat = sympify('Matrix([[-l_2*m_2*((l_1*cos(theta2(t)) + l_2)*(l_1*m_1*sin(theta1(t)) + l_1*m_2*sin(theta1(t)) + l_2*m_2*sin(theta1(t) + theta2(t))) - (l_1**2*m_1 + l_1**2*m_2 + 2*l_1*l_2*m_2*cos(theta2(t)) + l_2**2*m_2)*sin(theta1(t) + theta2(t)))*(l_1*m_1*sin(theta1(t)) + m_2*(l_1*sin(theta1(t)) + l_2*sin(theta1(t) + theta2(t))))/((l_1**2*m_1 + l_1**2*m_2 + 2*l_1*l_2*m_2*cos(theta2(t)) + l_2**2*m_2)*(l_1**2*m_1**2 + 2*l_1**2*m_1*m_2 + l_1**2*m_2**2 + 2*l_1*l_2*m_1*m_2*cos(theta2(t)) + 2*l_1*l_2*m_2**2*cos(theta2(t)) + l_2**2*m_2**2)) - l_2*m_2*((l_1*cos(theta2(t)) + l_2)*(l_1*m_1*cos(theta1(t)) + l_1*m_2*cos(theta1(t)) + l_2*m_2*cos(theta1(t) + theta2(t))) - (l_1**2*m_1 + l_1**2*m_2 + 2*l_1*l_2*m_2*cos(theta2(t)) + l_2**2*m_2)*cos(theta1(t) + theta2(t)))*(l_1*m_1*cos(theta1(t)) + m_2*(l_1*cos(theta1(t)) + l_2*cos(theta1(t) + theta2(t))))/((l_1**2*m_1 + l_1**2*m_2 + 2*l_1*l_2*m_2*cos(theta2(t)) + l_2**2*m_2)*(l_1**2*m_1**2 + 2*l_1**2*m_1*m_2 + l_1**2*m_2**2 + 2*l_1*l_2*m_1*m_2*cos(theta2(t)) + 2*l_1*l_2*m_2**2*cos(theta2(t)) + l_2**2*m_2**2)), 2*l_1*l_2*m_2*(m_1 + m_2)*(l_1**2*m_1**2*omega1(t) + 2*l_1**2*m_1*m_2*omega1(t) + l_1**2*m_2**2*omega1(t) + 2*l_1*l_2*m_1*m_2*omega1(t)*cos(theta2(t)) + l_1*l_2*m_1*m_2*omega2(t)*cos(theta2(t)) + 2*l_1*l_2*m_2**2*omega1(t)*cos(theta2(t)) + l_1*l_2*m_2**2*omega2(t)*cos(theta2(t)) + l_2**2*m_2**2*omega1(t) + l_2**2*m_2**2*omega2(t))*omega2(t)*sin(theta2(t))/(l_1**2*m_1**2 + 2*l_1**2*m_1*m_2 + l_1**2*m_2**2 + 2*l_1*l_2*m_1*m_2*cos(theta2(t)) + 2*l_1*l_2*m_2**2*cos(theta2(t)) + l_2**2*m_2**2)**2 - (l_1*m_1*sin(theta1(t)) + m_2*(l_1*sin(theta1(t)) + l_2*sin(theta1(t) + theta2(t))))*(m_2*(-g*m_1*sin(theta1(t) + theta2(t)) - g*m_2*sin(theta1(t) + theta2(t)) + l_1*m_1*omega1(t)**2*sin(theta2(t)) + l_1*m_2*omega1(t)**2*sin(theta2(t)) + F_cx(t)*cos(theta1(t) + theta2(t)) + F_cy(t)*sin(theta1(t) + theta2(t)))*(l_1**2*m_1**2 + 2*l_1**2*m_1*m_2 + l_1**2*m_2**2 + 2*l_1*l_2*m_1*m_2*cos(theta2(t)) + 2*l_1*l_2*m_2**2*cos(theta2(t)) + l_2**2*m_1*m_2 + l_2**2*m_2**2)*sin(theta1(t) + theta2(t)) - (m_1 + m_2)*(l_1*m_1*sin(theta1(t)) + l_1*m_2*sin(theta1(t)) + l_2*m_2*sin(theta1(t) + theta2(t)))*(g*l_1*m_1**2*sin(theta1(t)) + 2*g*l_1*m_1*m_2*sin(theta1(t)) + g*l_1*m_2**2*sin(theta1(t)) + g*l_2*m_1*m_2*sin(theta1(t) + theta2(t)) + g*l_2*m_2**2*sin(theta1(t) + theta2(t)) + 2*l_1*l_2*m_1*m_2*omega1(t)*omega2(t)*sin(theta2(t)) + l_1*l_2*m_1*m_2*omega2(t)**2*sin(theta2(t)) + 2*l_1*l_2*m_2**2*omega1(t)*omega2(t)*sin(theta2(t)) + l_1*l_2*m_2**2*omega2(t)**2*sin(theta2(t)) - l_1*m_1*F_cx(t)*cos(theta1(t)) - l_1*m_1*F_cy(t)*sin(theta1(t)) - l_1*m_2*F_cx(t)*cos(theta1(t)) - l_1*m_2*F_cy(t)*sin(theta1(t)) - l_2*m_2*F_cx(t)*cos(theta1(t) + theta2(t)) - l_2*m_2*F_cy(t)*sin(theta1(t) + theta2(t))) - (m_1 + m_2)*(l_1*m_1*omega1(t)**2*cos(theta1(t)) + l_1*m_2*omega1(t)**2*cos(theta1(t)) + l_2*m_2*omega1(t)**2*cos(theta1(t) + theta2(t)) + 2*l_2*m_2*omega1(t)*omega2(t)*cos(theta1(t) + theta2(t)) + l_2*m_2*omega2(t)**2*cos(theta1(t) + theta2(t)))*(l_1**2*m_1**2 + 2*l_1**2*m_1*m_2 + l_1**2*m_2**2 + 2*l_1*l_2*m_1*m_2*cos(theta2(t)) + 2*l_1*l_2*m_2**2*cos(theta2(t)) + l_2**2*m_1*m_2 + l_2**2*m_2**2))/((m_1 + m_2)*(l_1**2*m_1**2 + 2*l_1**2*m_1*m_2 + l_1**2*m_2**2 + 2*l_1*l_2*m_1*m_2*cos(theta2(t)) + 2*l_1*l_2*m_2**2*cos(theta2(t)) + l_2**2*m_2**2)*(l_1**2*m_1**2 + 2*l_1**2*m_1*m_2 + l_1**2*m_2**2 + 2*l_1*l_2*m_1*m_2*cos(theta2(t)) + 2*l_1*l_2*m_2**2*cos(theta2(t)) + l_2**2*m_1*m_2 + l_2**2*m_2**2)) - (l_1*m_1*cos(theta1(t)) + m_2*(l_1*cos(theta1(t)) + l_2*cos(theta1(t) + theta2(t))))*(m_2*(-g*m_1*sin(theta1(t) + theta2(t)) - g*m_2*sin(theta1(t) + theta2(t)) + l_1*m_1*omega1(t)**2*sin(theta2(t)) + l_1*m_2*omega1(t)**2*sin(theta2(t)) + F_cx(t)*cos(theta1(t) + theta2(t)) + F_cy(t)*sin(theta1(t) + theta2(t)))*(l_1**2*m_1**2 + 2*l_1**2*m_1*m_2 + l_1**2*m_2**2 + 2*l_1*l_2*m_1*m_2*cos(theta2(t)) + 2*l_1*l_2*m_2**2*cos(theta2(t)) + l_2**2*m_1*m_2 + l_2**2*m_2**2)*cos(theta1(t) + theta2(t)) - (m_1 + m_2)*(l_1*m_1*cos(theta1(t)) + l_1*m_2*cos(theta1(t)) + l_2*m_2*cos(theta1(t) + theta2(t)))*(g*l_1*m_1**2*sin(theta1(t)) + 2*g*l_1*m_1*m_2*sin(theta1(t)) + g*l_1*m_2**2*sin(theta1(t)) + g*l_2*m_1*m_2*sin(theta1(t) + theta2(t)) + g*l_2*m_2**2*sin(theta1(t) + theta2(t)) + 2*l_1*l_2*m_1*m_2*omega1(t)*omega2(t)*sin(theta2(t)) + l_1*l_2*m_1*m_2*omega2(t)**2*sin(theta2(t)) + 2*l_1*l_2*m_2**2*omega1(t)*omega2(t)*sin(theta2(t)) + l_1*l_2*m_2**2*omega2(t)**2*sin(theta2(t)) - l_1*m_1*F_cx(t)*cos(theta1(t)) - l_1*m_1*F_cy(t)*sin(theta1(t)) - l_1*m_2*F_cx(t)*cos(theta1(t)) - l_1*m_2*F_cy(t)*sin(theta1(t)) - l_2*m_2*F_cx(t)*cos(theta1(t) + theta2(t)) - l_2*m_2*F_cy(t)*sin(theta1(t) + theta2(t))) + (m_1 + m_2)*(l_1*m_1*omega1(t)**2*sin(theta1(t)) + l_1*m_2*omega1(t)**2*sin(theta1(t)) + l_2*m_2*omega1(t)**2*sin(theta1(t) + theta2(t)) + 2*l_2*m_2*omega1(t)*omega2(t)*sin(theta1(t) + theta2(t)) + l_2*m_2*omega2(t)**2*sin(theta1(t) + theta2(t)))*(l_1**2*m_1**2 + 2*l_1**2*m_1*m_2 + l_1**2*m_2**2 + 2*l_1*l_2*m_1*m_2*cos(theta2(t)) + 2*l_1*l_2*m_2**2*cos(theta2(t)) + l_2**2*m_1*m_2 + l_2**2*m_2**2))/((m_1 + m_2)*(l_1**2*m_1**2 + 2*l_1**2*m_1*m_2 + l_1**2*m_2**2 + 2*l_1*l_2*m_1*m_2*cos(theta2(t)) + 2*l_1*l_2*m_2**2*cos(theta2(t)) + l_2**2*m_2**2)*(l_1**2*m_1**2 + 2*l_1**2*m_1*m_2 + l_1**2*m_2**2 + 2*l_1*l_2*m_1*m_2*cos(theta2(t)) + 2*l_1*l_2*m_2**2*cos(theta2(t)) + l_2**2*m_1*m_2 + l_2**2*m_2**2))]])')