Showing a polar integral graphically...

General discussion about Mathematica features and functionality...
Forum Rules
By using the Wolfram Faculty Program Forum, you agree not to post any abusive, obscene, vulgar, slanderous, hateful, threatening, or sexually oriented material. Wolfram Faculty Program Forum administrators have the right to remove, edit, move or close any topic at any time should we see fit.

Personal Information: Posts in this forum may be viewed by non-members; however, the forum prohibits non-members from viewing your profile. Although your email address is hidden from both non-members and members, your account is initially configured to allow members to contact you via email through the forum. If you wish to hide your profile, or prohibit others from contacting you directly, you may change these settings by updating your profile through the User Control Panel.

Attachments: Attachments are not currently enabled on this forum. To share a file with others on this site, simply upload your file to the online storage service of your choice and include a link to the file within your post. If your school does not offer an online file storage and sharing service, the following sites provide free basic online file storage and sharing: Mozy, FilesAnywhere, Adrive, and KeepandShare.

Showing a polar integral graphically...

Postby Rob_Holman » Sat May 12, 2012 12:37 am

Hi all:

I'm trying to graphically show the area between two polar curves as computed by a typical polar integral. I tried to use the Filling command but it didn't prove effective. Any suggestions on how I might get this to work?

User avatar
Posts: 14
Joined: Wed Feb 29, 2012 7:03 pm
Organization: The Walker School
Department: Mathematics and Science

Re: Showing a polar integral graphically...

Postby Michael_Morrison » Sat May 12, 2012 5:17 am

Hi Rob,

Unfortunately, Filling is not a supported option for PolarPlot. However, you can work around this a couple of different ways. Here are some examples:

PolarPlot[{1 + 2 Cos[t], 2}, {t, 0, 2 \[Pi]}],
2 <= Sqrt[x^2 + y^2] <= 1 + 2 x/Sqrt[(x^2 + y^2)], {x, 0,
3}, {y, -2, 2}, MaxRecursion -> 3, BoundaryStyle -> Thick]}]

Here is another example that uses a slightly different approach by using ParametricPlot and RegionFunction, and then puts everything together with Show:

r[t_] := 1 + 2 Cos[t];
s[t_] := 2;
plot1 = PolarPlot[{r[t], s[t]}, {t, 0, 2 \[Pi]}, PlotStyle -> Thick];
plot2 = ParametricPlot[{u r[t] Cos[t], u r[t] Sin[t]}, {u, 0,
1}, {t, -\[Pi]/3, \[Pi]/3},
RegionFunction -> Function[{x, y, u, t}, u r[t] > s[t]],
Mesh -> None];
Show[{plot1, plot2}, PlotRange -> Automatic]

I do have a custom function I can pass along that will fill a *single* polar plot with a color:

PolarFilledPlot[func_, {var_, varmin_, varmax_}, col_,
opts___?OptionQ] := Module[{conversion, picklesplt, ourplt},
pickles = {opts};
colorval = col;
conversion[Line[l_], colorval_] := {{Hue[colorval], Polygon[l]},
plt = PolarPlot[func, {var, varmin, varmax},
DisplayFunction -> Identity][[1]];
ourplt =
Cases[plt, _Line, Infinity] /. l_Line :> conversion[l, colorval]],
Evaluate[pickles], DisplayFunction -> $DisplayFunction]

Once you evaluate that command in a Mathematica session, you can call the function to create a filled polar plot. (The third argument of the command is the color specification.) For example, here is a polar plot filled with bright cyan:

PolarFilledPlot[Sin[3 t], {t, 0, Pi}, 0.5, Axes -> True]

I hope this helps.

User avatar
Posts: 42
Joined: Fri Sep 11, 2009 9:50 pm
Organization: Wolfram Research, Inc.
Department: Academic Initiatives

Return to General Mathematica Discussion

Who is online

Users browsing this forum: No registered users and 1 guest