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 yy-values for one xx-value but combining two functions in two regimes, you can get close ( it is still missing that the first derivative must converge against ±\pm \infty for x=±1x=\pm 1).

x[1,1],f+(x)+,f(x)\forall x \in \left[-1, 1\right], f^+\left(x\right) \rightarrow \Re^+, f^-\left(x\right) \rightarrow \Re^-

f+(x)=xx2\color{red}{f^+\left( x \right)} = \sqrt{\left|x\right|-x^2}

f(x)=113(x2+2x)\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:

{% pdflatex usepackage=tikz %} \begin{tikzpicture} \draw[->] (-1.1,0) -- (1.1,0) node[right] {xx}; \draw[->] (0,-1.1) -- (0,1.1) node[above] {yy}; \draw[samples=100, domain=0:1,smooth,variable=\x,blue] plot ({\x}, {-sqrt(1-1/3(\x^2+2abs(\x)))}); \draw[samples=100, domain=0:1,smooth,variable=\x,blue] plot ({-\x}, {-sqrt(1-1/3(\x^2+2abs(\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}


Published

Category

snippets

Tags