Wolfram Research

Function Repository Resource:

RoseCurveProperties (1.0.0) current version: 1.1.0 »

Source Notebook

Compute the properties of a specified rose curve

Contributed by: Garrett Dubofsky (Wolfram|Alpha Math Team)  |  Garrett Dubofsky

ResourceFunction["RoseCurveProperties"][a,n]

gives an association of properties related to the rose curve with polar formula r=aSin[n θ].

ResourceFunction["RoseCurveProperties"][a,n,prop]

gives the values of the specified properties in prop.

ResourceFunction["RoseCurveProperties"][a,n,prop,format]

gives the values of the specified properties in prop as either an Association or a Dataset determined by format.

Details

A rose curve is a class of curves defined by the equation r=aSin[n θ] in polar coordinates. When n is a rational number, the periodicity of the Sin function means that the rose curve forms a closed loop after at most one period of the function.
In some cases, the polar equation of the rose curve is given as r=aCos[n θ]. Although ResourceFunction["RoseCurveProperties"] does not have the option to switch between forms, the cosine form is equivalent to rotating the sine form by 90 degrees counterclockwise.
The amplitude a can be any real value, whereas the angle coefficient n must be a nonzero rational.
For the purposes of this function, a "petal" of a rose curve is defined as a minimal (possibly self-intersecting) segment of the curve that starts and ends at the origin and does not pass through the origin otherwise.
"TotalArea" refers to an area calculated by integration, which counts overlapped sections multiple times. By contrast, "SurfaceArea" counts each selected area once.
The following values of prop are supported for both integer and rational values of n:
"Equation"equation of the rose curve
"Plot"plot of the rose curve
"PetalPlot"plot of a single petal
"PetalCount"number of petals
"PetalTotalAreaFormula"formula for the total area of a single petal
"PetalTotalArea"total area of a single petal
"InactiveTotalAreaIntegral"inactive double integral for the total area of the rose curve
"InactiveTotalAreaSingleIntegral"inactive single integral for the total area of the rose curve
"TotalAreaFormula"formula for the total area of a rose curve (for rational n, rewrite n as the reduced fraction p/q)
"TotalArea"total area of the rose curve
"TotalAreaPlot"plot of the rose curve where darker hues correspond to overlapped sections
"PetalArcLength"arc length of a single petal
"ArcLength"arc length of the rose curve over one full period
"IntersectionCount"number of times the rose curve self-intersects
"ClosedDomain"interval of angles where the rose curve makes a complete cycle
Allall properties associated with the given value of n
The following values of prop are intended for rational values of n but can be called for integer values of n as well:
"PetalSurfaceAreaFormula"formula for the surface area of a single petal
"PetalSurfaceArea"surface area of a single petal
"InactiveSurfaceAreaIntegral"inactive double integral for the surface area of the rose curve
"InactiveSurfaceAreaSingleIntegral"inactive single integral for the surface area of the rose curve
"SurfaceAreaFormula"formula for the surface area of the rose curve (n is expressed as the reduced fraction p/q)
"SurfaceArea"surface area of the rose curve
"OuterCurveEquation"piecewise function for the outline of the rose curve
"OuterCurvePlot"plot of the outline of the rose curve
Multiple values of prop can be specified using a list.
The default output is an association, but setting format to Dataset will change the output.
The same options as ParametricPlot and PolarPlot are supported.

Examples

Basic Examples (2) 

Get an Association of the relevant information for a given rose curve:

In[1]:=
ResourceFunction["RoseCurveProperties"][1, 4/3]
Out[1]=

Get the number of petals and total area as an Association:

In[2]:=
ResourceFunction["RoseCurveProperties", ResourceVersion->"1.0.0"][1, 3, {"PetalCount", "TotalArea"}]
Out[2]=

Get the same information as a Dataset:

In[3]:=
ResourceFunction["RoseCurveProperties", ResourceVersion->"1.0.0"][1, 3, {"TotalArea", "PetalCount"}, Dataset]
Out[3]=

Scope (2) 

Find the plot of a rose curve with positive and negative values of a:

In[4]:=
{ResourceFunction["RoseCurveProperties"][1, 3, "Plot"], ResourceFunction["RoseCurveProperties"][-2, 3, "Plot"]}
Out[4]=

Decimal forms of n are acceptable and are rationalized internally to produce exact results:

In[5]:=
ResourceFunction["RoseCurveProperties"][4, 1.2, {"Equation", "Plot"}]
Out[5]=

Options (2) 

Default PolarPlot options can be used for "Plot", "PetalPlot" and "OuterCurvePlot":

In[6]:=
ResourceFunction["RoseCurveProperties"][1, 7/8, {"Plot", "PetalPlot", "OuterCurvePlot"}, PolarGridLines -> True,
  Frame -> False]
