The Valentine’s Equations

February 14th, 2008 | Categories: general math, mathematica, Wolfram Demonstrations | Tags:

A couple of weeks ago I started thinking about Valentine’s day and, since I like equations that have interesting plots so much, I wondered if I could find one that had a heart-shaped graph. A quick google search came up Wolfram Research’s Heart Surface page.

The main page described a couple of heart shaped algebraic surfaces which looked nice but there were a few more on the Mathematica notebook that the page linked to. This notebook was rather old and included plots from old versions of Mathematica so on the train ride home I wrapped these equations in some Manipulate functions and sent the resulting demo to Wolfram. The result was published today on the Wolfram Demonstrations site.

heart demo

Essentially all this demo does is use Mathematica’s ContourPlot3D function to plot the curves formed from the following equations and allow you to play with the results a bit.

 \light -\frac{8}{45} x^2 z^3-y^2 z^3+\left(\frac{32 x^2}{9}+2 y^2+z^2-1\right)^3 = 0


 \light -\frac{1}{10} x^2 z^3-y^2 z^3+\left(2 x^2+y^2+z^2-1\right)^3=0


 \light -x^2 z^3-\frac{9 y^2 z^3}{80}+\left(x^2+\frac{9 y^2}{4}+z^2-1\right)^3=0


 \light 320 \left(-x^2 z^3-\frac{9 y^2 z^3}{80}+\left(x^2+\frac{9 y^2}{4}+z^2-1\right)^3\right)=0

Each equation is named after the person who first wrote it down (to my knowledge at least). It’s a simple demo but I hope you like it.

Happy Valentine’s day.

  1. Archer
    October 28th, 2008 at 14:17
    Reply | Quote | #1

    Hello Mike,

    Thank you very indeed for these lovely articles you have put on the internet.

    I was looking for a way to make a HEART shape with MATLAB, and I searched google and I came across your website.

    I would highly and greatly appreciate it if you could do us a big favour and send me the full MATLAB code for designing this lovely picture.

    My email is

    Thank you in advance and I am looking forward to hearing from you.

    Kind Regards,


  2. koy chamnap
    November 30th, 2008 at 15:40
    Reply | Quote | #2

    How can i use this formula in matlab ?

  3. Mike Croucher
    December 15th, 2008 at 17:22
    Reply | Quote | #3


    See for MATLAB code.


  4. Paul Abbott
    February 19th, 2009 at 04:09
    Reply | Quote | #4

    The Taubin and Trott equations are identical — so why have them both?

  5. Mike Croucher
    February 19th, 2009 at 12:07
    Reply | Quote | #5

    Hi Paul

    You are absolutely right and I am rather embarrassed at not having noticed before!
    I guess I should update the demo at some point.