SymPy expressions can only contain Basic subclasses, so if your object
isn't a SymPy object, you will need to create a SymPy object that
wraps or represents it.

Aaron Meurer

On Mon, Jun 29, 2020 at 12:06 PM Michele Cotrufo
<[email protected]> wrote:
>
> 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?
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sympy/7ced1ea3-a275-472e-9c3b-5950cb000b98o%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6KmAKY-qhGTe_1WDuKN9kdXFEC8UkpUGfbnKqM1mAa9iw%40mail.gmail.com.

Reply via email to