(* Draw epicycloid twice in same space *) t = Table(j / 100, {j, 0, Pi*200}); u = Length(t); v1 = Round(3 * u / 4); x1 = 4 * Cos(t); (* create table of Sine *) y1 = Join(Part(x1, v1 + 1;; u), Part(x1, 1;; v1)); v2 = Round(3 * u / 16); x2 = Cos(4 * t); (* create table of Sine *) y2 = Join(Part(x2, v2 + 1;; u), Part(x2, 1;; v2)); x = x1 - x2; y = y1 - y2; Clear(v1, v2, x1, x2, y1, y2); (* blue will disappear *) Graphics({ Blue, Line(Partition(Riffle(x, y), 2)), Red, Line(Partition(Riffle(x, Table(4 * Sin(Part(t, j)) - Sin(4 * Part(t, j)), {j, 1, u})), 2)) })