Mathematical Definition

where $\epsilon$ is a random number that is drawn uniformly from $[0, 1]$


Xin-She Yang Function

Xin-She Yang Function

Xin-She Yang Function

Xin-She Yang Function

A contour of the function is presented below:

Xin-She Yang Function

Description and Features

  • The function is not convex.
  • The function is defined on n-dimensional space.
  • The function is separable.
  • The function is non-differentiable.

Input Domain

The function can be defined on any input domain but it is usually evaluated on $x_i \in [-5, 5]$ for $i=1, …, n$.

Global Minima

The global minima $f(\textbf{x}^{\ast})=0$ are located at $\mathbf{x^\ast}=(0, …, 0)$.


An implementation of the Xin-She Yang Function with MATLAB is provided below.

% Computes the value of the Xin-She Yang function.
% SCORES = XINSHEYANGN1FCN(X) computes the value of the Xin-She Yang
% function at point X. XINSHEYANGN1FCN accepts a matrix of size M-by-N and 
% returns a vetor SCORES of size M-by-1 in which each row contains the 
% function value for the corresponding row of X.
% For more information, please visit:
% Author: Mazhar Ansari Ardeh
% Please forward any comments or bug reports to mazhar.ansari.ardeh at
% Google's e-mail service or feel free to kindly modify the repository.
function scores = xinsheyangn1fcn(x)
    n = size(x, 2);

    scores = 0;
    for i = 1:n
        scores = scores + rand * (abs(x(:, i)) .^ i);

The function can be represented in Latex as follows:

f(\mathbf x)=f(x_1, ...,x_n)=\sum_{i=1}^{n}\epsilon_i|x_i|^i


  • Momin Jamil and Xin-She Yang, A literature survey of benchmark functions for global optimization problems, Int. Journal of Mathematical Modelling and Numerical Optimisation}, Vol. 4, No. 2, pp. 150–194 (2013), arXiv:1308.4008
  • X. S. Yang, “Test Problems in Optimization,” Engineering Optimization: An Introduction with Metaheuristic Applications John Wliey & Sons, 2010. [Available Online]: