-2
$\begingroup$

I tried to use some of the techniques here to shade the area inside the overlap of r=cos(3t) and r=1/2 and was unsuccessful. Even better would be to shade 3 regions; r = 1/2 for 0<t<pi/6,r=cos(3t) for pi/6<t<pi/9, and r=cos(3t) for r > 1/2

$\endgroup$
  • $\begingroup$ Please present your problem in terms of the actual Mathematica code you have tried. Pseudo-code does not give enough info about what you might done wrong. In particular, what was the code that produced your plot? $\endgroup$ – m_goldberg Jul 21 '17 at 22:50
  • $\begingroup$ I considered that, but honestly that would make for quite a long question. I will try and do so later. $\endgroup$ – jamesson Jul 21 '17 at 22:58
2
$\begingroup$

You did not define the regions very clearly. This may be what you want.

Show[
 RegionPlot[
  {Sqrt[x^2 + y^2] < 1/2 && 0 < ArcTan[x, y] < π/6,
   Sqrt[x^2 + y^2] < Cos[3 ArcTan[x, y]] && π/9 < ArcTan[x, y] < π/6,
   1/2 < Sqrt[x^2 + y^2] < Cos[3 ArcTan[x, y]]},
  {x, -1, 1}, {y, -1, 1},
  PlotStyle -> {LightBlue, Red, LightGreen},
  PlotPoints -> 150,
  PlotLegends -> Placed[(
     ToString[#, TraditionalForm] & /@
      {r < 1/2 && 0 < t < π/6,
       r < Cos[3 t] && π/9 < t < π/6,
       1/2 < r < Cos[3 t]}), {0.75, 0.85}]],
 PolarPlot[{Cos[3 t], 1/2}, {t, 0, 2 Pi}],
 PlotRange -> All,
 AspectRatio -> Automatic]

enter image description here

$\endgroup$
  • $\begingroup$ Yep, exactly it, thank you. Now I can tear it apart to figure out exactly what is going on. $\endgroup$ – jamesson Jul 22 '17 at 15:13
0
$\begingroup$

You can plot all the pieces using a single ParametricPlot:

ParametricPlot[{r Cos[3 t] {Sin[t], Cos[t]}, r/2 {Sin[t], Cos[t]}, 
  ConditionalExpression[r/2 {Sin[t], Cos[t]}, Pi/9 <= t <= Pi/6], 
  ConditionalExpression[r Cos[3 t] {Sin[t], Cos[t]}, Pi/9 <= t <= Pi/6]}, 
 {t, 0, 2 Pi}, {r, 0, 1}, 
 PlotPoints -> 100, Mesh -> None, BaseStyle -> Thick,
 PlotStyle -> {Cyan, Opacity[1, White], Blue, Opacity[1, Red]}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.