Re: Re: Shading in polar plot
- To: mathgroup at smc.vnet.net
- Subject: [mg107926] Re: [mg107883] Re: Shading in polar plot
- From: "David Park" <djmpark at comcast.net>
- Date: Wed, 3 Mar 2010 05:50:00 -0500 (EST)
- References: <hmg27q$sre$1@smc.vnet.net> <1680250.1267521052707.JavaMail.root@n11>
I like that, and learning from Helen I tried again with Presentations and
came up with the following. We don't have to use thick lines if we turn off
the BoundaryStyle to prevent double drawing. We don't need a RegionFunction
if we work directly, and to me a little more intuitively, with the radius
and reverse the iterators. And we need only one ParametricDraw if we Map it
onto the angle iterators.
Needs["Presentations`Master`"]
r[t_] := Sqrt[3];
s[t_] := Sqrt[6 Cos[2 t]];
Draw2D[
{PolarDraw[{r[t], s[t]}, {t, 0, 2 Pi}],
ParametricDraw[radius {Cos[t], Sin[t]}, #, {radius, r[t], s[t]},
Mesh -> None,
BoundaryStyle -> None] & /@ {{t, -Pi/6, Pi/6}, {t, 5 Pi/6,
7 Pi/6}}
},
ImageSize -> 400]
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/
From: Helen Read [mailto:hpr at together.net]
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