Skip to content

Try out and potentially make use of SymPy's cse_diff.py module #504

@moorepants

Description

@moorepants

Found here: https://github.com/sympy/sympy/blob/master/sympy/simplify/_cse_diff.py

It is a simple swap to use it and it is include in SymPy 1.14. I tried it and all the opty tests passed. But the examples that use the gait2d model failed to differentiate. I don't think the assumptions of the original symbols are taken into account because I get this error:

 /home/moorepants/miniconda/envs/opty-dev/lib/python3.14/site-packages/sympy/printing/codeprinter.py(610)_print_not_supported()
    608     def _print_not_supported(self, expr):
    609         if self._settings.get('strict', False):
--> 610             raise PrintMethodNotImplementedError(
    611                 f"Unsupported by {type(self)}: {type(expr)}" +
    612                 "\nSet the printer option 'strict' to False in order to generate partially printed code."

ipdb> expr
re(x102)
ipdb> 

showing that the derivative of the foot penetration force is being treated as complex.

The Jacobian in cse_diff.py may be faster than the one in opty.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions