# Shading one petal of Cos[3 t] inside of r = 1/2

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

• 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? – m_goldberg Jul 21 '17 at 22:50
• I considered that, but honestly that would make for quite a long question. I will try and do so later. – jamesson Jul 21 '17 at 22:58

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[(
{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]


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

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]}]