Leverrier method to find polynomial of matrix
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi guys,
I need to find a method to generalize Leverrier Method to find matrix's characteristic polynomial.
Input should be only the matrix.
As theory I have:
- PA(x)=x^n-c1*n^(n-1)+c2*x(n-2)+...+(-1)^n*c[n] - polynomial
- s[k]=trace(A^k), 1<=k<=n
- c[k], 1<=k<=n
c1=s1
c2=(s1*c2-s[k])/2
c[k]=(s1*c[k-1]-s2*c[k-2]+...+(-1)^(k+1)*s[k])/k, 2<=k<=n
Also i have to display PA and a graph or something
What I have so far:
function [A,n]=leverrier_n()
for i=1 to n
for j=2 to n
V[j]=A^j
s[i]=trace(V[j])
end
end
for k=2 to n
i=1;
t[1]=s[1]
t[k]=(s[i]*t[k-1]-s[i+1]*t[k-2]+)/k
end
end
0 Commenti
Risposta accettata
David Hill
il 2 Giu 2020
function c = leverrier(A)
a=size(A,1);
M=zeros(a);
c=zeros(1,a+1);
c(1)=1;
for k=2:a+1
M=A*M+c(k-1)*eye(a);
c(k)=-1/(k-1)*trace(A*M);
end
end
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Polynomials in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!