# Intersection of Osculating Circle with a Parametric Curve

I have the following Parametric plot

Generated from the following:

Manipulate[
ParametricPlot[{(A*Cos[t]^2 + B)*{Cos[t], Sin[t]},
C*{Cos[t] + 1, Sin[t]}}, {t, 0, 2*Pi},
PlotRange -> {{-5, 5}, {-5, 5}}], {A, 1, 10}, {B, 1, 10}, {C, 1,
10}]


I would like to find the exact values of $C$ and $t$ such that the inner circle, with one point fixed to the origin is tangent to the outer curve. This would mean, if I'm not mistaken, for $t\in\left[0,\pi/2\right]$, solving the following system of equations for $t$ and $C$

x1 = (A*Cos[t]^2 + B)*Cos[t]
y1 = (A*Cos[t]^2 + B)*Sin[t]
x2 = C*(Cos[t] + 1)
y2 = C*Sin[t]
x1 == x2
y1 == y2


i.e. find the intersection of the curves, but also they should have the same tangent, so we have:

D[y1,t]/D[x1,t] == D[y2,t]/D[x2,t]


But, for some reason I can't find a solution. What am I doing wrong?

-
You might want to avoid using C, D, I, or N as constants in Mathematica. More generally, use initial lowercase for your constants. –  Hector Mar 21 at 23:48
Did mean for the circle to be osculating or merely tangent? –  Michael E2 Mar 22 at 0:07
@Michael E2 I guess just tangent (and I added a note about this in my response). –  Daniel Lichtblau Mar 22 at 0:18
yes, just tangent is enough. –  okj Mar 22 at 0:27

You don't have to calculate thing by hand in MMA. Use D and Cross to formulate expectations.

### One solution can be found analitically:

ClearAll[a, b , p1, p2, c]
p1[t_] := (a Cos[t]^2 + b)*{Cos[t], Sin[t]}
p2[t_] := c*{Cos[t] + 1, Sin[t]}

Solve[{
Cross[D[p1[t], t]].D[p2[t], t] == 0,
p1[t] == p2[t],
0 <= t <= Pi/2, c > 1
}, {t, c}, Reals] // Normal

{{t -> 0, c -> (a + b)/2}}


### General case with a and b fixed:

a = 5; b = 1;
sol = NSolve[{
Cross[D[p1[t1], t1]].D[p2[t2], t2] == 0,
p1[t1] == p2[t2],
c > 1,
0 <= t1 <= Pi, 0 <= t2 <= Pi}, {t1, t2, c}, Reals]

{{t1 -> 0, t2 -> 0, c -> 3.}, {t1 -> 1.10715, t2 -> 2.2143, c -> 2.23607}}

ParametricPlot[Evaluate[Join @@ ({p1[t], p2[t]} /. sol)], {t, 0, 2 Pi},
PlotRange -> {{0, 8}, {-3, 3}}, AspectRatio -> Automatic,
Epilog -> { PointSize@.02, Green, p2[t2] /. sol // Point},
PlotStyle -> {Black, Red, Black, Blue}, BaseStyle -> Thick]


### Edit: with FindRoot it can be insatneous:

(trivial soluion is not calculated)

ClearAll[a, b, p1, p2, c]
p1[t_, a_, b_] := (a Cos[t]^2 + b)*{Cos[t], Sin[t]}
p2[t_, c_] := c*{Cos[t] + 1, Sin[t]}

Manipulate[
sol = FindRoot[{Cross[D[p1[t1, a, b], t1]].D[p2[t2, c], t2] == 0,
p1[t1, a, b] - p2[t2, c] == 0},
{{t1, Pi/2.}, {t2, Pi/2.}, {c, a}}];

ParametricPlot[ Evaluate[{p1[t, a, b], p2[t, c] /. sol}], {t, 0, 2 Pi},
PlotRange -> {{-15, 15}, {-10, 10}}, AspectRatio -> Automatic,
PlotStyle -> {Orange, Blue}, BaseStyle -> Thick, ImageSize -> 600,
Epilog -> {PointSize@.02, Red, p2[t2, c] /. sol // Point,
Point[{(a + b), 0}], Blue, Circle[{(a + b)/2, 0}, (a + b)/2]},
]
, {a, 1, 10}, {b, 1, 5}]


-

--- edit ---

I forgot to address an issue which I now see was raised in a comment by @Michael E2. This setup is only going to give a tangent circle. If it osculates it is largely by accident. (Outright snogging, now that might be intentional.)

--- end edit ---

The issue is that these curves need not intersect at the same value of the parameter. So you can proceed as below.

aa = 2;
bb = 1;
x1[t_] = (aa*Cos[t]^2 + bb)*Cos[t];
y1[t_] = (aa*Cos[t]^2 + bb)*Sin[t];
x2[t_] = cc*(Cos[t] + 1);
y2[t_] = cc*Sin[t];
eqns = Flatten[{x1[t1] - x2[t2],
y1[t1] - y2[t2], {D[x1[t1], t1], D[y1[t1], t1]} -
lam*{D[x2[t2], t2], D[y2[t2], t2]}}];
sol = Solve[
GroebnerBasis[eqns, {t1, t2, cc}, lam] == 0 && 0 <= t1 <= Pi/2 &&
0 <= t2 <= 2*Pi, {cc, t1, t2}]

(* {{cc -> 3/2, t1 -> 0, t2 -> 0}, {cc -> 3/2, t1 -> 0,
t2 -> 2 \[Pi]}, {cc -> Sqrt[2], t1 -> -2 ArcTan[1 - Sqrt[2]],
t2 -> -4 ArcTan[1 - Sqrt[2]]}} *)

{x1[t1], x2[t2], y1[t1], y2[t2]} /. sol // N

(* Out[304]= {{3., 3., 0., 0.}, {3., 3., 0.,
0.}, {-1.41421356237, -1.41421356237, 1.41421356237,
1.41421356237}, {1.41421356237, 1.41421356237, 1.41421356237,
1.41421356237}} *)


A careful look will indicate that there are two such circles. One intersects at the east-most crossing of the x axis.

p1 = ParametricPlot[{x1[t], y1[t]}, {t, 0, 2*Pi},
ColorFunction -> (Green &)];
p2 = ParametricPlot[{x2[t], y2[t]} /. sol[[1]], {t, 0, 2*Pi},
ColorFunction -> (Blue &)];
p3 = ParametricPlot[{x2[t], y2[t]} /. sol[[3]], {t, 0, 2*Pi},
ColorFunction -> (Red &)];

Show[p1, p2, p3]


-
+1 because of GroebnerBasis –  Hector Mar 21 at 23:55
I think you may explain the role of lam –  belisarius Mar 22 at 0:03
@Artes Yep, I understand. I was thinking that Daniel's explanation could enrich his answer. Thanks! –  belisarius Mar 22 at 0:15
@belisarius Well, I needed to sacrifice a variable. Okay, I could have cross multiplied I guess. But that lam is still getting fleeced. –  Daniel Lichtblau Mar 22 at 0:15
The solution looks good, but I don't really understand the method you used. What was wrong with my original attempt (apart from syntax)? –  okj Mar 22 at 0:31