How to solve x**2 + y**2 == 0 in real domain?

60 views
Skip to first unread message

Jisoo Song

unread,
Jan 21, 2020, 9:00:12 AM1/21/20
to sympy
It seems that solveset only deals with univariate equation, while solve does not consider the domain.

How can I get x==0 & y==0 by solving x**2 + y**2 == 0 in real domain?

Aaron Meurer

unread,
Jan 21, 2020, 1:47:36 PM1/21/20
to sympy
I'm not sure if it's supported. Normally to get solve() to return only
real solutions you set real=True on the variables. But it doesn't seem
to handle this case. It only wants to give the solutions [(-I*y, y),
(I*y, y)].

Aaron Meurer

On Tue, Jan 21, 2020 at 7:00 AM Jisoo Song <jeeso...@gmail.com> wrote:
>
> It seems that solveset only deals with univariate equation, while solve does not consider the domain.
>
> How can I get x==0 & y==0 by solving x**2 + y**2 == 0 in real domain?
>
> --
> 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 sympy+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/0301ee79-b3be-48ef-8740-b771640126b1%40googlegroups.com.

Aaron Meurer

unread,
Jan 21, 2020, 1:53:01 PM1/21/20
to sympy
solve() could be doing something like this to filter out the
parametric solution for x given the real assumption on x

>>> x, y = symbols('x y', real=True)
>>> solve(x**2 + y**2, [x, y])
[(-I*y, y), (I*y, y)]
>>> solve(Eq(I*y, re(I*y)), y)
[0]
>>> (I*y).subs(y, 0)
0

I don't know if it would work in more general cases.

Aaron Meurer
Reply all
Reply to author
Forward
0 new messages