Plotting Polar Curves in Mathematica: Troubleshooting Homework Statement

  • Thread starter flyingpig
  • Start date
  • Tags
    Mathematica
In summary, the conversation involves a person seeking help to plot two polar curves using Mathematica. The first attempt only resulted in one curve being plotted and the person tried a different approach, but it did not work. They then received a suggestion to try a different range for t and it successfully plotted both curves together.
  • #1
flyingpig
2,579
1

Homework Statement



I am trying to plot the two polar curves [tex]r = \sqrt{3} cos(\theta)[/tex] and [tex]r = sin(\theta)[/tex]

Mathematica only gives me one of the curves.

I tried plotting PolarPlot[{sqrt (3) Cos[t]}, {t, 0, 2 Pi}] and it gives me a blank box in the first quadrant.

any ideas?
 
Physics news on Phys.org
  • #2
  • #3
That's because it doesn't recognize sqrt(3). Try:

PolarPlot[{Sqrt[3] Cos[t]}, {t, 0, 2 Pi}]
 
  • #4
Neither works
 
  • #5
flyingpig said:
Neither works

Did you mean the WolframAlpha links?
Those work for me.

And according to WolframAlpha the Mathematica expression for the polar plot is:

PolarPlot[{Sqrt[3] Cos[t]}, {t, -Pi, Pi}]

It seems that it matters what the range of t is, because it does not work from 0 to 2Pi.
 
  • #6
No, I mean your links do work, but they only plot one curve. I am trying to plot both curves together
 
  • #7
PolarPlot[{Sqrt[3] Cos[t], Sin[t]}, {t, 0, 2 Pi}] works for me.
 
  • #8
OKay it is working now. thanks
 

FAQ: Plotting Polar Curves in Mathematica: Troubleshooting Homework Statement

1. How do I plot a polar curve in Mathematica?

To plot a polar curve in Mathematica, you can use the PolarPlot function. The syntax is PolarPlot[r, {θ, θmin, θmax}], where r is the function of θ that defines the curve, and θmin and θmax specify the range of values for θ. For example, to plot the curve r = θ^2, you would use the code PolarPlot[θ^2, {θ, 0, 2π}].

2. Why is my polar curve not showing up on the plot?

There could be several reasons for this. Make sure that you have entered the correct syntax for the PolarPlot function and that the curve you are trying to plot is within the specified range for θ. Also, check that the curve is not being overshadowed by other elements in the plot, such as a grid or axes. If you are still having trouble, try adjusting the PlotRange option or using the Show function to combine multiple plots.

3. How do I add labels and a legend to my polar curve plot?

To add labels and a legend to your polar curve plot, you can use the Epilog option. This allows you to add text, shapes, and other graphics to your plot. For example, you can use the Text function to add labels and the LineLegend function to create a legend. Make sure to use the Show function to combine your plot and the Epilog elements.

4. Can I plot multiple polar curves on the same plot?

Yes, you can plot multiple polar curves on the same plot by using the Show function to combine them. For example, if you have two curves r1 = θ and r2 = θ^2, you can use the code Show[PolarPlot[θ, {θ, 0, 2π}], PolarPlot[θ^2, {θ, 0, 2π}]] to plot them on the same graph. You can also use the PlotStyle option to change the color or style of each curve to make them easier to distinguish.

5. How do I export my polar curve plot to an image file?

To export your polar curve plot to an image file, you can use the Export function. The syntax is Export["filename.extension", plot], where filename is the name you want to give your file and extension specifies the file type (e.g. .png, .jpg, .pdf). For example, if you want to export your plot as a PNG file named "mypolarplot", you would use the code Export["mypolarplot.png", plot].

Similar threads

Replies
1
Views
641
Replies
1
Views
701
Replies
3
Views
1K
Replies
2
Views
603
Replies
4
Views
2K
Replies
1
Views
1K
Replies
4
Views
1K
Back
Top