Is there a general method to compute the area/volume enclosed by an implicit curve/surface? If I have an implicit function $f_2(x,y) = C$ of a closed curve or an implicit function $f_3(x,y,z) = C$ of a closed surface, is there a general manner in which I can compute the area or volume enclosed by the curve or surface, respectively? Or is this dependent on the choice of functions?
 A: Suppose the boundary of a simply connected subset $R$ of $\mathbb{R}^2$ is defined by$f(x,y)=0.$  Using Green's theorem, the area of $R$ can be determined using a line integral of a vector field around the boundary of $R.$  For example, if $(x(t), y(t))$ is a parameterization of the boundary of $R$,
$$
  \int_{t_0}^{t_1} x(t)y'(t) dt \tag{1}\label{ref1}
$$
is the area of $R.$  To use this line integral for an implicit curve, one must break the implicit curve into segments and parameterize each segment (the parameterization doesn't matter, because \eqref{ref1} is the same for all parameterizations).

The shoelace formula for the area of a simple polygon is
$$
  A = \frac{1}{2}\left|\sum_{i=0}^{N-1} x_i y_{(i+1)} - \sum_{i=0}^{N-1} x_{(i+1)} y_i\right|
$$
where $x_N=x_0$ and $y_N=y_0.$  If one approximates the implicit curve as a sequence of line segments, the endpoints of the segments can be used as input for the shoelace formula to approximate the area of $R$.


As an example, consider the closed curve with equation
$$
f(x,y) = a_0 + a_2y + a_3x^2 + a_5y^2 + a_7x^2y + a_9y^3 + a_{10}x^4 + a_{12}x^2y^2 + a_{14}y^4=0
$$
where $a_0=-0.000171757$, $a_2=-0.0587018$, $a_3=0.0123361$, $a_5=0.300809$, $a_7=-0.0886163$, 
$a_9=-0.419146$, $a_{10}=0.0109686$, $a_{12}=0.068061$, and $a_{14}=0.178749$.  



The area computed using \eqref{ref1} is $A_{\textrm{exact}} = 0.9528787242506592$.  The area computed using the shoelace formula with 100 points equally spaced in arclength around the curve is $A_{100} = 0.950677$.  The area computed using the shoelace formula with 1000 points is $A_{1000} = 0.952855$.


To compute the volume of a closed surface defined by $S(x,y,z)=0$, one can create a triangle mesh whose vertices are all points of the surface.  Then the divergence theorem can be used to compute the volume as a sum of surface integrals over each curved triangle.  Again, each surface patch will need to be parameterized somehow.  An approximate volume can also be computed with the polyhedron volume formula derived using the divergence theorem.

