Re: Shading in polar plot
- To: mathgroup at smc.vnet.net
- Subject: [mg107883] Re: Shading in polar plot
- From: Helen Read <hpr at together.net>
- Date: Tue, 2 Mar 2010 03:34:53 -0500 (EST)
- References: <hmg27q$sre$1@smc.vnet.net>
- Reply-to: read at cems.uvm.edu
On 3/1/2010 4:43 AM, Jon Joseph wrote:
> All: I would like to shade the area outside of the circle Sqrt[3] and
> inside the lemniscate r^2=6Cos[2 t]. Can this be done using PolarPlot
> and mesh functions or is something else needed?
>
> PolarPlot[{Sqrt[3], Sqrt[6 Cos[2 t]], -Sqrt[6 Cos[2 t]]}, {t, 0, 2 Pi}]
>
> Shows the curves without the shading. Jon
>
ParametricPlot with a RegionFunction will do the job.
r[t_] = Sqrt[3];
s[t_] = Sqrt[6 Cos[2 t]];
Solve[r[t] == s[t], t] (* to find where they intersect *)
plot1 = PolarPlot[{r[t], s[t]}, {t, 0, 2 Pi}, PlotStyle -> Thick];
plot2 = ParametricPlot[{u s[t] Cos[t], u s[t] Sin[t]},
{u, 0, 1}, {t, -Pi/6, Pi/6},
RegionFunction -> Function[{x, y, u, t}, u s[t] > r[t]],
Mesh -> None];
plot3 = ParametricPlot[{u s[t] Cos[t], u s[t] Sin[t]}, {u, 0, 1},
{t, 5 Pi/6, 7 Pi/6},
RegionFunction -> Function[{x, y, u, t}, u s[t] > r[t]],
Mesh -> None];
Show[{plot1, plot2, plot3}, PlotRange -> Automatic]
And actually, this will work, though it will complain about comparing
s[t]>r[t] where the values are non-real:
plot4 = PolarPlot[{r[t], s[t]}, {t, 0, 2 Pi}, PlotStyle -> Thick];
plot5 = ParametricPlot[{u s[t] Cos[t], u s[t] Sin[t]}, {u, 0, 1},
{t, 0, 2Pi},
RegionFunction -> Function[{x, y, u, t}, u s[t] > r[t]],
Mesh -> None];
Show[{plot4, plot5}, PlotRange -> Automatic]
--
Helen Read
University of Vermont