3
$\begingroup$

I imagine this question has been asked before so I apologize if this is a duplicate, but I could not find anything that answers my questions (will happily delete if I can be linked to the appropriate question with an answer).

I am trying to illustrate for my students how parametric curves are plotted, and I thought the following useful:

Animate[ParametricPlot[{Sin[2 x], Cos[6 x]}, {x, 0, n1},PlotRange -> {{-1, 1}, {-1, 1}}], {n1, 0, Pi}]

However, the animation begins by throwing an error: something about endpoints for x in the chosen interval must have distinct machine-precision numerical values. I assume the issue is because I have x ranging from $0$ to n1, where n1 ranges from $0$ to $\pi$. Thus, going from $0$ to $0$ at first is an issue.

Question: Is there a way I can have n1 vary from $0$ to $\pi$ without including $0$? Essentially, is there a way to not include the max or min or both for a chosen interval, where it may be akin to me saying to someone, "Plot the curve as $t$ ranges from $0$ to $\pi$, but make sure you do not include $0$."

The problem (or what I perceive to be the problem) carries over to uses of Manipulate as well such as if I wanted to look at Manipulate[1/i, {i, 0, 10}] where it's clear I do not want to actually start at $i=0$ but as close to it as possible from the right-hand side.

$\endgroup$
  • $\begingroup$ Manually set the starting value for your variable to a very small, non-zero value? You could use e.g. $MinMachineNumber instead of $0$ in your lower bound for n1 in Animate; it seems to work fine. $\endgroup$ – MarcoB Jan 27 '17 at 17:42
  • $\begingroup$ @MarcoB Thanks! I tried it in a few different scenarios and it works quite well. If you'd like to post your comment as an answer, then I will accept it, as you really did answer my question (and I imagine at least someone has encountered this issue before). $\endgroup$ – Daniel W. Farlow Jan 27 '17 at 17:52
2
$\begingroup$

You can manually set the starting value for your variable to a very small, non-zero value. You could use e.g. $MinMachineNumber instead of $0$ in your lower bound for n1 in Animate. It seems to work fine:

Animate[
 ParametricPlot[{Sin[2 x], Cos[6 x]}, {x, 0, n1}, PlotRange -> {{-1, 1}, {-1, 1}}],
 {n1, $MinMachineNumber, Pi}
]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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