特征多项式的Souriau方法 [英] Souriau method for Characteristic Polynomial

查看:138
本文介绍了特征多项式的Souriau方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道用于发现n×n矩阵的特征多项式的Souriau方法吗?我发现第一个系数很明显,但是如何找出其他系数呢?在我需要对矩阵求逆之后,我知道如何.

Does anyone know the Souriau method for finding the characteristic polynomial of any n × n matrix? I found out the first coefficient, is obvious, but how can I find out the other coefficients? After I need to inverse the matrix but I know how.

#include <iostream> 
#include <fstream>
using namespace std;

double trace(double a[5][5],int n){ 
        int i;
        double trace=0;
        for(i=0;i<n;i++) 
            trace+=a[i][i]; 
        return trace;
}
double prod(double a[5][5],double b[5][5],int n) {
    double c[5][5];
    int i,j,k;
    cout << "\nProd:\n"; 
    for(i=0;i<n;++i){ 
        for(j=0;j<n;++j){ 
            c[i][j]=0; 
            for(k=0;k<n;++k) 
                c[i][j]=c[i][j]+(a[i][k]*b[k][j]);
                cout << c[i][j] << " "; 
        } 
        cout << "\n"; 
    } 
    return c[i][j]; 
}
double theta(double a[5][5], int n){
    int i;
    double theta[5];
    theta[1]=-trace(a,n);
    for(i=0;i<n;i++)
        cout << "Theta[" << i+1 << "]=" << theta[i+1] << "\n";
    return theta[i+1];
}

int main(){ 
    ifstream f("a.txt"); 
    ifstream g("b.txt");
    double a[5][5],b[5][5];
    int i,j,n; 
    f >> n; 
    g >> n; 
    for(i=0;i<n;++i) 
        for(j=0;j<n;++j) 
            f >> a[i][j]; 
    cout << "Matrix A:"<<endl;
    for(i=0;i<n;++i){
        for(j=0;j<n;++j) 
            cout << a[i][j] << " ";
            cout << endl;
    }
    cout << endl;
    for(i=0;i<n;++i) 
        for(j=0;j<n;++j) 
            g >> b[i][j]; 
    cout << "Matrix B:" << endl;
    for(i=0;i<n;++i){ 
        for(j=0;j<n;++j) 
            cout << b[i][j] << " ";
            cout << endl;
    }

        cout << endl;
        cout << "Trace = ";
        cout << trace(a,n);
        cout << endl;
        prod(a,b,n);
        cout << endl;
        theta(a,n);
    }

推荐答案

来自 https://math.stackexchange.com/a/405975/115115 J. M.

C=A;
for k=1,…,n

    if k>1
        C=A*(C+c[n−k+1]*I);

    c[n−k]=−tr(C)/k;

end for

如果您能读德语,则在 https://de.wikipedia.org/wiki/Algorithmus_von_Faddejew-Leverrier (添加2017年:或同样好的英文版本

If you can read the german, there is a wiki page with extended pseudo-code algortihm at https://de.wikipedia.org/wiki/Algorithmus_von_Faddejew-Leverrier (add 2017: or the equally good english version https://en.wikipedia.org/wiki/Faddeev%E2%80%93LeVerrier_algorithm)

如果您想直接计算逆矩阵,则可以像在Wiki页面中那样,通过C = A B使用与上面的矩阵C相关的矩阵B.如在Wiki页面中可以看到的那样,这给出了稍微复杂一些的算法.但是,最后一个矩阵B满足A B = -c [0] * I,因此,如果有一个逆矩阵,则可以直接计算.

If you want to directly compute the inverse matrix, then you have, as in the wiki page, use the matrix B that is related to the matrix C above via C=AB. This gives, as can be seen in the wiki page, a slightly more complicated algorithm. However, then the last matrix B satisfies AB=-c[0]*I, so that the inverse matrix, if there is one, can be directly computed.

这篇关于特征多项式的Souriau方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