I came across an interesting function I hadn’t seen before, called Himmelblau’s function. Its definition is pretty simple:

z = f(x, y) = (x^2 + y – 11)^2 + (x + y^2 – 7)^2

I graphed the function using the R language with these commands:

x<-seq(-5, 5, length=50)
y<-seq(-5, 5, length=50)
f<-function(x,y) { (x^2 + y -11)^2 +
(x + y^2 - 7)^2 }
z<-outer(x,y,f)
nrz<-nrow(z)
ncz<-ncol(z)
jet.colors <- colorRampPalette(c("blue","cyan","green",
+ "yellow","orange","orange","red", "red", "red"))
nbcol<-64
color<-jet.colors(nbcol)
zfacet<-z[-1,-1]+z[-1,-ncz]+z[-nrz,-1]+z[-nrz,-ncz]
facetcol<-cut(zfacet,nbcol)
persp(x,y,z,col=color[facetcol],phi=40,theta=45,d=5,r=1,
+ ticktype="detailed",shade=0.1,expand=0.7)

Himmelblau’s function is used when experimenting with numerical optimization algorithms. Unlike most benchmark functions which have one minimum value to search for, the Himmelblau function has four minimum points:

z = 0 at x = 3.00, y = 2.00
z = 0 at x = -2.805118, y = 3.131312
z = 0 at x = -3.779310, y = -3.283186
z = 0 at x = 3.584428, y = -1.848126

Because there are multiple targets, the function is called a multi-modal function.

### Like this:

Like Loading...

*Related*