Plotting A Set of Points in Mathematica

In summary: The message you are seeing is caused by a conflict between the function you are trying to plot and the plotting options you provided. To resolve the conflict, you will need to change the options you provided for ParametricPlot. You can do this by adding a comma after the last argument in the list for ParametricPlot, like this:p2 = ListPlot[eigenpoints, PlotRange -> {r1, r2, r3}, PlotType -> " Ellipse", PlotPoints -> 400]
  • #1
Bashyboy
1,421
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
  • #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.
 
  • #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?
 
  • #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.
 
  • #5
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.
 
  • #6
Thank you, I appreciate it!
 
  • #7
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?
 

Related to Plotting A Set of Points in Mathematica

1. How do I plot a set of points in Mathematica?

To plot a set of points in Mathematica, you can use the ListPlot function. First, create a list of points in the form {{x1, y1}, {x2, y2}, ...}. Then, use the ListPlot function and pass in the list of points as an argument. This will create a scatter plot of the points.

2. Can I customize the appearance of the plotted points?

Yes, you can customize the appearance of the plotted points by using the PlotStyle option in the ListPlot function. This allows you to change the color, shape, and size of the points to suit your preference.

3. How do I add labels and titles to my plot?

To add labels and titles to your plot, you can use the PlotLabel and AxesLabel options in the ListPlot function. PlotLabel allows you to add a title to the plot, while AxesLabel allows you to add labels for the x and y axes.

4. Can I plot a line connecting the points?

Yes, you can plot a line connecting the points by using the Joined option in the ListPlot function. Set Joined -> True to connect the points with a line or Joined -> False to only plot the points without a line.

5. How do I save my plot as an image file?

To save your plot as an image file, you can use the Export function. Pass in the plot and the desired file format, such as "PNG" or "JPEG". You can also specify the file name and directory to save the image in.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
322
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
3
Views
428
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
Back
Top