Search

# Python Implementation of MATYAS FUNCTION

Updated: Aug 5, 2021

**Mathematical Definition**

**Input Domain**

Matyas Function is usually evaluated on the square xi∈ [-10, 10], for all i = 1, 2.

**Global Minima**

The function has one global minimum f(*𝑥*∗)=0 at *𝑥*∗ =(0,0)

**Characteristics**

The function is continuous.

The function is convex.

The function is defined on 2-D space.

The function is unimodal.

The function is differentiable.

The function is non-separable.

The function has no local minima except the global one

**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 help**.**indusmic@gmail**.**com*
**# Author****:**** Dhanishtha Sharma**** **
import sympy
import math
from sympy import symbols
from sympy import *
from sympy.plotting import plot3d
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)
plt.rcParams['figure.dpi']=150
fig=plt.figure()
ax=fig.add_subplot(111,projection='3d')
x1,x2=symbols('x1 x2')
plot3d(0.26*((x1**2)+(x2**2))-(0.48*x1*x2)) ,(x1,-10,10,2),(x2,-10,10,2)

**References:**

[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.