# Plotting algebraic surfaces using Mayavi

Who says math is not beautiful? Anyone who doubts the beauty in math must check out algebraic surfaces.

An implicit functions has the form:

$F(x,y,z, ...)=c$

where, $c$ is an arbitrary constant.

For example, the implicit equation of the unit circle is $x^2 + y^2 = 1$ and the equation $x^2 + y^2 + z^2 = 1$ describes a sphere of radius 1.

An algebraic surface is described by an implicit function $F(x,y,z) = c$. It may be rendered using Mayavi by evaluating the expression $F(x,y,z)-c=0$ on a regular (specified) grid, and then generate isosurface of contour value equal to 0.

Here are some examples of algebraic surfaces plotted using Mayavi:

I wrote a quick function called `implicit_plot` for plotting algebraic surfaces using Mayavi. The most important argument to the function is of course the expression  $F(x,y,z)-c=0$ as a `string`. It is probably not the best function, but the idea is to show how to plot implicit surfaces. The code snippet is included at the end of this post. Suggestions for improvement are always welcome.