Sphere

Mathematical Definition
Latex
f(x) = {\sum_{i=1}^{n} x_i^{2}}
Description and Features

Dimensions: d

The Sphere function has d local minima except for the global one. It is continuous, convex and unimodal. The plot shows its two-dimensional form.

  • The function is continuous.
  • The function is convex.
  • The function can be defined on n-dimensional space.
  • The function is differentiable.
  • The function is separable.
  • The function is unimodal.
Input Domain

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

Global Minima

The function has one global minimum $f(\textbf{x}^{\ast})=0$ at $\textbf{x}^{\ast} = (0, …, 0)$.

Implementation
Python Code

def function(x):
    x = np.array(x)
    return np.sum(np.square(x))

            
Solutions
References: