# Drawing a pair of pants using python

I am trying to draw a helicoidale trajectory on a pair of pants and to do this I need a parametric equation of the surface. Then I will compose $$(\cos(t), \sin(t))$$ with the parametrized equation.

Thus, I am trying to find the equation of a pair of pants. I found this:

https://www.quora.com/What-is-the-mathematical-expression-which-when-plotted-looks-like-a-pair-of-pants

The idea is well thought but I don't have really good results while drawing it...

Q: Do someone have any idea of the equation of a pair of pants ?

Thank you.

• Can you elaborate on why the solution in the Quora article (the surface $(1-z)((x-1)^2 + y^2 - 1/3)((x+1)^2 + y^2 - 1/3) + z (x^2 + y^2 - 1/3) = 0$) doesn't give "good results"? Does the equation need to be in a different form? If so, what kind of form? Jun 19, 2019 at 14:28
• I meant that when I plot it with my own implicit function program (that plot) I do not have the good result ! Do you know any surface that would look like a tube and that 'split' in two 'tubes' ? ANd for the form, I would prefere a parametric form but I can deal with others too Jun 19, 2019 at 14:38

Here's the equation from Quora as plotted using Maple, with the following commands:

eq:= (1-z)*((x-1)^2+y^2-1/3)*((x+1)^2+y^2-1/3) + z*(x^2+y^2-1/3):
plots:-implicitplot3d(eq, x=-1.7..1.7, y=-0.7..0.7, z=0..1, grid=[100,60,30],
scaling=constrained, axes=none, style=patchnogrid, lightmodel=light2);


What don't you like about it?

EDIT: If you want a parametric curve $$x = X(t), y = Y(t), z = Z(t)$$ on a surface defined by the implicit equation $$F(x,y,z) = 0$$, you could use a system of differential equations $$\dot{x} = f_1(x,y,z),\; \dot{y} = f_2(x,y,z),\; \dot{z} = f_3(x,y,z)$$. What you need in order to have the curve stay on the surface is $$\dfrac{\partial F}{\partial x} \dot{x} + \dfrac{\partial F}{\partial y} \dot{y} + \dfrac{\partial F}{\partial z} \dot{z} = 0$$ You will probably want to use numerical methods to solve the system of differential equations.

Here, for example, is a curve winding up one leg of the pants and onto the torso.

EDIT: The differential equation system I used was

\eqalign{\dot{x} &= \partial F/\partial y - \dfrac{ (\partial F/\partial x) (\partial F/\partial z)}{10 ((\partial F/\partial x)^2 + (\partial F/\partial y)^2)}\cr \dot{y} &= - \partial F/\partial x - \dfrac{(\partial F/\partial y) (\partial F/\partial z)}{10 ((\partial F/\partial x)^2 + (\partial F/\partial y)^2)}\cr \dot{z} &= 1/10\cr} where $$F = \left( 1-z \right) \left( \left( x-1 \right) ^{2}+{y}^{2}-1/3 \right) \left( \left( x+1 \right) ^{2}+{y}^{2}-1/3 \right) +z \left( {x}^{2}+{y}^{2}-1/3 \right)$$

• Ok I guess I was wrong on the efficiency of my program.... What I do not achieve is the composition of that surface and an helix. To clarify, I want to draw an helix shaped like a surface (for instance a cylinder, a torus, a square..). The pair of pants shaped surface is still giving me troubles. I do not understand how can I 'compose' my helix with that surface... Thank you for your answer, do not hesitate to ask me more questions about it. Jun 19, 2019 at 15:10
• I don't know what you mean by "composing" a helix with the surface. If you want to wrap a helix around it, the fact that the surface has three holes will be a problem. Jun 19, 2019 at 23:36
• when you compose (cos(t), sin(t)) with the parametric equation of a torus you obtain a helix curve on a torus like describe in the first answer of that post:math.stackexchange.com/questions/1044942/… Jun 20, 2019 at 7:33
• "Any curve γ(t)=(u(t),v(t)) whatsoever in R2, when composed with R, gives a curve on the torus. " Jun 20, 2019 at 8:30
• $\dot{x} = \partial F/\partial x$, $\dot{y} = -\partial F/\partial y$, $\dot{z} = 0$ would keep $z$ constant, so a curve at constant height. I made $\dot{z} = 1/10$ so $z$ would be slowly increasing, and added terms to $\dot{x}$ and $\dot{y}$ that would keep $\dfrac{\partial F}{\partial x} \dot{x} + \dfrac{\partial F}{\partial y} \dot{y} + \dfrac{\partial F}{\partial z} \dot{z} = 0$. Jun 25, 2019 at 11:49