Hi,
sympify('a') will return a symbol with no assumptions, which is different 
from a as defined. You can amend this by passing a dictionary with intended 
translations:
>>> from sympy import sympify, Symbol
>>> a = Symbol('a', real=True)
>>> sympify('a') == a
False
>>> sympify('a', {'a': a}) == a
True

Kalevi Suominen

On Friday, February 14, 2020 at 5:03:02 PM UTC+2, ludi wrote:
>
> Hi
>
> If I do
>
> a=Symbol('a', real=True)
> b=Symbol('b')
>
> and do
>
> solve(a**2-1,a)
> I get
> [−1, 1]
> solve(b**2-1,b)
> [−1, 1]
>
> as expected.
>
> solve(a**2+1,a)
> I get
> [ ]
> solve(b**2+1,b)
> [−i, i]
>
> again, ok.
>
> But
> solve(sympify("a**2+1"),a)
> []
> *solve(sympify("a**2-1"),a)*
> *[]*
> solve(sympify("b**2-1"),b)
> [−1, 1]
> solve(sympify("b**2+1"),b)
> [−i, i]
>
> So solve(sympify("something with a"), a)  will always return the empty 
> list.
> Why is that?
> Any argument I could pass to sympify to amend this?
>
> The same its true for solveset.
>

-- 
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/c8e6d315-2977-46cb-8e46-dd362747a532%40googlegroups.com.

Reply via email to