Out[6]=

Default ParametricPlot options can be used for "TotalAreaPlot":

In[7]:=
ResourceFunction["RoseCurveProperties"][1, 7/8, {"TotalAreaPlot"}, PlotStyle -> Red, BoundaryStyle -> {Thick, Black}, Axes -> False]
Out[7]=

Applications (2) 

Depict the different rose curves for n=1/t as t increases:

In[8]:=
Table[ResourceFunction["RoseCurveProperties"][1, 1/t, "Plot", ImageSize -> 50, Frame -> False, Axes -> False], {t, 1, 10}]
Out[8]=

Plot the increasing and oscillating number of self-intersections (depending on the parity of t):

In[9]:=
ListPlot[Table[
  ResourceFunction["RoseCurveProperties"][1, 1/t, "IntersectionCount"], {t, 1, 100}]]
Out[9]=

Show the change in outer curve plots, which visually approach a circle:

In[10]:=
Table[ResourceFunction["RoseCurveProperties"][1, 1/t, "OuterCurvePlot", ImageSize -> 50, Frame -> False, Axes -> False], {t, 1, 10}]
Out[10]=

Plotting the surface area, the rose curve shows the progression toward π:

In[11]:=
ListLinePlot[
 Table[ResourceFunction["RoseCurveProperties"][1, 1/t, "SurfaceArea"], {t, 1, 100}], PlotRange -> All]
Out[11]=

Plotting the rose curve and outer curve for n=1/50 explains further why the surface area approaches π:

In[12]:=
N[ResourceFunction["RoseCurveProperties"][1, 1/50, {"Plot", "OuterCurvePlot", "SurfaceArea"}]]
Out[12]=

Show how a single petal flattens for increasing integer values of n:

In[13]:=
Table[ResourceFunction["RoseCurveProperties"][1, k, "PetalPlot", ImageSize -> 50, Frame -> False, Axes -> False], {k, 1, 10}]
Out[13]=

Plot the area of a single petal against the n-value:

In[14]:=
ListLinePlot[
 Table[ResourceFunction["RoseCurveProperties"][1, t, "PetalTotalArea"], {t, 1, 100}], PlotRange -> All]
Out[14]=

The preceding plot is explained by the "PetalTotalAreaFormula" property:

In[15]:=
ResourceFunction["RoseCurveProperties"][1, 2, "PetalTotalAreaFormula"]
Out[15]=

Possible Issues (4) 

For the default number of PlotPoints, the area plot may appear choppy:

In[16]:=
ResourceFunction["RoseCurveProperties"][1, 23/2, "TotalAreaPlot"]
Out[16]=

Adding a higher value for PlotPoints may take longer, but will produce a smoother and more accurate plot:

In[17]:=
ResourceFunction["RoseCurveProperties"][1, 23/2, "TotalAreaPlot", PlotPoints -> 100]
Out[17]=

For non-numerical values of a, the function is left unevaluated:

In[18]:=
ResourceFunction["RoseCurveProperties"][x, 5/4]
Out[18]=

For negative, irrational or non-numerical values of n, the function is left unevaluated:

In[19]:=
ResourceFunction["RoseCurveProperties"][1, \[Pi]]
Out[19]=

When no available property is called, the function is left unevaluated:

In[20]:=
ResourceFunction["RoseCurveProperties"][1, 2/3, "Cats"]
Out[20]=

Neat Examples (2) 

Visualize the progression of the rose curve plot for integer-valued n:

In[21]:=
Manipulate[
 ResourceFunction["RoseCurveProperties"][1, k, "Plot", PlotStyle -> Hue[k/10]], {k, 1, 10, 1}]
Out[21]=

Plotting the first 10 rose curves for integer n on one graph:

In[22]:=
Show[Table[
  ResourceFunction["RoseCurveProperties"][1, k, "Plot", Axes -> False,
    PlotStyle -> {Black, Opacity[1 - k/10]}], {k, 1, 10}]]
Out[22]=

Plotting the first 10 rational n (with numerator 1) rose curves on one graph:

In[23]:=
Show[Table[
  ResourceFunction["RoseCurveProperties"][1, 1/k, "Plot", Axes -> False, PlotStyle -> {Black, Opacity[1 - k/10]}], {k, 1, 10}]]
Out[23]=

Version History

  • 1.1.0 – 10 May 2022
  • 1.0.0 – 19 October 2021

Related Resources

Author Notes

To view the full source code for RoseCurveProperties, evaluate the following:

In[1]:=
SystemOpen[
 FileNameJoin[{DirectoryName[FindFile["ResourceFunctionHelpers`"]], "RoseCurveProperties.wl"}]]

License Information