Polynomial to Matrix form(canonical form)
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
How to convert the given quadratic form(Q = x1^2 + 2x1x2+x2^2) into its canonical form in matlab.
5 comentarios
Walter Roberson
el 19 de Ag. de 2020
https://www.mathworks.com/matlabcentral/answers/445266-polynomial-to-matrix-form-canonical-form#answer_470380
Respuestas (3)
lalith keerthan
el 24 de Jul. de 2020
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 comentarios
John D'Errico
el 24 de Jul. de 2020
Editada: John D'Errico
el 24 de Jul. de 2020
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
el 24 de Jul. de 2020
Editada: John D'Errico
el 24 de Jul. de 2020
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 comentarios
Gaurav Malik
el 23 de Ag. de 2021
Yeah but what do you do when you also have linear terms in your function? We need also the c'X term.
Walter Roberson
el 23 de Ag. de 2021
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] ?
Ver también
Categorías
Más información sobre Number Theory en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!