Prev: Distributing "Large" Expressions to Remote Nodes
Next: Background color or alike for Panel && Manipulate
From: Jon Joseph on 1 Mar 2010 04:43 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
From: Bob Hanlon on 1 Mar 2010 08:06 Show[ PolarPlot[{ Sqrt[3], Sqrt[6 Cos[2 t]]}, {t, 0, 2 Pi}], RegionPlot[ x^2 + y^2 > 3 && x^2 + y^2 < 6 Cos[2 ArcTan[x, y]], {x, -2.5, 2.5}, {y, -1.75, 1.75}]] Bob Hanlon ---- Jon Joseph <josco.jon(a)gmail.com> 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
From: David Park on 1 Mar 2010 08:07 PolarPlot doesn't have a Filling option. But the plot is not too difficult with the Presentations package. To obtain the fills, we first draw r versus t between the limits where the lemniscates intersects the circle, which can be solved for. We can use filling there. Then we transform the result from the t-r plane to the x-y plane using DrawingTransform. We do this for each side, combine with a PolarDraw and we have your plot. Needs["Presentations`Master`"] trfill = Draw[{Sqrt[6 Cos[2 t]], Sqrt[3]}, {t, -\[Pi]/6, \[Pi]/6}, Filling -> {1 -> {2}}, FillingStyle -> LightBlue]; Draw2D[ {PolarDraw[{Sqrt[3], Sqrt[6 Cos[2 t]], -Sqrt[6 Cos[2 t]]}, {t, 0, 2 Pi}], trfill /. DrawingTransform[#2 Cos[#1] &, #2 Sin[#1] &], trfill /. DrawingTransform[-#2 Cos[#1] &, #2 Sin[#1] &]}, AspectRatio -> Automatic, Frame -> True, ImageSize -> 300] David Park djmpark(a)comcast.net http://home.comcast.net/~djmpark/ From: Jon Joseph [mailto:josco.jon(a)gmail.com] 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
From: Helen Read on 2 Mar 2010 03:34 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
From: David Park on 3 Mar 2010 05:50 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(a)comcast.net http://home.comcast.net/~djmpark/ From: Helen Read [mailto:hpr(a)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
|
Next
|
Last
Pages: 1 2 Prev: Distributing "Large" Expressions to Remote Nodes Next: Background color or alike for Panel && Manipulate |