Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x[t_] := t;
- y[t_] := Sin[t]
- r[t_] := {x[t], y[t]};
- curvature[t_] = Abs[D[D[y[t], t], t]]/(1 + (D[y[t], t])^2)^(3/2);
- radius[t_] = If[curvature[t] == 0, 99999, 1/curvature[t]];
- T[t_] = D[r[t], t]/Sqrt[D[r[t], t].D[r[t], t]];
- Tprime[t_] = D[T[t], t];
- circle[t_] := Module[{NNN, center, xc, yc},
- NNN = If[Tprime[t] == {0, 0}, {0, 0},
- Tprime[t]/Sqrt[Tprime[t].Tprime[t]]];
- center = radius[t]*NNN + r[t];
- xc = Extract[center, 1];
- yc = Extract[center, 2];
- {{xc, yc}, radius[t]}
- ];
- frame[tt_] :=
- Show[
- Graphics[
- {EdgeForm[Gray], FaceForm[RGBColor[0.95, 0.95, 1.0]],
- Module[{p, r},
- {p, r} = circle[tt];
- {
- Circle[p - {tt, 0}, r],
- Point[p - {tt, 0}],
- Gray,
- Line[{p - {tt, 0}, {0, y[tt]}}]
- }
- ]}
- , PlotRange -> {window {-1, 1}, {-5, 5}}],
- Plot[y[t + tt], {t, -window, window},
- PlotStyle ->
- Directive[Thick, Opacity[0.8], RGBColor[0.2, 0.3, 0.9]]]
- ];
- Manipulate[
- frame[tt],
- {tt,0,2Pi}
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement