Hello,

while going through my old University notes, I discovered this nice function.

A college of mine (hi Michael!) wanted to build a function which forms a heart and this is our result.

Obviously, a function cannot do this as you have multiple y -values for one x -value but combining two functions in two regimes, you can get close ( it is still missing that the first derivative must converge agains \pm \infty for x=\pm 1 ).

\forall x \in \left[-1, 1\right], f^+\left(x\right) \rightarrow \Re^+, f^-\left(x\right) \rightarrow \Re^-\\\ \color{red}{f^+\left( x \right)} = \sqrt{\left|x\right|-x^2} \\\ \color{blue}{f^-\left(x\right)} = -\sqrt{1-\frac{1}{3} \cdot \left(x^2+2 \cdot \left|x\right| \right)}

Here is the result:

Failed to render the following block of LaTeX:

\documentclass[standalone]{article}
\usepackage{tikz}
\begin{document}
\pagestyle{empty}

\begin{tikzpicture}
      \draw[->] (-1.1,0) -- (1.1,0) node[right] {$x$};
      \draw[->] (0,-1.1) -- (0,1.1) node[above] {$y$};
      \draw[samples=100, domain=0:1,smooth,variable=\x,blue] plot ({\x},  {-sqrt(1-1/3*(\x^2+2*abs(\x)))});
      \draw[samples=100, domain=0:1,smooth,variable=\x,blue] plot ({-\x}, {-sqrt(1-1/3*(\x^2+2*abs(\x)))});
      \draw[samples=100, domain=0:1,smooth,variable=\x,red]  plot ({\x},  {sqrt(abs(\x)-\x^2)});
      \draw[samples=100, domain=0:1,smooth,variable=\x,red]  plot ({-\x}, {sqrt(abs(\x)-\x^2)});
    \end{tikzpicture}
\end{document}