top of page
Music Apps

Xin-She Yang N.2 Function

Updated: Jul 18, 2021

Mathematical Definition

Input Domain

It is defined in the domain (-2π < Xi < 2π) where i = 1,2, ..., n. This function is not

smooth, and its derivatives are not well defined at the optimum (0, 0, ..., 0).

Global Minima

The Xin- She Yang N.2 Function has the global minimum f* = 0 at x* = (0, 0, ..., 0).

Description and Features

The Xin-She Yang N.2 Function is a multimodal function which is defined on n-dimensional spaces.

  • Non-differentiable

  • Non-linear

  • Non-Convex

  • Multimodal

  • Non-separable

Python Implementation

% Please forward any comments or bug reports in chat
Copyright 2021. INDUSMIC PRIVATE LIMITED.THERE IS NO WARRANTY, EXPRESS OR IMPLIED. WE DO NOT ASSUME ANY LIABILITY FOR THE USE OF THIS PROGRAM. If software is modified to produce derivative works, such modified software should be clearly marked. Additionally, user can redistribute it and/or modify it under the terms of the GNU General Public License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. See the GNU General Public License for more details.
% for any support connect with us on
% Author: Vanshita Tripathi

import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
from numpy import*
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
%matplotlib notebook
plt.rcParams['figure.figsize'] = (6,4)
fig= plt.figure()
ax= plt.axes(projection='3d')
def f(x1,x2):
   b= -(sin(x1*x1)+sin(x2*x2))
   a= (abs(x1) +abs(x2))*exp(b)
   return a
x1= linspace(2,-2)
x2= linspace(2,-2)
X1,X2= meshgrid(x1,x2)
ax.plot_surface(X1,X2,f(X1,X2), cmap='jet')
#ax.plot_wireframe(X1,X2,f(X1,X2), color='gray')


[1] Jamil, Momin, and Xin-She Yang. "A literature survey of benchmark functions for global optimization problems." International Journal of Mathematical Modelling and Numerical Optimization 4.2 (2013): 150-194.

338 views0 comments


bottom of page