Mathematical Function Plot
Description
Ploar Surface Plot of r sin(θ)
Equation
z
=
r
sin
(
θ
)
{\displaystyle z=r\sin \left(\theta \right)\,}
Co-ordinate System
Polar
r Range
0 .. 1
θ Range
-0 .. 2π
Mathematica Code
The rationale for this code can be found on Wikibooks, here . Note the it is slightly modified to allow for antialising.
This uses Chris Hill's antialiasing code to average pixels and produce a less jagged image. The original code can be found here .
dtheta = Pi/20; (*Give a radial gridline \
spacing of Pi/20 radians*)
rmax = 1; (*Define the \
maximum radius*)
dr = rmax/10; (*Give 10 \
circumferential grid lines*)
f[r_, theta_] := r Sin[theta]; (*This is the function definition*)
data = Table[
f[r, theta],
{theta, 0, 2Pi, dtheta},
{r, 0, rmax, dr}];
gr1 = ListPlot3D[
data,
MeshRange -> {{0, rmax}, {0, 2Pi}},
TextStyle -> {FontSize -> 60},
BoxStyle -> {AbsoluteThickness[4]},
MeshStyle -> {AbsoluteThickness[4]},
AxesLabel -> {"", "", z},
ImageSize -> 200,
DisplayFunction -> Identity]
gr2 = Graphics3D[gr1];
substitution = {r_, theta_, z_} -> {r Cos[theta], r Sin[theta], z};
gr3 = ReplaceAll[gr2, p : Polygon[pts_] :> ReplaceAll[p, substitution]]
aa[gr_] := Module[{siz, kersiz, ker, dat, as, ave, is, ar},
is = ImageSize /. Options[gr, ImageSize];
ar = AspectRatio /. Options[gr, AspectRatio];
If[! NumberQ[is], is = 288];
kersiz = 4;
img =
ImportString[ExportString[gr, "PNG", ImageSize -> (is kersiz)], "PNG"];
siz = Reverse@Dimensions[img[[1, 1]]][[{1, 2}]];
ker = Table[N[1/kersiz^2], {kersiz}, {kersiz}];
dat = N[img[[1, 1]]];
as = Dimensions[dat];
ave = Partition[Transpose[Flatten[
ListConvolve[ker, dat[[All, All, #]]]] & /@
Range[as[[3]]]], as[[2]] - kersiz + 1];
ave = Take[
ave, Sequence @@ ({1, Dimensions[ave][[#]], kersiz} & /@ \
Range[Length[Dimensions[ave]] - 1])];
Show[Graphics[Raster[
ave, {{0, 0},
siz/kersiz}, {0, 255}, ColorFunction -> RGBColor]], PlotRange -> \
{{0, siz[[1]]/kersiz}, {0, siz[[2]]/kersiz}}, ImageSize -> is,
AspectRatio -> ar]
]
aa[gr3]
English Add a one-line explanation of what this file represents