Polynomial to Matrix form(canonical form)

조회 수: 8 (최근 30일)
Sudhish Subramaniam
Sudhish Subramaniam 2019년 2월 16일
댓글: Walter Roberson 2021년 8월 23일
How to convert the given quadratic form(Q = x1^2 + 2x1x2+x2^2) into its canonical form in matlab.
  댓글 수: 5
Sai Teja Sunkari
Sai Teja Sunkari 2020년 8월 19일
what about 3x3 matrix
Walter Roberson
Walter Roberson 2020년 8월 19일
https://www.mathworks.com/matlabcentral/answers/445266-polynomial-to-matrix-form-canonical-form#answer_470380

댓글을 달려면 로그인하십시오.

답변 (3개)

lalith keerthan
lalith keerthan 2020년 7월 24일
syms x1 x2 x3 y1 y2 y3 a b c p
Q=input('Enter the form in x1 x2 x3')
a11=(1/2)*diff(diff(Q,x1),x1)
a22=(1/2)*diff(diff(Q,x2),x2)
a33=(1/2)*diff(diff(Q,x3),x3)
a12=(1/2)*diff(diff(Q,x1),x2)
a21=a12
a13=(1/2)*diff(diff(Q,x1),x3)
a13=a31
a23=(1/2)*diff(diff(Q,x2),x3)
a23=a23
A=[a11,a12,a13;a21,a22,a23;a31,a32,a33]
[N D]=eig(A)
X=[x1,x2,x3]
Y=[y1,y2,y3]
disp(D(1,1)*y1^2+D(2,2)*y2^2+D(3,3)*y3^2)
[m,n]=size(A);
for i=1:n
N(:,i)=[N(1,i)/sqrt(N(1,i)^2+N(2,i)^2+N(3,i)^2) N(2,i)/sqrt(N(1,i)^2+N(2,i)^2+N(3,i)^2) N(3,i)/sqrt(N(1,i)^2+N(2,i)^2+N(3,i)^2)]
end
display('no repeated eigen value and the orthogonal transformation is X=NY')
X==(N*Y)
  댓글 수: 2
Walter Roberson
Walter Roberson 2020년 7월 24일
Is that a question or a solution to the poster's question ?
John D'Errico
John D'Errico 2020년 7월 24일
편집: John D'Errico 2020년 7월 24일
I think it was an attempt at an answer/ At least it started out as one, sort of. But things got lost along the way, following a convoluted, confused path at the end.

댓글을 달려면 로그인하십시오.


John D'Errico
John D'Errico 2020년 7월 24일
편집: John D'Errico 2020년 7월 24일
I assume the question is to resolve a quadratic polynomial, perhaps:
Q = x1^2 + 2*x1*x2 + x2^2
into a quadratic form. That is, given Q, you want to recover the matrix H, such that
Q = [x1,x2]*H*[x1;x2]
This is quite easy using the symbolic toolbox. The desired matrix H is 1/2 times the Hessian matrix of Q.
For example, given the quadratic Q...
syms x1 x2
Q = x1^2 + 2*x1*x2 + x2^2
Q =
x1^2 + 2*x1*x2 + x2^2
X = [x1,x2];
H = hessian(Q)/2
H =
[ 1, 1]
[ 1, 1]
H is the desired matrix. We can see Q is recovered:
expand(X*H*X.')
ans =
x1^2 + 2*x1*x2 + x2^2
This is just an educated guess on my part as to the answer. Since there has been no response from the OP since it as first posted, we can only guess.
  댓글 수: 2
Gaurav Malik
Gaurav Malik 2021년 8월 23일
Yeah but what do you do when you also have linear terms in your function? We need also the c'X term.
Walter Roberson
Walter Roberson 2021년 8월 23일
In such a case are you working with a quadratic form ? Are you, as John indicates, trying to recover the H in Q = [x1,x2]*H*[x1;x2] ?

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2019년 2월 16일
syms x1 x2
QQ = x1^2 +2*x1*x2+x2^2
factor(QQ)

카테고리

Help CenterFile Exchange에서 Polynomials에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by