Plotting A Set of Points in Mathematica

Click For Summary

Discussion Overview

The discussion centers around plotting complex numbers in Mathematica, specifically those of the form ##1 + 3r \cos \theta - i r \sin \theta##, where ##r## and ##\theta## vary within specified ranges. Participants also explore the simultaneous plotting of eigenvalues from a matrix and discuss generalizations of the initial function.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • One participant introduces a set of complex numbers and seeks guidance on how to plot them in Mathematica, questioning whether to generate a list of points or use a different method.
  • Another participant asks for clarification on the desired plot, suggesting different interpretations of the plotting task, such as plotting trajectories or sets of points.
  • A participant reiterates the goal of plotting complex numbers that should form a convex shape in the complex plane, confirming the conditions for ##r## and ##\theta##.
  • One participant proposes a more general form for the complex numbers to be plotted, allowing for different values of ##a##, ##u##, and ##v## while maintaining the same conditions for ##r## and ##\theta##.
  • A participant provides a code snippet for plotting the specified complex numbers using ParametricPlot, explaining the function definition and the use of underscores in variable definitions.
  • Another participant shares a modified code for a larger dimensional case involving a matrix and its eigenvalues, detailing the construction of matrices and the plotting process, but encounters an error message related to the use of options in ParametricPlot.
  • A participant expresses gratitude for the provided code and assistance.

Areas of Agreement / Disagreement

Participants generally agree on the methods for plotting complex numbers and eigenvalues, but there are differing interpretations of the plotting requirements and some unresolved issues regarding the code implementation.

Contextual Notes

The discussion includes various assumptions about the parameters and the structure of the code, with some participants facing challenges related to the syntax and options in Mathematica's plotting functions.

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?
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
Replies
5
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K