# Endless heart equation

 Tweets by @hatzivelkos Share the post "Endless heart equation" As you can see from the start, this blog post is different from my usual ones. First, it is written in English, and second, it is all about math. Or its popular side. Topic of this post is heart shaped curve. Drawing mathematical curves that resemble to heart symbol is few centuries long. In 18. century we find notion of cardioide, in works of Italian mathematician and astronomer Giovanni Francesco Mauro Melchiorre Salvemini di Castiglione. Curve, whose equation in polar coordinates reads $$r(\varphi) = a(1 – \sin \varphi )$$, was already studied for several decades, but it was di Castiglione who named it after its heartlike appearence. Although, we should be fair – curve looks more as cross section of an apple. Two hundred and fifty years later, while working on algebraic surface visualization algorithms,  Gabriel Taubin formulated implicit equation for “heart surface“: $$! (x^2 + (1.5)^2\cdot y^2 + z^2 – 1)^3 – x^2 z^3 – \frac{(1.5)^2}{20} y^2 z^3 = 0$$ If we intersect that surface with plane $$y=0$$ (and substitute $$y$$ for $$z$$), we get probably best known formula for heartlike curve, $$(x^2+y^2-1)^3-x^2y^3=0$$. There are several more heartlike curves, described in Eric Weisstein’s article on Wolfram MathWorld site, but out topic today goes bit further. One single heart isn’t enough. Math can be found anywhere, if you choose to look the world around you that way. This time, I found inspiration in a sculpture installation, named “Europa’s solar plexus”, which is located on lake Jarun in Zagreb, Croatia. Among others there is work of Miroslav Juraj, marked with the sign of three nested hearts. But, why stop on three? And, is there mathematical equation which describes such curve? Well, answer is – there is. First thing is to see that nested heart curve is made of two parts – to be more precise, two ellipsoid spirals. Without going into “too much math”, such curves are described with parametric equations $$! r_{1,2}= \left[ \begin{array}{c} \pm \, e^{\alpha t} \cdot \cos t \pm k\cdot e^{\alpha t} \cdot \sin t\\ – e^{\alpha t}\cdot\cos t + k\cdot e^{\alpha t}\cdot \sin t \end{array} \right]$$ There are two parameters which allow us to model nested heart curve. By choosing value for parameter $$k$$ we can determine general look of hearts – will they be more “spiky” or more “rounded“. On the other hand, parameter $$\alpha$$ allows us to determine how fast hearts will shrink. For instance, if we set $$k$$ to be 2, and $$\alpha$$ to -0.2, we get following curve: As we can see, hearts shrink too fast, so we should choose different (greater) value for $$\alpha$$ if we want hearts to be nested, one into another. One other thing, visual complaint could be that heart shape is too “spiky”. If we want more “rounded” shape, $$k$$ should be smaller. If you want to try out drawing endless heart curve for different values of $$k$$ and $$\alpha$$, you can use following code in Wolfram Mathematica: a = -0.2; k = 2; p = ArcCos[-k/Sqrt[1 + k^2]] – Pi; ParametricPlot[{{Exp[a*t] Cos[t] + k*Exp[a*t] Sin[t], -Exp[a*t] Cos[t] + k*Exp[a*t] Sin[t]}, {-Exp[a*t] Cos[t] – k*Exp[a*t] Sin[t], -Exp[a*t] Cos[t] + k*Exp[a*t] Sin[t]}}, {t, p, p + 12 Pi}, PlotRange -> 2, PlotStyle -> {Black, Thick}] Here are some examples for several combinations of $$k$$ and $$\alpha$$: $$k=3$$, $$\alpha = -0.242$$  $$k=2$$, $$\alpha = -0.153$$  $$k=\frac{\Pi}{2}$$, $$\alpha = -0.098$$ $$k=1.618$$, $$\alpha = -0.105$$, where $$k$$ is value of golden ratio, $$\frac{1+\sqrt{5}}{2}$$ So, which is your favorite one? In the end, it is impossible not to notice appearance of Euler extension of exponential functions for complex numbers in equation of curve, $$e^{\alpha + \beta i}=e^{\alpha}\cdot (\cos \beta + i \sin \beta)$$. If we rewrite formula using Euler’s notation (and for $$k=\frac{\Pi}{2}$$, $$\alpha = – 0.098$$), we get: $$! r_{1,2} = \left[ \begin{array}{l} \pm \text{Re } e^{t(i-0.098)} \pm \pi / 2\cdot \text{Im } e^{t(i-0.098)}\\ – \text{Re } e^{t(i-0.098)}+\pi / 2 \cdot \text{Im } e^{t(i-0.098)} \end{array} \right]$$ Let this equation, and its animation below, serve as a little token of dedication to Euler and its beutifull equation, $$e^{i \Pi} -1 =0$$. Animate[ParametricPlot[{{Exp[-0.098 t] Cos[t] + Pi/2*Exp[-0.098 t] Sin[t], -Exp[-0.098 t] Cos[t] + Pi/2*Exp[-0.098 t] Sin[t]}, {-Exp[-0.098 t] Cos[t] – Pi/2*Exp[-0.098 t] Sin[t], -Exp[-0.098 t] Cos[t] + Pi/2*Exp[-0.098 t] Sin[t]}}, {t, -0.567, a}, PlotRange -> 2.0], {a, -0.567, -0.567 + 12 Pi}] [youtube ]https://www.youtube.com/watch?v=2x0acxLYVNw[/youtube] PS: Main inspiration came from love for my wife and son. <3 Share the post "Endless heart equation"