On Saturday, 15 February 2020 00:55:20 UTC+1, Aaron Meurer wrote:
>
> ...
> The best recommendation is in general to avoid sympify, unless you are
> processing arbitrary strings
>
Thanks for the reply, but as I am processing user-input I think there is no
way around sympify.
--
You
Thanks a lot
I read about locals and individual dictionaries, but I didn't realize that
it would affect "already defined" Symbols.
It is a little bit confusing that 'a' and 'a' can be not the same thing.
But now everything works as expected, thanks again.
--
You received this message because
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]