I could not resist to do a bit more with the heart function. Here is the plane heart again.
>plot2d("(x^2+y^2-1)^3-x^2*y^3",r=1.3, ... style="#",color=red,<outline, ... level=[-2;0],n=100):
Starting form this expression, we define a numerical expression, which computes the radius given the argument of (x,y).
>expr &= (x^2+y^2-1)^3-x^2*y^3 2 2 3 2 3 (y + x - 1) - x y >function fr(r,a) &= expr with [x=r*cos(a),y=r*sin(a)] | trigreduce 5 2 3 (sin(5 a) - sin(3 a) - 2 sin(a)) r (r - 1) + ----------------------------------- 16 >function map f(a) := bisect("fr",0,2;a)
Once, we have this, we can plot the heart turned around the y-axis.
>t=linspace(-pi/2,pi/2,100); r=f(t); >s=linspace(0,2pi,100)'; >plot3d(r*cos(t)*sin(s),r*cos(t)*cos(s),r*sin(t), ... > >hue,<frame,color=red,zoom=4.5,amb=0,max=0.7,grid=12):
Or, if we change the definition of s a little bit,