Polynomial to Matrix form(canonical form)

9 次查看(过去 30 天)
How to convert the given quadratic form(Q = x1^2 + 2x1x2+x2^2) into its canonical form in matlab.
  5 个评论
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 中查找有关 Number Theory 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by