csu-hmc / gait2d

A musculoskeletal dynamics model for posture and gait.
http://hmc.csuohio.edu
Other
6 stars 1 forks source link

If the equations of motion are large finding symbols can be slow #4

Open moorepants opened 2 months ago

moorepants commented 2 months ago

These lines:

https://github.com/pydy/pydy/blob/master/pydy/codegen/matrix_generator.py#L53

        for matrix in matrices:
            # TODO : SymPy 0.7.4 does not have Matrix.free_symbols so we
            # manually compute them instead of calling:
            # required_args |= matrix.free_symbols
            required_args |= set().union(*[i.free_symbols for i in matrix])
            required_args |= find_dynamicsymbols(matrix)

can be very slow.

If you symbolically solve the equations of motion for a large system and then pass those equations to the matrix generator it can sit on these lines for extremely long times.

Hit this with this model: https://github.com/csu-hmc/gait2d

moorepants commented 2 months ago

See: 3d1cedd07ae7c9a38fba13a863ccde32ec5bfd36