CalculusWithJuliaNotes.jl/CwJ/differentiable_vector_calculus/data/hearts.mmd

30 lines
1.2 KiB
Plaintext
Raw Normal View History

2022-05-24 19:51:49 +02:00
From [bennedich](https://discourse.julialang.org/t/love-in-245-characters-code-golf/20771)
```
0:2e-3:2π .|>d->(P=
fill(5<<11,64 ,25);z=8cis(
d)sin(.46d);P[ 64,:].=10;for
r=0:98,c=0 :5^3 x,y=@.mod(2-
$reim((.016c-r/49im-1-im)z),
4)-2;4-x^2>√2(y+.5-√√x^2)^
2&&(P[c÷2+1,r÷4+1]|=Int(
")*,h08H¨"[4&4c+1+r&
3])-40)end;print(
"\e[H\e[1;31m",
join(Char.(
P)))
);
```
[New York Times](https://www.nytimes.com/2019/02/14/science/math-algorithm-valentine.html)
Süss — German for “sweet” — is an interactive widget that allows you to tweak the algebra and customize the heart to your soulss delight. It was created for Valentines Day by Imaginary, a nonprofit organization in Berlin that designs open-source mathematics programs and exhibitions.
You can stretch and squeeze the heart by moving the two left-most sliders, which change the “a” and “b” parameters; the right-most slider zooms in and out. Better yet, canoodle directly with Süsss equation and engage in the dialectical interplay between algebra and geometry. (Change that final z³ to a z² to see the heart in its underwear.)
```
(x^2+((1+b)*y)^2+z^2-1)^3-x^2*z^3-a*y^2*z^3
```