Mayon volcano refused to show its glory last weekend. It was like a beautiful but shy girl that hides her face behind a veil of clouds. You know the beauty that it is hiding but it keeps you in suspense and wants you go to back there and try your luck again to see it in all its splendor.

Fortunately, Mayon is a perfect cone volcano and it does not take a lot of effort to imagine how it looks like. I was inspired by Mayon to generate its shape using some computer algebra tools at my disposal. The first tool I used is the tool I always bring with me, the iPhone. The iPhone has a neat computer algebra system called Spacetime. It can do a lot of things you would expect from a Computer Algebra System among which is plotting surfaces. To plot the surface of Mayon, I used a coordinate system that is suited to its symmetrical shape. This coordinate system is the cylindrical coordinate system.

**Cylindrical Coordinate System**

Any point in three dimensions can be specified by three numbers. In the rectangular coordinate system, which we are very familiar with, these three numbers correspond to the x, y and z coordinates of the point. Shown below is how we specify a point using the rectangular coordinate system.

The rectangular coordinate system is not always the most convenient system to use. For example, to specify a circle in rectangular coordinates, you need to specify it as

where r is the radius of the circle.

In fact, we can specify a circle even simpler by using polar coordinates. We only need to specify the radius and the angle. For a circle of radius 1, the equation is

How simple can it get?

In generating the cone, we use a coordinate system that naturally fits the geometry of the cone. This coordinate system is called the *cylindrical coordinate system*. Imagine a point p in space and a cylinder that contains this point. We can specify the position of this point in the cylinder by three numbers. The first number specifies the height of this point from the xy plane. The second number specifies the distance of this point from the z axis. The last number specifies the angle that this point makes from the x axis. Below is a diagram of the cylindrical coordinate system.

**Specifying the Cone Using Cylindrical Coordinates**

Since the cone has circular symmetry around the z axis, we only need to specify the value of z with respect to r. Any plane that passes along the z axis intersects the cone through a line that lies on the cone. The diagram below shows the line of intersection of a cone of height and whose base has radius .

The equation of this line has the form

where is the slope and is the z intercept. When r=0, we have . When we have . Therefore, we can specify z as:

.

Mayon has a base approximately 4 times its height. Using and , we can then specify the cone as

.

Using the function CylindricalPlot3D of spacetime, we get the plot of the cone as shown below.

**Surface Plot Using Rectangular Coordinates**

The plot of the cone using cylindrical coordinates is elegant. It used the circular symmetry of the cone around the z axis. We can still plot the cone using rectangular coordinates but it is quite messy. To do this, I used another tool called R. It’s a statistical computing tool but it has a great 3D plotting engine. Here is the R code I used to generate the plot:

# interval is the distance between points in the x or y axis interval=2 # noisemean is the mean of the gaussian noise we want to introduce into the plot to # simulate rugged mountain noisemean=0 # noisedev is the standard deviation noisedev=1 # addnoise is a boolean. It specifies if we want to add the noise addnoise=T # generate the x and y vectors below using the interval between points x=seq(-10,10,interval) y=seq(-10,10,interval) # generate the matrix of squares for the y axis l=length(x) yy=y^2 %*% t(rep(1,l)) # generate the matrix of squares for the x axis, which turns out to be just the transpose of yy xx=t(yy) # compute the zz coordinate: zz = -0.5* r +4 # but first let's compute r^2, let's call it rr rr=xx + yy zz = -0.5 * sqrt(rr) + 4 # plot only values greater than or equal to 0 myfunc=function(n){ if(n<0){ 0 } else { n } } mayon= mapply(myfunc,zz) # add some noise if(addnoise){ noise=0.1*matrix(rnorm(l^2,noisemean,noisedev),l,l) mayon=mayon+ noise } # plot using rgl library(rgl) persp3d(x,y,mayon,col="yellowgreen",aspect=c(4,4,1))

Below is the result of running the above code.

This how I see mayon through the lens of mathematics. But I definitely want to go back there and see its imposing grandeur.