Useless is one of my favorite xkcd installments:

Useless (xkcd), by Randall Munroe – some rights reserved

It may not be the best heart representation ever seen, but at least it is described by a very simple formula – if you don’t mind using polar coordinates:
- The top does indeed look like the upper part of a heart symbol, but the bottom is a bit frustrating in that sense;
- You still can’t calculate the cosine of a polar curve (at least, not in a graphically meaningful way).
We can tackle the first problem by replacing the bottom of the curve. First we draw just the part that fits our heart’s desire for a heart, that is, the one with θ ∈ [-(1/3)π, (4/3)π]:

Now we can add a second curve that fits the remaining part with the more traditional sharp edge. But first let’s convert the formula to its cartesian equivalent, using the definitions: x(θ) = ρ.cos(θ) and y(θ) = ρ.sin(θ). Then we have, for θ ∈ [-(1/3)π, (4/3)π]:
y(θ) = sin(θ)-sin2(θ)
y(θ) = 2|(θ-(9/6)π)|+sin(4π/3)-sin2(4π/3)-π/3

which fits nicely into the top part:

The conversion to cartesian formulas also solves the other problem: it is reasonable to think that the cosine of a system of equations is obtainable by applying the cosine function to each of the equations – you can think about that either as applying the cosine to each coordinate of each point, or as doing that to the equations in matrix form. Or you can just use your heart and believe when I say it’s reasonable. Your call.
Anyway, by applying the cosine to the formulas above, we obtain the following graphic, which represents cos(♥):

The most frustrating part is that it’s not a closed curve – one might imagine a line linking the two edges and try some rorschach-esque interpretation (a friend of mine suggested a sillhuete of a female bust, but his heart was under heavy stress at the moment). Another interpretation is to realize that you simply end up with a broken, deformed heart (which is what happens after you find out that math is all you have left to deal with issues in your life).
Epilogue: The same techinque could be applied to the other formulas, which is, as usual, left as an exercise to the reader. A few pointers:
- The identity transformation looks trivial, but that is not acceptable (check the tooltip on the comic);
- Formulas that already treat the heart as a function (such as d/dx) can possibly be applied in a more straightforward way;
- Munroe seems to have replaced the Fourier transformation with a Laplacian on the comic’s t-shirt. Heck, work is never over!




Sim. Não há mais dúvida: Hail King of All Nerds!!!!
[Responder]
Just for the sake of completeness, I’ve found this slightly curvier (and simpler) heart function: http://bit.ly/nJZFjI
[Responder]