#*****************************************************************************80
#
## mexican_hat_surface makes a 3D surface plot of "Mexican hat" data.
#
# Licensing:
#
# This code is distributed under the GNU LGPL license.
#
# Modified:
#
# 30 August 2020
#
# Author:
#
# John Burkardt
#
mexican_hat <- function ( x, y )
{
r <- sqrt ( x^2 + y^2 + 0.000001 )
z = sin ( r ) / r
}
cat ( "\n" )
cat ( "mexican_hat_surface:\n" )
cat ( " ", version$version.string, "\n" )
cat ( " Make a 3D surface plot of Mexican hat data.\n" )
#
# Create the data
#
x = seq ( from = -8.0, to = +8.0, len = 33 )
y = seq ( from = -8.0, to = +8.0, len = 33 )
z = outer ( x, y, mexican_hat )
filename = 'mexican_hat_surface.png'
png ( filename )
persp ( x, y, z,
theta = 60,
phi = 30,
main = "Mexican Hat function",
col = "orange" )
cat ( "\n" )
cat ( " Graphics saved as '", filename, "'\n" )
#
# Terminate.
#
cat ( "\n" )
cat ( "mexican_hat_surface:\n" )
cat ( " Normal end of execution.\n" )
quit ( )