Plotting A Set of Points in Mathematica

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
6 replies · 3K views
Bashyboy
Messages
1,419
Reaction score
5
A have the set consisting of the complex numbers ##1 + 3r \cos \theta - i r \sin \theta##, where ## r \in [0,1]## and ##\theta## may vary between ##0## and ##2 \pi##.

This is my first encounter with mathematica, and am having difficulty discerning between the methods I have found online which would best suite my purpose (actually, I am not sure any of ones I have found would work). So, what would be the best way? Should I generate a list of all those complex numbers of the form mentioned above, and then plot the list? If so, would someone mind directing me to an online resource on how exactly to do this? Or is there some better method?

Also, I would like to plot the eigenvalues of the matrix ##\begin{bmatrix} 1 & 2 \\ 1 & 1 \\ \end{bmatrix}## So, how would I plot these simultaneously?
 
Physics news on Phys.org
What precisely do you wish to plot? For example, say let r=3 and then plot a trajectory in the complex plane as t varies from 0 to 2pi? Or for example you just have a set of points {c1, c2,...cn} and you wish to plot as points in the plane the real part vs. the complex part of each complex number.
 
I wish to plot complex numbers of the form ##1 + 3r \cos \theta - i r \sin \theta##, where ##r## and ##\theta## must satisfy the conditions ##r \in [0,1]## and ##\theta \in [0,2*\pi]##. The plot should result in a convex object in the complex plane.

Does this make sense?
 
Actually, I would like to make it more general by plotting complex numbers of the form ##a + \frac{u}{2}re^{-i \theta} + \frac{v}{2} re^{i \theta}##, the same conditions being placed upon ##r## and ##\theta##, where ##a##, ##u##, and ##v## can be any complex number.
 
Bashyboy said:
I wish to plot complex numbers of the form ##1 + 3r \cos \theta - i r \sin \theta##, where ##r## and ##\theta## must satisfy the conditions ##r \in [0,1]## and ##\theta \in [0,2*\pi]##. The plot should result in a convex object in the complex plane.

Does this make sense?

This code plots the elliptical region in the complex plane for the domain you specified:

Code:
f[r_, t_] := 1 + 3*r*Cos[t] - I*r*Sin[t]
ParametricPlot[{Re[f[r, t]], Im[f[r, t]]},{r, 0, 1}, {t, 0, 2*Pi}]

I first defined the function of two variables f[r,t]. Then I used ParametricPlot to plot the Re and I am parts of f[r,t] over the domains you specified. Try that code. For the more general case, just add more variables. Note the use of the underscore in the function definition. Don't forget to use it when defining variables.
 
Thank you, I appreciate it!
 
Okay, so I have slightly modified the code slightly to account for a larger dimensional case:

Code:
a11 = 1
a22 = 3 + 14*I
a33 = 3
a12 = 1
a21 = 5 + 3*I
a13 = 7
a31 = 4 + 21*I
a23 = 5 + 3*I
a32 = 5

A = {{a11, a12, a13}, {a21, a22, a23}, {a31, a32, a33}}
B = {{1, r1*Exp[I*theta1], r2*Exp[I*theta2]}, {r1*Exp[-I*theta1], 1,
   r3*Exp[I*theta3]}, {r2*Exp[-I*theta2], r3*Exp[-I*theta3], 1}}

eigenpoints =
Table[{Re[Eigenvalues[A]][[i]], Im[Eigenvalues[A]][[i]]}, {i, 1,
   Length[Eigenvalues[A]]}]p1 = ParametricPlot[
  Through[{Re, Im}[(1/3)*Tr[A.B]]], {r1, 0, 1}, {r2, 0, 1}, {r3, 0,
   1}, {theta1, 0, 2*Pi}, {theta2, 0, 2*Pi}, {theta3, 0, 2*Pi}]
p2 = ListPlot[eigenpoints]

When I run the code, I am met with this terrible message: ParametricPlot::nonopt: "Options expected (instead of {theta3,0,2\ \[Pi]}) beyond position 3 in ParametricPlot[Through[{Re,Im}[1/3\ Tr[A.B]]],{r1,0,1},{r2,0,1},{r3,0,1},{theta1,0,2\ \[Pi]},{theta2,0,2\ \[Pi]},{theta3,0,2\ \[Pi]}]. An option must be a rule or a list of rules. "

Evidently this message arises when any of the arguments after the first are not options. Which options am I missing? Does it not like the fact that I have several ranges of values for the parameters ##r_1,r_2,r_3,\theta_1,...## etc. Or does it not like the fact that ##\frac{1}{3} Tr(AB)## involves the exponential function?