Formula for number of intersection points for Lissajous curve? Hi all:
I'm wondering if there is a simple formula for this.
Simple Example:
x=cos(pt);
y=cos(qt);
where p,q are integers. 

Question: How many intersection points are there?
0) only need to consider (p,q) are relatively prime.
1) Firstly, I thought it was just basic counting:
Let N(p,q) be the number of crossing. 
If p is odd, q is odd: N(p,q) = p(q-1) + (p-1)q = 2pq - p - q. 
If p is even, q is odd: N(p,q) = (p-1)(q-1)/2. 

But later I found some special cases p=2,q=5,where the intersection becomes unusual and the formula falls down.
Thanks
 A: EDIT: with both functions switched to cosine I get $$ \frac{(p-1)(q-1)}{2}  $$ for both odd-odd and for even-odd.
ORIGINAL, both functins sine: For $p$ even and $q$ odd I get $$ 2 p q - p - q  $$ which is the same as you have when both are odd.
Examples, I had to count over a few times,
(p,q,count) :
(2,1,1); (2,3,7); (2,5,13); (2,7,19); 
(4,1,3); (4,3,17); (4,5,31); (4,7,45);
(6,1,5); (6,5,49); (6,7,71); (6,11,115);
Then for both odd I get $$ \frac{(p-1)(q-1)}{2}  $$
(1,q,0);
(3,q, q-1);
(5,q, 2 q - 2);
(7,q, 3 q - 3);
However for both odd the figure is traced twice, there is no way around that, look on the website you supplied and slowly vary the maximum of $\Theta.$ So it is also reasonable to claim that both segments are doubled and what appears to be a single intersection counts as four as far as the parameter values are concerned. If you prefer that, the formula for both odd becomes
$$ 2 p q - 2 p - 2 q + 2.  $$
A: Whether you use $sin$ or $cos$ matters, as sine is an odd function because $sin(-\theta)=-sin(\theta)$, whereas cosine is an even function because $cos(-\theta)= cos(\theta)$.
If you draw a parametrized lissajous curve with $x=cos(nt), y=cos(mt)$, with n=2, m=5, you will get two intersections as I remarked in the comments above.  If you draw a parametric lissajous curve defined as $x=sin(nt), y=sin(mt)$ with n=2, m=5, you will get the 13 points of intersection that Will Jagy got above.
Your question posits a parametric Lissajous curve with an even $cosine$ function.  The website you point to draws out the example curves with an odd $sine$ function.  You should clarify exactly what you mean in your question.
Otherwise, the points I made in the comments above should help.
Consider the intersections occuring at the simultaneous constraints for multiple values of $\tau_k$, $k$ varying from $1$ to the number of intersection points:

$cos(nt+\tau_k)=cos(t)$
$cos(mt+\tau_k)=cos(t)$

I believe that if you look at the correct parametric form of the lissajous curve, your equation will be correct.
A: First let us think of generic curves: 
We say that a plane curve $C$ is generic (or non-degenerate) 
if $C$ is an immersed curve in the plane having only transverse dounble points. 
A Lissajous curve with frequencies $p,q$ and phase $c$ is given by the parametrization 
$$x(t)=cos (pt+c), y(t)=cos(qt).$$
Except for some finitely many values $c$, the curve is generic. 
Let $L(p,q)$ denote such a generic Lissajous curve, indeed, 
its topological type does not depend on the generic value $c$. 
A good reference is [V. F. Jones et al, Lissajous knots, Jour. Knot Thoery and Its Ramification (1994) 121--140]. 
By the way, V. I. Arnold introduced three basic invariants of topological types of generic plane curves, denoted by $J^+$, $J^-$ and $St$: 
[V. I. Arnol'd, Topological Invariants of Plane Curves and Caustics, Univ. Lect. Ser. Vol. 5, Amer. Math. Soc. (1994)].
The number $d$ of double points of a generic curve is always equal to $J^+-J^-$. 
For generic $L(p,q)$ with coprime $p$ and $q$, Arnold invariants are computed as follows: 
$$J^+(L(p,q))=(p-1)(q-1), J^-(L(p,q))=-pq+1,  St(L(p,q))=0,$$ 
(Sunao Kan-mura, 2002). In particular,  $d=2pq-p-q$. 
A degenerate Lissojous curve $L_0$, e.g. in case of $c=0$ as in the question, 
is doubly covered and has two singular `end' points. 
By slightly perturbing $c$, 
we obtain a generic Lissajous curve $L_c$. 
Observe how double points of $L_c$ are created, then we see the number of the intersection points of $L_0$ is $(p-1)(q-1)/2$. 
