6x6 system of multivariate quadratic equations ... non-negative real solutions

4 ビュー (過去 30 日間)
Michal
Michal 2024 年 11 月 1 日
編集済み: Bruno Luong 2024 年 11 月 5 日
What is the best way (what solver?) to effectively find real non-negative solutions of 6 multivariate quadratic equations (6 variables)?
f_i(x) = 0, i = 1,6, where x = [x1,x2,...,x6] and f_i(x) is the quadratic form with known real coeffs.
  9 件のコメント
Walter Roberson
Walter Roberson 2024 年 11 月 4 日
To confirm, you have the form:
syms x [6 1]
syms A [6 6]
A = diag(diag(A))
x' * A * x
Bruno Luong
Bruno Luong 2024 年 11 月 4 日
"A always contains only one non-zero diagonal element on the ith row/column "
To me it means
Ai(j,j) == 0 is true for i ~= j and
false for i == j.

サインインしてコメントする。

採用された回答

Bruno Luong
Bruno Luong 2024 年 11 月 4 日
編集済み: Bruno Luong 2024 年 11 月 4 日
Assuming the equations are
x' * Ai * x + bi'*x + ci = 0 for i = 1,2, ..., N = 6.
Ai are assumed to be symmetric. If not replace with Asi := 1/2*(Ai + Ai').
You could try to iteratively solve linearized problem; in pseudo code:
x = randn(N,1); % or your solution of previous step, slowly changing as stated
L = zeros(N);
r = zeros(N,1);
notconverge = true;
while notconverge
for i = 1:N
L(i,:) = (2*x'*Ai + bi');
r(i) = -(x'*Ai*x + bi'*x + ci);
end
dx = L \ r;
xold = x;
x = x + dx;
x = max(x,0); % since we want solution >= 0
notconverge = norm(x-xold,p) > tolx && ...
norm(r,q) > tolr; % select p, q, tolx and tolr approproately
end
I guess fmincon, fsolve do somesort of Newton-like or linearization internally. But still worth to investogate. Here the linearization is straight forward and fast to compute. Some intermediate vectors in computing L and r are common and can be shared.
  3 件のコメント
Michal
Michal 2024 年 11 月 4 日
編集済み: Michal 2024 年 11 月 4 日
Because in my case is ci = 0, then r(i)= 0 for x = 0 and i = 1,2, ..., 6
So, in a case of all negative components of x, is then dx = L\r = 0 and convergence of the Newton iterations is broken. Am I right?
Bruno Luong
Bruno Luong 2024 年 11 月 4 日
編集済み: Bruno Luong 2024 年 11 月 5 日
x = 0 is ONE solution (up to 2^6 in the worst case). You have Newton actually converges to a local minima of ONE solution. Bravo.
You need to change
x = randn(N,1);
so as it would converge to a desired solution.

サインインしてコメントする。

その他の回答 (2 件)

Aquatris
Aquatris 2024 年 11 月 1 日
fsolve seems to work for most cases, if not lsqnonlin is also an option. here is a general explanation
  2 件のコメント
Michal
Michal 2024 年 11 月 1 日
Frankly, I hope there might be some more specialized solver for quadratic forms.
John D'Errico
John D'Errico 2024 年 11 月 1 日
No. There is not. We all want for things that are not possible. Probably more likely to hope for peace in the world. Yeah, right.

サインインしてコメントする。


Torsten
Torsten 2024 年 11 月 1 日
移動済み: Torsten 2024 年 11 月 1 日
I think there is no specialized solver for a system of quadratic equations. Thus a general nonlinear solver ("fsolve","lsqnonlin","fmincon") is the only chance you have.
  3 件のコメント
Torsten
Torsten 2024 年 11 月 1 日
編集済み: Torsten 2024 年 11 月 1 日
You shouldn't think about speed at the moment. You are lucky if you get your system solved and if the solution is as expected. A system of quadratic equations is a challenge.
If this works satisfactory, you can save time if you set the solution of the last call to the nonlinear solver to the initial guess of the next call (since you say that your coefficients vary slowly).
Michal
Michal 2024 年 11 月 1 日
編集済み: Michal 2024 年 11 月 1 日
Yes... you are definitely right :)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSystems of Nonlinear Equations についてさらに検索

製品


リリース

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by