问题描述
我有一个像这个例子这样的矩阵(我的实际矩阵可能更大)
I have a matrix such as this example (my actual matrices can be much larger)
A = [-1 -2 -0.5;
0 0.5 0;
0 0 -1];
只有两个线性独立的特征值(重复特征值-1).我想使用广义特征向量来获得完整的基础.我知道如何执行此操作的一种方法是使用Matlab中的 jordan
函数符号数学工具箱,但是我更喜欢为数字输入设计的东西(实际上,有两个输出,对于大型矩阵,jordan
失败:"MuPAD命令中的错误:相似矩阵太大.").我不需要约旦规范形式,该形式在数字上下文中众所周知是不稳定的,而只是广义特征向量的矩阵.是否存在一种可以以数值稳定的方式自动执行此操作的功能或功能组合,或者必须使用通用手动方法(如何操作)这样的程序是否稳定)?
that has only two linearly-independent eigenvalues (the eigenvalue -1 is repeated). I would like to obtain a complete basis with generalized eigenvectors. One way I know how to do this is with Matlab's jordan
function in the Symbolic Math toolbox, but I'd prefer something designed for numeric inputs (indeed, with two outputs, jordan
fails for large matrices: "Error in MuPAD command: Similarity matrix too large."). I don't need the Jordan canonical form, which is notoriously unstable in numeric contexts, just a matrix of generalized eigenvectors. Is there a function or combination of functions that automates this in a numerically stable way or must one use the generic manual method (how stable is such a procedure)?
注意:广义特征向量"是指非零向量,可用于增强所谓的瑕疵矩阵.我并不是说与通过解决广义特征值问题而获得的特征值相对应的特征向量.使用eig
或qz
(尽管后一种用法很常见,但最好避免使用).除非有人能纠正我,否则我不认为两者是相同的.
NOTE: By "generalized eigenvector," I mean a non-zero vector that can be used to augment the incomplete basis of a so-called defective matrix. I do not mean the eigenvectors that correspond to the eigenvalues obtained from solving the generalized eigenvalue problem using eig
or qz
(though this latter usage is quite common, I'd say that it's best avoided). Unless someone can correct me, I don't believe the two are the same.
更新1 –五个月后:
有关如何以符号方式获得大于82 x 82的矩阵的广义特征向量的信息,请参见在这里我的答案作为我在这个问题中的测试矩阵).
See my answer here for how to obtain generalized eigenvectors symbolically for matrices larger than 82-by-82 (the limit for my test matrix in this question).
我仍然对数字方案感兴趣(或者如果这些方案都与计算Jordan形式有关,那么这些方案可能会不稳定).我不想盲目地实现被标记为该问题重复项的线性代数101方法,因为它不是数值算法,而是用于评估学生的铅笔和纸的方法(我想它可以实现象征性地).如果有人可以指出我该方案的实现方式还是对该方案进行数值分析,我对此会很感兴趣.
I'm still interested in numeric schemes (or how such schemes might be unstable if they're all related to calculating the Jordan form). I don't wish to blindly implement the linear algebra 101 method that has been marked as a duplicate of this question as it's not a numerical algorithm, but rather a pencil-and paper method used to evaluate students (I suppose that it could be implemented symbolically however). If anyone can point me to either an implementation of that scheme or a numerical analysis of it, I'd be interested in that.
更新2 – 2015年2月:以上所有内容均在R2014b中进行了测试.
推荐答案
如我的评论所述,如果您的矩阵有缺陷,但是您知道在给定的公差范围内希望将哪些特征向量/特征值对视为相同,则可以继续进行操作如以下示例所示:
As mentioned in my comments, if your matrix is defective, but you know which eigenvectors/eigenvalue pair you want to consider as identical given your tolerance, you can proceed as with this example below:
% example matrix A:
A = [1 0 0 0 0;
3 1 0 0 0;
6 3 2 0 0;
10 6 3 2 0;
15 10 6 3 2]
% Produce eigenvalues and eigenvectors (not generalized ones)
[vecs,vals] = eig(A)
这应该输出:
vecs =
0 0 0 0 0.0000
0 0 0 0.2236 -0.2236
0 0 0.0000 -0.6708 0.6708
0 0.0000 -0.0000 0.6708 -0.6708
1.0000 -1.0000 1.0000 -0.2236 0.2236
vals =
2 0 0 0 0
0 2 0 0 0
0 0 2 0 0
0 0 0 1 0
0 0 0 0 1
我们看到前三个特征向量与工作精度几乎相同,后两个特征向量也是如此.在这里,您必须知道问题的结构,并确定具有相同特征值的相同特征向量.在这里,特征值是完全相同的,因此我们知道要考虑的特征值,并假设相应的向量1-2-3是相同的,向量4-5是相同的. (在实践中,您可能会检查特征向量差异的范数,并将其与您的容差进行比较)
Where we see that the first three eigenvectors are almost identical to working precision, as are the two last ones. Here, you must know the structure of your problem and identify the identical eigenvectors of identical eigenvalues. Here, eigenvalues are exactly identical, so we know which ones to consider, and we will assume that corresponding vectors 1-2-3 are identical and vectors 4-5. (In practice you will likely check the norm of the differences of eigenvectors and compare it to your tolerance)
现在,我们继续计算广义特征向量,但是用matlab的\
进行求解很困难,因为显然(A - lambda*I)
并不完整.所以我们使用伪逆:
Now we proceed to compute the generalized eigenvectors, but this is ill-conditioned to solve simply with matlab's \
, because obviously (A - lambda*I)
is not full rank. So we use pseudoinverses:
genvec21 = pinv(A - vals(1,1)*eye(size(A)))*vecs(:,1);
genvec22 = pinv(A - vals(1,1)*eye(size(A)))*genvec21;
genvec1 = pinv(A - vals(4,4)*eye(size(A)))*vecs(:,4);
应该给:
genvec21 =
-0.0000
0.0000
-0.0000
0.3333
0
genvec22 =
0.0000
-0.0000
0.1111
-0.2222
0
genvec1 =
0.0745
-0.8832
1.5317
0.6298
-3.5889
这是我们的其他广义特征向量.如果我们现在检查这些内容以获得像这样的jordan范式:
Which are our other generalized eigenvectors. If we now check these to obtain the jordan normal form like this:
jordanJ = [vecs(:,1) genvec21 genvec22 vecs(:,4) genvec1];
jordanJ^-1*A*jordanJ
我们获得:
ans =
2.0000 1.0000 0.0000 -0.0000 -0.0000
0 2.0000 1.0000 -0.0000 -0.0000
0 0.0000 2.0000 0.0000 -0.0000
0 0.0000 0.0000 1.0000 1.0000
0 0.0000 0.0000 -0.0000 1.0000
这是我们的约旦范式(带有工作精度错误).
Which is our Jordan normal form (with working precision errors).
这篇关于在Matlab中数值查找广义特征向量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!