I have an expression of the type
expr = x1
where x1 is a symbol.
I want to be able to replace x1 by a certain type of object, defined elsewhere. I tried something like
import sympy as sp
x1= sp.symbols('x1')
obj1 = Obj()
expr=x1
expr.subs([(x1,obj1)])
but it doesn't perform any substitution.
Is it possible to use subs() with an arbitrary object, or is there a way around it?