Who says math is not beautiful? Anyone who doubts the beauty in math must check out algebraic surfaces.
An implicit functions has the form:
where, is an arbitrary constant.
For example, the implicit equation of the unit circle is and the equation
describes a sphere of radius 1.
An algebraic surface is described by an implicit function . It may be rendered using Mayavi by evaluating the expression
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:
- Goursat: x^4+y^4+z^4+a(x^2+y^2+z^2)^2+b(x^2+y^2+z^2)+c=0
- Saddle: z = x^2 – y^2
- Double cone: z^2 = Ax^2 + By^2
- Schwarz P: cos(x) + cos(y) + cos(z) = 0
- Tear drop: x^2 + y^2 = (1-z)z^3
- Ding Dong: x^2 + y^2 = (1-z)z^2
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 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.
My interest in computer generated images and animation goes back to when I was in my 9th grade. Our computer teacher (Miss. Banurekha) wanted me and my dear friend Siddharth Choraria to participate in an inter-school computer graphics competition. I wasn’t any computer rock-star, but she had seen my pencil-sketches on the class notice board and thought that we do something useful. Of course, Siddharth was a brilliant student and we worked well together.