Global minimization of bivariate functions

Analytic bivariate polynomials

Consider the problem of minimizing a bivariate polynomial

\[\begin{split}\underset{x,y\,\in\,\R}{\operatorname{minimize}}&~~p(x,y)\mbox{,}\end{split}\]

or more generally, a rational function

\[\begin{split}\underset{x,y\,\in\,\R}{\operatorname{minimize}}&~~\frac{p(x,y)}{q(x,y)}\mbox{.}\end{split}\]

Since all local minimizers \((x^*,y^*)\) are stationary points, they are roots of the system of bivariate polynomials

\[\begin{split}\frac{\partial p}{\partial x}q - p\frac{\partial q}{\partial x} &= 0\\ \frac{\partial p}{\partial y}q - p\frac{\partial q}{\partial y} &= 0\mbox{,}\end{split}\]

where \(q(x,y) \equiv 1\) in the case of minimizing a bivariate polynomial. With polysol2, Tensorlab offers a numerically robust way of computing isolated real roots of a system of bivariate polynomials

(1)\[\begin{split}f(x,y) &= 0\\ g(x,y) &= 0\end{split}\]

as the eigenvalues of a generalized eigenvalue problem [1][2]. Stationary points of bivariate polynomials and rational functions may be computed with polymin2 and ratmin2, respectively.

Polyanalytic univariate polynomials

Closely related is the problem of minimizing a polyanalytic univariate polynomial

\[\begin{split}\underset{z\,\in\,\C}{\operatorname{minimize}}&~~p(z,\conj{z})\mbox{,}\end{split}\]

or more generally, a rational function

\[\begin{split}\underset{z\,\in\,\C}{\operatorname{minimize}}&~~\frac{p(z,\conj{z})}{q(z,\conj{z})}\mbox{.}\end{split}\]

Analogously to the analytic bivariate case, all local minimizers are roots of the system

\[\begin{split}\frac{\partial p}{\partial z}q - p\frac{\partial q}{\partial z} &= 0\\ \frac{\partial p}{\partial \conj{z}}q - p\frac{\partial q}{\partial \conj{z}} &= 0\mbox{,}\end{split}\]

where the derivatives are Wirtinger derivatives (cf. Section Complex derivatives). The method polysol2 can also solve systems of polyanalytic polynomials

(2)\[\begin{split}f(z,\conj{z}) &= 0\\ g(z,\conj{z}) &= 0\mbox{.}\end{split}\]

In fact, given a system of bivariate polynomials (1), polysol2 will first convert it to the form (2) before computing the roots as the eigenvalues of a (complex) generalized eigenvalue problem. Stationary points of real-valued polyanalytic polynomials and rational functions may be computed with polymin2 and ratmin2, respectively.x

Stationary points of polynomials and rational functions

Polynomials and rational functions

In MATLAB, a polynomial \(p(x)\) is represented by a row vector p = [ad ... a2 a1 a0] as

\[\begin{split}p(x) = \begin{bmatrix}a_d & \cdots & a_2 & a_1 & a_0\end{bmatrix}\cdot \begin{bmatrix}x^d & \cdots & x^2 & x & 1 \end{bmatrix}^{\T}\mbox{.}\end{split}\]

For example, the polynomial \(p(x) = x^3 + 2x^2 + 3x +4\) is represented by the row vector p = [1 2 3 4]. Its derivative \(\frac{dp}{dx}\) can be computed with polyder(p) and its zeros can be computed with roots(p).

The stationary points of \(p(x)\), i.e., all \(x^*\) which satisfy \(\frac{dp}{dx}(x^*) = 0\), are the output of roots(polyder(p)). However, some of these solutions may have a small imaginary part which correspond to a numerical zero. The stationary points can also be computed as roots of the polynomial’s derivative with polymin(p), which deals with solutions with small imaginary part and returns only real solutions.

Analogously, the stationary points of a a rational function \(\frac{p(x)}{q(x)}\) are given by

roots(conv(polyder(p),q)-conv(p,polyder(q)))

where conv(p,q) is the convolution of the two row vectors p and q and is equivalent to computing the coefficients of the polynomial \(p(x)\cdot q(x)\). As in the polynomial case, there are a few numerical issues which can be dealt with by computing the stationary points of \(\frac{p(x)}{q(x)}\) with ratmin(p,q).

Bivariate polynomials and rational functions

In Tensorlab, a bivariate polynomial \(p(x,y)\) is represented by a matrix p as

\[\begin{split}p(x,y) = \begin{bmatrix}1 & y & \cdots & y^{d_y}\end{bmatrix}\cdot \begin{bmatrix}a_{00} & \cdots & a_{0d_x}\\\vdots & \ddots & \vdots\\ a_{d_y0} & \cdots & a_{d_yd_x}\end{bmatrix}\cdot \begin{bmatrix}1 \\ x \\ \vdots \\ x^{d_x}\end{bmatrix}\mbox{.}\end{split}\]

For example, the six-hump camel back function [3]

\[p(x,y) = 4x^2 - 2.1x^4+\frac{1}{3}x^6 + xy - 4y^2 + 4y^4\]

is represented by the matrix

p = [ 0   0   4   0  -2.1 0   1/3; ...
      0   1   0   0   0   0   0;   ...
     -4   0   0   0   0   0   0;   ...
      0   0   0   0   0   0   0;   ...
      4   0   0   0   0   0   0];

