# Why is there always a horizontal tail line on the parametric curve?

I am trying to create a smooth, piecewisely continuous and differentiable curve by using Mathematica's Floor function, which is as in:

p = ParametricPlot[{(1/4 π (1 + 2 t - 2 Floor[t])) -
Cos[(1/4 π (1 + 2 t - 2 Floor[t]))] Sin[(1/
4 π (1 + 2 t - 2 Floor[t]))] +
Floor[t/π] (Pi/2 + 1),
2 - Cos[(1/4 π (1 + 2 t - 2 Floor[t]))]^2}, {t, 0, 3 Pi},
ImageSize -> Large, PlotStyle -> Blue,
PlotRange -> {{0, 3 Pi}, {1.5, 2.2}}, Frame -> {True, True, False, False}];
p1 = ParametricPlot[{1/
4 (π + 2 π t - 2 Cos[π (-t + Floor[t])] -
2 π Floor[t] + 2 (2 + π) Floor[t/π]),
1/2 (3 + Sin[π (t - Floor[t])])}, {t, 0, 2 Pi},
ImageSize -> Large, PlotStyle -> Green,
PlotRange -> {{0, 3 Pi}, {1.5, 2.2}}, Frame ->{True, True, False, False}];
GraphicsGrid[{{p1}, {p}}]


It is very strange that the obtained curve always has a horizontal tail at the right side, whenever how the x range is set. Is it because of the Floor function I am using or any other reason? How can I remove the unexpected horizontal tails?

When you are using Floor you are bound to make a discrete jump at some point, as it only returns you the nearest integer. Depending on your other function this jump may be visible or not. What you are calling a tail is can be a manifestation of a jump. Most Probably it is coming because you are using Floor with a trigonometric function (as you know $\sin (x) = \sin (x+2\pi))$.

Lets clarify it with an example. I Took your first parametrisation, and make a list plot. First I choose a large interval between data points (d=Pi/10.)

d = Pi/10.;
dat = Table[{(1/4 \[Pi] (1 + 2 t - 2 Floor[t])) - Cos[(1/4 \[Pi] (1 + 2 t - 2 Floor[t]))] Sin[(1/ 4 \[Pi] (1 + 2 t - 2 Floor[t]))] +
Floor[t/\[Pi]] (Pi/2 + 1), 2 - Cos[(1/4 \[Pi] (1 + 2 t - 2 Floor[t]))]^2}, {t, Pi, 3 Pi,d}];

ListLinePlot[dat[[All, 1]]]
ListLinePlot[dat[[All, 2]]]
ListLinePlot[dat] As you can see your plot (3rd figure) has a lot of back and forth movement. This appears because your two consecutive $x$ value difference is more than $\pi$. These movements become less visible when you choose smaller gap say, d=Pi/100. So in conclusion I can say the tails are coming from a jump in your $x$ values when the jump height is more than $\pi$.

• Thank you! I also tried to plot the same curve by Geogebra's curve command and there is no such issue. Additionally, it seems Mathematica or Maple cannot handle the differentiation of functions including Floor correctly. – LCFactorization Apr 1 '15 at 2:34

Just an observation, neither nice nor neat:

p = ParametricPlot[{(1/4 \[Pi] (1 + 2 t - 2 Floor[t])) -
Cos[(1/4 \[Pi] (1 + 2 t - 2 Floor[t]))] Sin[(1/
4 \[Pi] (1 + 2 t - 2 Floor[t]))] + Floor[t/\[Pi]] (Pi/2 + 1),
2 - Cos[(1/4 \[Pi] (1 + 2 t - 2 Floor[t]))]^2}, {t, 0, 6 Pi},
PlotStyle -> Blue, PlotRange -> {{0, 4 Pi}, {0, 2.2}},
Frame -> {True, True, False, False}]
p1 = ParametricPlot[{1/
4 (\[Pi] + 2 \[Pi] t - 2 Cos[\[Pi] (-t + Floor[t])] -
2 \[Pi] Floor[t] + 2 (2 + \[Pi]) Floor[t/\[Pi]]),
1/2 (3 + Sin[\[Pi] (t - Floor[t])])}, {t, 0, 6 Pi},
ImageSize -> Large, PlotStyle -> Green,
PlotRange -> {{0, 4 Pi}, {0, 2.2}},
Frame -> {True, True, False, False}] 