3
$\begingroup$

I want to plot the image of

$ \qquad y-\sin t=\tan(2t)(x-\cos t) $

where the parameter $ t $ satisfies

$ \qquad\cos(t)(1+\sin^2(2t))-\sin(2t)\sin(t)=2x $.

In fact, I want to plot the envelope of

$ \qquad F=y-\sin(t)-\tan(2t)(x-\cos t)=0 \quad s.t.\quad\partial F/\partial t =0$

I use the command ContourPlot like so:

ContourPlot[{y - Sin[s] == Tan[2 s] (x - Cos[s]),
             Sin[s] (Cos[2 s]^2 - Cos[2 s] Sin[2 s]) + 2 Cos[s] == 2 x},
            {x, -1, 1}, {y, -1, 1}]

But it went wrong.

How can I get the correct image?

$\endgroup$
5
  • $\begingroup$ How is Mathematica supposed to deal with s in your command line? $\endgroup$
    – anderstood
    Commented Nov 2, 2017 at 23:18
  • $\begingroup$ Can you add the missing ")" in the second equation? $\endgroup$
    – c186282
    Commented Nov 2, 2017 at 23:18
  • $\begingroup$ I have added the ")". $\endgroup$
    – Joe Smith
    Commented Nov 2, 2017 at 23:21
  • $\begingroup$ Well, I don't know how to correctly write the command dealing with "s". I just have a try, but it is obviously a wrong method. $\endgroup$
    – Joe Smith
    Commented Nov 2, 2017 at 23:23
  • $\begingroup$ This and this are related questions. $\endgroup$ Commented Nov 3, 2017 at 14:44

3 Answers 3

5
$\begingroup$

In fact, I want to plot the envelope of $ \qquad F=y-\sin(t)-\tan(2t)(x-\cos t)=0 \quad s.t.\quad\partial F/\partial t =0$

Here's how to quickly visualize an envelope of lines:

With[{n = 100}, 
     env = Graphics[{Directive[Opacity[1/2, Gray], Thin], 
                     Table[InfiniteLine[{Cos[t], Sin[t]}, {1, Tan[2 t]}],
                           {t, 0, 2 π, 2 π/(n - 1)}]}]]

nephroid as envelope

Generate the parametric equations of the envelope:

Simplify[{x, Tan[2 t] (x - Cos[t]) + Sin[t]} /. 
First[Solve[D[Tan[2 t] (x - Cos[t]) + Sin[t], t] == 0, x]]]
   {(3 Cos[t] - Cos[3 t])/4, Sin[t]^3}

and show the lines and the curve together:

Show[env,
     ParametricPlot[{(3 Cos[t] - Cos[3 t])/4, Sin[t]^3}, {t, 0, 2 π}, PlotStyle -> Thick]]

nephroid with enveloping lines


As a bonus (and also as a demonstration on how to handle more complicated envelopes), here's another way to generate a nephroid, as the envelope of circles:

With[{circ = #.# &[{x, y} - {Sin[t]/2, Cos[t]/2}] - (Cos[t]/2)^2},
     neph = Simplify[First[GroebnerBasis[Append[{circ, D[circ, t]},
                                                Cos[t]^2 + Sin[t]^2 - 1],
                                         {x, y}, {Cos[t], Sin[t]}]]/y]]
   64 x^6 + 12 x^2 (1 - 4 y^2)^2 + 48 x^4 (-1 + 4 y^2) + (-1 + y^2) (1 + 8 y^2)^2

With[{n = 81},
     Show[Graphics[{Directive[Opacity[1/2, Gray], Thin], 
                    Table[Circle[{Sin[t]/2, Cos[t]/2}, Abs[Cos[t]/2]],
                          {t, 0, 2 π, 2 π/(n - 1)}]}, Frame -> True], 
          ContourPlot[neph == 0, {x, -3/4, 3/4}, {y, -1, 1}, ContourStyle -> Thick]]

nephroid as circle envelope

$\endgroup$
4
$\begingroup$

I would do something very similar to @c186282's answer, except that I would solve things symbolically instead. For instance:

sol = Values @ First @ Solve[
    {
    y - Sin[t] == Tan[2t](x - Cos[t]),
    Cos[t] (1 + Sin[2t]^2) - Sin[2t] Sin[t] == 2x
    },
    {x, y}
]

{1/2 (Cos[t] - Sin[t] Sin[2 t] + Cos[t] Sin[2 t]^2), 1/2 (2 Sin[t] - Cos[t] Tan[2 t] - Sin[t] Sin[2 t] Tan[2 t] + Cos[t] Sin[2 t]^2 Tan[2 t])}

And then plot:

ParametricPlot[sol, {t, 0, 2Pi}, AspectRatio->1]

enter image description here

Notice the absence of the vertical artifacts at $x\approx \pm 0.35$. For you second question, I would proceed similarly:

F=y-Sin[t]-Tan[2t](x-Cos[t]) == 0;
sol = Values @ First @ Solve[{F, D[F, t]}, {x, y}]

ParametricPlot[sol, {t, 0, 2Pi}]

{1/2 (2 Cos[t] - Cos[t] Cos[2 t]^2 - Cos[2 t] Sin[t] Sin[2 t]), 1/2 (2 Sin[t] - Cos[t] Cos[2 t] Sin[2 t] - Sin[t] Sin[2 t]^2)}

enter image description here

$\endgroup$
1
  • $\begingroup$ Symbolic, good choice. $\endgroup$
    – c186282
    Commented Nov 3, 2017 at 0:33
1
$\begingroup$

First I make a function to solve for your $(x,y)$ point then I plot it.

Clear[xy]
xy[t_?NumericQ] := Module[{sol, x, y},
sol = Solve[{
  y - Sin[t] == Tan[2 t] (x - Cos[t]),
  Cos[t] (1 + Sin[2 t]^2) - Sin[2 t] Sin[t] == 2 x}, {x, y}];
Return[{x, y} /. sol[[1]]]
];

Notice I use ?NumericQ in the function definition this forces the numeric evaluation during the plotting.

Then I plot it:

ParametricPlot[xy[t], {t, 0, 2 Pi}, AspectRatio -> 1]

enter image description here

$\endgroup$
2
  • $\begingroup$ I'm so sorry that the second equation is wrong that I inserted the ")" in a wrong place. Now I have fixed it. But when I try the correct version on my computer, I still can not get the correct image. It should be part of the cardiod. $\endgroup$
    – Joe Smith
    Commented Nov 2, 2017 at 23:41
  • $\begingroup$ I also updated my plot and got what is now shown $\endgroup$
    – c186282
    Commented Nov 2, 2017 at 23:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.