Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Heart-shaped curves for Valentine's Day

Project: HEARTS
Views: 191
Image: ubuntu2004

Plot heart-shaped curves (cardiods etc.) and solids

See this code as a Jupyter notebook with Sage kernel: https://cocalc.com/projects/1209def0-246c-43fd-b6c4-ae2804a3a6ac/files/Public/hearts.ipynb

See also: a rose, contributed by Andrzej Chrzeszczyk: https://cocalc.com/wstein/support/rose

Sources:

%var x,y,z t = (sin(3*z)**2).function(x,y,z) t = (1.5 - abs(z)/1.5).function(x,y,z) cm = colormaps.Reds w = 1.5 implicit_plot3d((x^2+(9/4)*y^2+z^2-1)^3-x^2*z^3-(9/80)*y^2*z^3 == 0, (x,-w,w),(y,-w,w),(z,-w,w), plot_points=80, color=(t,cm), smooth=False, frame=False)
3D rendering not yet implemented
r2(x,y) = x^2 + y^2 theta(x,y) = arctan2(y,x) f(x,y) = r2(x,y) - (1 - sin(theta(x,y)))^2 implicit_plot(f, (-1.3,1.3), (-2,1/4))