From my understanding, but please correct me if I am wrong, this equation is implicit (See the attached screenshot).
However, the goal is to create an identical (or similar) shape that is defined using "parametric equations". Is there any good way to do that please? Thank you for the help.
In addition, if it is possible to configure this shape to be in the direct "center" of the graph (instead of being on the side), that would be even better.
In summary:
- Define this shape (does not have to be identical, just needs to be similar) using parametric equations
- Plot the equation/shape to be in the center of the graph (symmetrical by the y-axis)
Thank you for any advice or help.
Here's a plot of an approximation (with x and y axes swapped):
The actual code that produced the magenta diamonds in that plot was
Here $t$ should run from $0$ to $2*\pi$.
That was produced by several steps.
For each of 100 values values of t (call them $t_1, t_2, \ldots$) between $0$ and $2\pi$, I let $x = r \cos(t_i)$ and $y = r \sin(t_i)$ and then adjusted $r$ until $(y^2 + (x-1.2)^2 + 1.2*(x-1.2))^2 - 1.2^2 *(x - \frac{1.2}{2})$ was approximately $0$ using bisection on the range $0 \le r \le 2$. Call the resulting values of $x$ and $y$ by the name $x_i$ and $y_i$. Each pair $(x_i, y_i)$ was a point of the curve, or at least very close to it. The blue line-graph was created by connecting the dots using these points.
This got me a vector $X = \pmatrix{x_1\\x_2\\...\\x_{100}}$ and a corresponding vector $Y= \pmatrix{y_1\\y_2\\...\\y_{100}}$. For an arbitrary pair of vectors of 100 entries, I defined a 'dot product' $u \cdot v = \frac{1}{100} \sum_{i = 1}^{100} u_i v_i$.
I noticed that the function $x(t)$ that I was looking for had the property that $x(t) = x(-t)$ and that $x(t + 2\pi) = x(t)$; that meant that $x$ could be written as a sum of cosines of various frequencies. Similarly, because $y$ has the property that $y(t) = -y(-t)$, $y$ could be written as a sum of sines. So supposing that $x(t) = a_0 cos(0t) + a_1 cos(1t) + \ldots + a_7 cos(7t)$, I created vectors $C_k = \pmatrix{\cos(k t_0) \\ \cos(kt_1)\\ \dots \\ \cos(kt_{100})}$ and similarly for $S_k$, but with sines.
I computed \begin{align} a_0 &= C_0 \cdot X\\ a_1 = 2 C_1 \cdot X\\ \ldots a_7 = 2 C_7 \cdot X \end{align} and similarly \begin{align} b_0 &= S_0 \cdot X\\ b_1 = 2 S_1 \cdot X\\ \ldots b_7 = 2 S_7 \cdot X \end{align} The factor of 2 (and its missing on $a_0, b_0$) comes from considering sines and cosines of negative frequencies as well). As it happens, $b_0$ is always zero anyhow, because $S_0$ is the zero vector.
These numbers are the coefficients that I wrote in the formulas for $kx$ and $ky$ above.
The secret sauce here is "numerical approximation of the fourier transform of a continuous even (or odd) function on the circle" if you want to go read up on why this is the right way (or "a right way") to get here. Here's some very ugly matlab code that implements all this: