Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Plotting A Set of Points in Mathematica

  1. Jun 28, 2015 #1
    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?
     
  2. jcsd
  3. Jun 28, 2015 #2
    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.
     
  4. Jun 28, 2015 #3
    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?
     
  5. Jun 28, 2015 #4
    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.
     
  6. Jun 28, 2015 #5
    This code plots the elliptical region in the complex plane for the domain you specified:

    Code (Text):

    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 Im 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.
     
  7. Jun 28, 2015 #6
    Thank you, I appreciate it!
     
  8. Jun 29, 2015 #7
    Okay, so I have slightly modified the code slightly to account for a larger dimensional case:

    Code (Text):
    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?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook