Replacing Functions in a sympy expression with a Symbol of the same name

Viewed 996

It seems that sympy's solve function cannot solve some equations when Functions are present in the equations or are the targets to solve for.

To get around this, I'd like to create a generic function that will automatically replace Functions in an expression with Symbols of the same name.

For example, if Function('myfunc')(Symbol('t')) appears in an expression, I'd like to substitute Symbol('myfunc') in for that.

The subs function cannot do this because the names must be explicitly known beforehand.

The replace function looks promising, particularly the func -> func flavor of it, but I cannot figure out how to get the name of a function object from the object.

1 Answers
Related