DEV Community

Cover image for The equation to print a heart that will allow you to impress the world
DevLorenzo
DevLorenzo

Posted on • Updated on

The equation to print a heart that will allow you to impress the world

Hello World! Happy Valentine's day programmers!
I want to reveal to you a little trick that will be very useful for Valentine's day, an equation that allows you to print a heart on the screen.

(x^2+y^2-1)^3-x^2*y^3=0
Enter fullscreen mode Exit fullscreen mode

Alt Text


In reality, we have a lot of different equation that allows us to print a heart on screen:

(x^2 + y^2 -1)^3 = x^2*y^2
x^2+(3*y/2-(x^2)^(1/3))^2 = 1
x^6 + x^4 (3 y^2 - 3) + x^2 (3 y^4 - y^3 - 6 y^2 + 3) + y^6 - 3 y^4 + 3 y^2 = 1

// This one have the best rendering
x=16*sin(t)^3, y=13*cos(t)-5*cos(2*t)-2*cos(3*t)-cos(4*t)
Enter fullscreen mode Exit fullscreen mode

Alt Text


Happy Coding and Happy Valentine's day!

image

Remember the ❀

Check this article about how to write CSS like a pro!

Top comments (2)

Collapse
 
alnahian2003 profile image
Al Nahian

WOW !
Really Impressive...
Happy Valentines Day ❀

Some comments may only be visible to logged-in visitors. Sign in to view all comments.