Xah Talk Show 2025-05-15 Ep655 Wolfram language coding, spiragraph, Epicycloid Hypocycloid

xah talk show 2025-05-15 318a6
xah talk show 2025-05-15 318a6
xah talk show 2025-05-15 wl hypotrochoid 1e983
xah talk show 2025-05-15 wl hypotrochoid 1e983
xah talk show 2025-05-15 wl hypotrochoid 1fd0e
xah talk show 2025-05-15 wl hypotrochoid 1fd0e
Clear[Hypocycloid, Hypotrochoid, Epicycloid, Epitrochoid];

Hypocycloid::usage =
"Hypocycloid[n][t] return a parametrization of hypocycloid of n cusp.
Hypocycloid is defined as the trace of, a point on a circle that
rolls around the inside of a fixed circle.
n is an integer greater than 2. Also see ?Hypotrochoid.
Example:
ParametricPlot[ Hypocycloid[6][t], {t,0, 2 Pi}]
";

Epitrochoid::usage =
"Epitrochoid[a,b,h][t] return a parametrization of epitrochoid curve.
Parameter range: 0 <= t < n 2 Pi.
n is an integer greater than 0.

Epitrochoid is defined as the trace of a point, fixed in position to a circle C, while this circle rolls around a fixed circle.
a is the radius of the fixed circle.
b is the radius of the rolling circle.
h is the distance from the center of the rolling circle to the tracing point.

Example:
ParametricPlot[ Evaluate@ Epitrochoid[1,2/3,1][x], {x,0,2 2 Pi} ]
";

Hypocycloid[n_] := Hypotrochoid[1, 1/n, 1/n];

Hypotrochoid[a_, b_, h_] :=
Function[{t},
 {(a-b) Cos[t] + h Cos[-(a-b)/b t], (a-b) Sin[t] + h Sin[-(a-b)/b t]}
];

Epicycloid[n_] := Epitrochoid[1,1/n,1/n];

Epitrochoid[a_,b_,h_] :=
Function[{t},
 {(a+b) Cos[t] + h Cos[(a+b)/b t], (a+b) Sin[t] + h Sin[(a+b)/b t]}
];

(* HHHH------------------------------ *)

Clear[a, b, h];
a = 1;
b = 1/3;
h = 1/3;
ParametricPlot[
 {(a-b) Cos[t] + h Cos[-(a-b)/b t], (a-b) Sin[t] + h Sin[-(a-b)/b t]}
,
{t, 0, 10 Pi }
]

GraphicsArray @
(Partition[#, 5] &)@
((With[{b = #, p = Numerator@Abs@#, q = Denominator@#},
        ParametricPlot[
         Evaluate@Epitrochoid[1, b, Abs@b][t], {t, 0, 2*Pi*p},
         AspectRatio -> Automatic, Axes -> False,
         PlotStyle -> If[b < 0, Hue[0], Hue[.7]],
         Prolog -> {If[
            b < 0, {Text[DisplayForm@FractionBox[-p, q],
              Scaled[{0, 1}], {-1, 1}],
             Text[DisplayForm@FractionBox[-(q - p), q],
              Scaled[{1, 1}], {1, 1}]}, {Text[
              DisplayForm@FractionBox[p, q], Scaled[{1, 1}], {1, 1}],
             Text[DisplayForm@FractionBox[-(p + q), q],
              Scaled[{0, 1}], {-1, 1}]}]},
         DisplayFunction ->
          Identity]] &) /@ ((Join[-Select[#, # <= 1/2 &], #] &)@
       Union@(Join[#, Range[2, 7]] &)@
         Flatten@Table[p/q, {q, 7}, {p, q*2}]))