and can be seen in Figure 25. The stationary points of the polynomial \(p(x,y)\) can be computed as the solutions of the system \(\frac{\partial p}{\partial x} = \frac{\partial p}{\partial y} = 0\) with polymin2(p). To obtain a global minimum, select the solution with smallest function value using

[xy,v] = polymin2(p);
[vmin,idx] = min(v);
xymin = xy(idx,:);

To visualize the level zero contour lines of \(\frac{\partial p}{\partial x}\) and \(\frac{\partial p}{\partial y}\) in the neighbourhood of the stationary points, set options.Plot = true as follows

p = randn(6); % Generate random bivariate polynomial of coordinate degree 5.
options.Plot = true;
xy = polymin2(p,options);

or inline as polymin2(randn(6),struct('Plot',true)).

sixhump

Figure 25: The six-hump camel back function and its stationary points as red dots.

The corresponding system of polynomials is solved by polysol2. The latter includes several balancing steps to improve the accuracy of the solution. For some poorly scaled problems, the method may fail to find all solutions of the system. In that case, try decreasing the polysol2 balancing tolerance options.TolBal to a smaller value, e.g.,

options.TolBal = 1e-4;
xy = polymin2(p,options);

Computing the stationary points of a bivariate rational function \(\frac{p(x,y)}{q(x,y)}\) is completely analogous to the polynomial case. The following example generates a random bivariate rational function and computes its stationary points:

p = randn(6); % Random bivariate polynomial of coordinate degree 5.
q = randn(4); % Random bivariate polynomial of coordinate degree 3.
options.Plot = true;
xy = ratmin2(p,q,options);

The inline equivalent of this example is ratmin2(randn(6),randn(4),struct('Plot',true)).

Polyanalytic polynomials and rational functions

Polyanalytic polynomials \(p(z,\conj{z})\) are represented by a matrix p as

\[\begin{split}p(z,\conj{z}) = \begin{bmatrix}1 & \conj{z} & \cdots & \conj{z}^{d_y}\end{bmatrix}\cdot \begin{bmatrix}a_{00} & \cdots & a_{0d_x}\\\vdots & \ddots & \vdots\\ a_{d_y0} & \cdots & a_{d_yd_x}\end{bmatrix}\cdot \begin{bmatrix}1 \\ z \\ \vdots \\ z^{d_x}\end{bmatrix}\mbox{.}\end{split}\]

For example, the polynomial \(p(z,\conj{z}) = 1 + 2z + 3z^2 + 4\conj{z} + 5z\conj{z} + 6z^2 \conj{z} + 7\conj{z}^2\) is represented by the matrix

p = [1 2 3; ...
     4 5 6; ...
     7 0 0];

However, minimizing a polyanalytic polynomial \(p(z,\conj{z})\) only makes sense if \(p(z,\conj{z})\) is real-valued for all \(z \in \C\). A polyanalytic polynomial is real-valued if and only if its matrix representation is Hermitian, i.e., p == p'. As with bivariate polynomials, the stationary points of a real-valued polyanalytic polynomial \(p(z,\conj{z})\) can be computed with polymin2(p).

As an example, the stationary points of a pseudorandom real-valued polyanalytic polynomial can be computed with

p = rand(6)+rand(6)*1i;
p = p*p';
options.Plot = true;
xy = polymin2(p,options);

Computing the stationary points of a polyanalytic rational function \(\frac{p(z,\conj{z})}{q(z,\conj{z})}\) is completely analogous to the polynomial case. For example,

p = rand(6)+rand(6)*1i; p = p*p';
q = rand(4)+rand(4)*1i; q = q*q';
options.Plot = true;
xy = ratmin2(p,q,options);

Note

If the matrix p contains complex coefficients and is Hermitian, polymin2 will treat p as a real-valued polyanalytic polynomial. Otherwise, it will be treated as a bivariate polynomial. In some cases it may be necessary to specify what type of polynomial p is. In that case, set options.Univariate to true if p is a real-valued polyanalytic polynomial and false otherwise. The same option also applies to ratmin2.

Isolated solutions of a system of two bivariate polynomials

The functions polymin2 and ratmin2 depend on the lower level function polysol2 to compute the isolated solutions of systems of bivariate polynomials (1) or systems of polyanalytic univariate polynomials (2). In the case (1), polysol2(p,q) computes the isolated real solutions of the system \(p(x,y) = q(x,y) = 0\). A solution \((x^*,y^*)\) is said to be isolated if there exists a neighbourhood of \((x^*,y^*)\) in \(\C^2\) that contains no solution other than \((x^*,y^*)\). Some systems may have solutions that are isolated in \(\R^2\), but not in \(\C^2\).

Note

By default, polysol2(p,q) assumes p and q are polyanalytic univariate if at least one of p and q contains complex coefficients. If this is not the case, the user can specify the type of polynomial by setting options.Univariate to true if both polynomials are polyanalytic univariate or false otherwise.

The algorithm in polysol2 applies several balancing steps to the problem in order to improve the accuracy of the computed roots, before refining them with Newton-Raphson. If the system is poorly scaled, it may be necessary to decrease the balancing tolerance options.TolBal to a smaller value. In Figure 26, the solutions of a relatively difficult bivariate system \(p(x,y) = q(x,y) = 0\) are plotted. The polynomials \(p(x,y)\) and \(q(x,y)\) are both of total degree 20 and have coefficients of which the exponents (in base 10) range between 1 and 7.

marcdeg20

Figure 26: A system of bivariate polynomials \(p(x,y) = q(x,y) = 0\) of total degree 20.