Mathematica question - plotting an equation

In summary, the conversation discusses using Mathematica to plot the locus of z such that the argument of (z-2)/(z+5) is equal to pi/4. The individual has tried using ContourPlot with a given equation but it only produces two vertical lines. The correct graph should be an arc of a circle passing through (-5,0) and (2,0). The solution is to add the y variable in the Arg function.
  • #1
kidsmoker
88
0
How could I use Mathematica to give me a plot of the locus of z such that

[tex]\arg(\frac{z-2}{z+5}) = \frac{\pi}{4}[/tex] ?

I've tried using ContourPlot and typing

ContourPlot[Arg[(x - 2 + I)/((x + 5) + I)] == (\[Pi]/4), {x, -5, 5}, {y, -5, 5}]

but it just gives me two vertical lines. I think the correct graph should be the arc of a circle passing through (-5,0) and (2,0).

Many thanks!
 
Physics news on Phys.org
  • #2
Hi kidsmoker,

kidsmoker said:
How could I use Mathematica to give me a plot of the locus of z such that

[tex]\arg(\frac{z-2}{z+5}) = \frac{\pi}{4}[/tex] ?

I've tried using ContourPlot and typing

ContourPlot[Arg[(x - 2 + I)/((x + 5) + I)] == (\[Pi]/4), {x, -5, 5}, {y, -5, 5}]

but it just gives me two vertical lines. I think the correct graph should be the arc of a circle passing through (-5,0) and (2,0).

Many thanks!

I think the reason it is giving vertical lines is because you have left out the y variable in your Arg function. I believe it should be:

Arg[(x - 2 + y I)/((x + 5) + y I)]

Does that work?
 
  • #3
Got it! Thanks very much :-)
 

1. How do I plot an equation in Mathematica?

To plot an equation in Mathematica, you can use the Plot function. The syntax is Plot[equation, {x, xmin, xmax}], where equation is the mathematical expression you want to plot and x is the variable. You can also add options such as PlotRange and PlotStyle to customize your plot.

2. Can I plot multiple equations in one graph using Mathematica?

Yes, you can plot multiple equations in one graph by using the Plot function with a list of equations. For example, Plot[{equation1, equation2, equation3}, {x, xmin, xmax}] will plot all three equations on the same graph. You can also add a legend using the PlotLegends option.

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

To add labels and titles to your plot, you can use the PlotLabel, AxesLabel, and PlotLegends options in the Plot function. For example, Plot[equation, {x, xmin, xmax}, PlotLabel -> "My Plot", AxesLabel -> {"x", "y"}, PlotLegends -> "Equation"] will add a title, axis labels, and a legend to your plot.

4. How do I change the appearance of my plot in Mathematica?

You can change the appearance of your plot by adding options such as PlotStyle, PlotRange, and AxesStyle to the Plot function. These options allow you to customize the colors, range, and style of the axes, respectively. You can also use the GridLines option to add grid lines to your plot.

5. Can I export my plot from Mathematica to an image file?

Yes, you can export your plot to an image file by using the Export function. The syntax is Export["filename.png", plot], where filename is the name you want to give your image file and plot is the plot you want to export. You can export to various file formats such as PNG, JPEG, and PDF.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
246
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
212
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Back
Top