Computing a real mathematical set given implicitly by function(s)
f1(x,y,z,...)=0, f2(x,y,z,...)=0, ... is really hard. Here's how I do what you want:
The implicit function theorem tell us that, off a set of measure 0, an analytic set can be locally parameterized by a number of parameters equal to the dimension of the set.
Your heart is a two-dimensional algebraic variety. Thus, we can compute a set of local patches, the union of which when taken together with the problematic set of measure 0, will describe the heart.
I wrote a computer program which does just this over the last several years as a postdoc. It's called Bertini_real, and is part of the Bertini suite of software products for computing solutions to algebraic equations. The field of mathematics this software comes from is called Numerical Algebraic Geometry.
First, we need to get some complex points on the surface. For this, we write an input file for Bertini, and call
tracktype 1 to compute the witness set. In this case, we expect six points, because the component is a hypersurface, which always has degree equal to the degree of the polynomial.
%file `input` for Bertini
%the real part describes a mathematical heart.
tracktype: 1; %compute the positive dimensional components
sharpendigits: 60; %sharpen to ludicrous accuracy
condnumthreshold: 1e300; %it's hard to be singular unless multiplicity>1
securitylevel: 1; %do not stop tracking paths going to infinity
odepredictor: 2; %use RK45
endgamenum: 2; %use the Cauchy endgame for computing singular points
numsamplepoints: 5; %use a total of 6 points in the endgame
variable_group x, y, z; %these are our variables
function f; %we'll have one function.
f = (x^2+9/4*y^2+z^2-1)^3 - x^2*z^3-9/80*y^2*z^3; %here's the function.
% we assume all functions equal 0
Great, now Bertini has confirmed that the surface is indeed of degree 6. Nice. Next is to get just the real part of this complex object. This is where Bertini_real comes in. The software unfortunately depends on Matlab right now, but we are working to replace it with Python so the software is completely free. Almost there as of December 2016.
bertini_real on the same input file. A whole bunch of stuff happens, including computing that set of measure 0 which cannot be well-parameterized by the two parameters. By the way, the two parameters we use for the computation of your surface are random orthogonal linear projections of the coordinates of the surface. The set of measure 0 is called the critical curve, and in this case consists of a curve which depends on the random projection, and a singular curve about the waist of the heart, as show below:
It doesn't look much like the heart you are after, and that's because this is the raw decomposition, and it needs to be refined. Invoking the
sampler from Bertini_real will refine it, using your settings. Here's an older refinement I produced a few months ago:
Looks better, right? I used my plotting software in Matlab for these images. Now, we export the surface to
.stl format. Perhaps there are better formats. I use
.stl. Importing into Blender reveals some faces are mis-oriented. Bertini_real does not compute normals, because the normal is ill-defined in higher ambient dimensions than 3. So, I let Blender do it for me.
recalculate normals function in Edit mode in Blender fixes this issue. At this point, we now have a well-oriented mathematical heart in Blender.
I take it one step further, and 3D print it. Here's a result:
We can do this process for any algebraic surface. You do not need to fuss around with trying to compute
z = f(x,y), because that happens implicitly as part of Bertini_real's decomposition. The set on which this parameterization fails is called the critical curve, and is itself decomposed with the curve decomposition routine.
If you have Matlab, you can do this yourself. If you know how to program in Python, perhaps you'd be interested in contributing to my software, in the form of visualization and
.stl export directly from Python, so I can eliminate Matlab?
The more complicated the surface, the more challenging the decomposition. Surfaces such as Barth's Dodecahedric are really hard to get to compute 100% correctly. But nice ones such as this heart, aren't that bad.
Check out Herwig Hauser's gallery of algebraic surfaces, and my reproduction in plastic.
If you want to learn more about the software I use, or the theory behind it, I recommend the book that goes with the software Bertini, called Numerically solving polynomial systems with Bertini. Not an intro book, but it tells you how to do things, and has worked examples.
Also, I made a 37 minute real-time video of me going from equation to printable object, using the above process including Blender for a significant portion of post-processing, available here.
I finally conclude that this answer does use software that is not part of the Blender world, but due to the genuine challenge of rendering implicit mathematical objects, a generic solution to this question is probably not going to be present in Blender any time soon.
Thanks for reading!
edit: since I now have sufficient rep, I added more links, and several concluding paragraphs
edit 2021-09-21: updated links