3
$\begingroup$

I'm interested in plotting solutions of systems of polynomials in the complex plane, in the following way.

Let $f_1,\ldots f_s$ be complex polynomials in variables $x_1,\ldots x_n$. I know how to find the solutions using a code like this

eqs = {x^2 + y^3 + 1 == 0, x + y^2 - 1 == 0}
pts = Solve[eqs, {x, y}]

But I'm having some trouble to plot the values of $x,y$ n the complex plane. I tried some naive thing like

ListPlot[pts]

but nothing works. I'm lost, any help is welcome, thanks.

$\endgroup$
6
  • $\begingroup$ Get them using {x, y} /. % $\endgroup$
    – Mahdi
    Apr 8, 2015 at 3:19
  • $\begingroup$ I forgot a little detail in my answer, sorry. It's corrected. $\endgroup$
    – Integral
    Apr 8, 2015 at 3:21
  • $\begingroup$ A math problem: If you have ${x,y}$ as a point and $x$ and $y$ are complex, how does one show them on complex plane? $\endgroup$
    – Mahdi
    Apr 8, 2015 at 3:30
  • $\begingroup$ $x$ is one point and $y$ is another, their are not considered as coordinates. $\endgroup$
    – Integral
    Apr 8, 2015 at 3:33
  • 1
    $\begingroup$ A related thread. $\endgroup$ Nov 21, 2015 at 19:34

2 Answers 2

3
$\begingroup$

You have

eqs = {x^2 + y^3 + 1 == 0, x + y^2 - 1 == 0};
pts = Solve[eqs, {x, y}];

To get the data points and the plot:

data = {x, y} /. pts // Flatten;
ListPlot[{Re[#], Im[#]} & /@ data]
$\endgroup$
3
  • 1
    $\begingroup$ I think it's perfect! $\endgroup$
    – Integral
    Apr 8, 2015 at 3:45
  • $\begingroup$ Do you mind just explain a little (or recommend some reading) what #,&,/ and @ stands for? $\endgroup$
    – Integral
    Apr 8, 2015 at 3:47
  • $\begingroup$ Thanks! /@ is shorthand for Map. It basically maps {Re[#], Im[#]} over all elements in data one by one. This page is really good to start! $\endgroup$
    – Mahdi
    Apr 8, 2015 at 3:53
4
$\begingroup$

Starting from version 10.1 you can use ReIm:

eqs = {x^2 + y^3 + 1 == 0, x + y^2 - 1 == 0};
pts = {x, y} /. Solve[eqs, {x, y}];

ListPlot[ReIm[pts]]

enter image description here

$\endgroup$
3
  • 2
    $\begingroup$ Or even ListPlot@ReIm@Values@Solve[eqs, {x, y}]. $\endgroup$
    – Michael E2
    Nov 21, 2015 at 14:35
  • $\begingroup$ @MichaelE2, hi, please let me know what do you think about this question : mathematica.stackexchange.com/questions/206901/… . Do you think it’s some how related? $\endgroup$
    – S.S.
    Sep 26, 2019 at 15:10
  • $\begingroup$ I have Mathematica 9. $\endgroup$
    – S.S.
    Sep 26, 2019 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.