Skip to content
Advertisement

Is there a function in sympy or scipy that corresponds to massMatrixForm in matlab?

I am learning rigid body kinematics from: https://rotations.berkeley.edu/the-poisson-top-with-friction/ . The link to the matlab source code is at the bottom of the page. Derive the Poisson top’s equations of motion: http://rotations.berkeley.edu/wp-content/uploads/2017/10/derive_poisson_top_ODEs.txt Solve the Poisson top’s equations of motion: http://rotations.berkeley.edu/wp-content/uploads/2017/10/solve_poisson_top_ODEs.txt

JavaScript

I rewrote most of the code for the derivation process in python, though may not be elegant code.

JavaScript

In fact, it is impossible to solve the expressions of D2psi, D2theta, D2phi, D2x1 and D2x2, which are the first order differential form of the equations of motion, with sympy.solve.

Is there a function in sympy or scipy that corresponds to massMatrixForm in matlab? Or something like that? So I can rewrite this simulation in python by using solve_ivp.

Advertisement

Answer

I don’t have time to test your code right now, but I believe you are looking for the linear_eq_to_matrix function.

Replace the solve command with the following:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement