to begin

Finding the minimum of a biquadratic bivariate function in C++

Sergei Khashin


bi_quadr.h header,
bi_quadr.cpp realization.

Biquadratic function will be called a function of two variables of the form:

f (x,y) = a0 + a1 x + a2 x2 + (a3 + a4 x + a5 x2) y + (a6 + a7 x + a8 x2) y2.
The function of this type is uniquely defined by its values in 9 points:
     (-1,-1) ( 0,-1) ( 1,-1)     f0[0]  f0[1]  f0[2]
     (-1, 0) ( 0, 0) ( 1, 0) ->  f1[0]  f1[1]  f1[2]
     (-1, 1) ( 0, 1) ( 1, 1)     f2[0]  f2[1]  f2[2]
The extremums of the function must satisfy the system of equations:
    df/dx = 0
    df/dy = 0
или
a1 + 2a2 x + (a4 + 2a5 x) y + (a7 + a8 x) y2 = 0
a3 + a4 x + a5 x2 + (a6 + a7 x + a8 x2) y=0.
Express y from the second equation :
y = - ½ (a3 + a4 x + a5 x2)/ (a6 + a7 x + a8 x2).
Substituting this expression in the first equation, obtain an equation of one variable x. The left-hand side is a rational function with denominator
(a6 + a7 x + a8 x2)2
and the numerator is a polynomial of the 5th degree. The roots of this polynomial correspond to extrema of the original function. As a result, no more than five.

Thus, finding extrema biquadratic funtion is reduced to the solution of 5th degree polynomial.

In the present module offers a single function

  double minBiQuad(double *f0, double *f1, double *f2, double delta, double &xm, double &ym);
It is according to the nine values of the function
     (-1,-1) ( 0,-1) ( 1,-1)     f0[0]  f0[1]  f0[2]
     (-1, 0) ( 0, 0) ( 1, 0) ->  f1[0]  f1[1]  f1[2]
     (-1, 1) ( 0, 1) ( 1, 1)     f2[0]  f2[1]  f2[2]
finds the minmum point (xm,ym) on the square
-1-δ ≤ x ≤ 1+δ
-1-δ ≤ y ≤ 1+δ .
Function returns the minumum value.

free counters