Bug #1104
Eigenvectors: inconsistent return type
Description
From the manual for eigenvectors
:
------< example >------ /**/ Use R ::= QQ[x]; /**/ M := mat([[1,2,3],[4,5,6],[7,8,9]]); /**/ eigenvectors(M, x); [record[MinPoly := x, eigenspace := matrix(QQ, [[-1], [2], [-1]])], record[MinPoly := x^2 -15*x -18, eigenspace := [[1, (1/8)*x +1/4, (1/4)*x -1/2]]] ]
In one case the eigenspace is a matrix, in the other it is a list.
This is inconsistent!
Related issues
History
#1 Updated by John Abbott over 6 years ago
- Related to Feature #442: Eigenvectors added
#2 Updated by John Abbott over 4 years ago
- Target version changed from CoCoA-5.?.? to CoCoA-5.4.0
Even the example in the manual exhibits this... that's embarrassing. We should decide what to do, and then take action.
#3 Updated by John Abbott over 2 years ago
- Status changed from New to In Progress
- Assignee set to John Abbott
Get started!
#4 Updated by John Abbott over 2 years ago
- % Done changed from 0 to 10
Which type of answer do we prefer? LIST or MAT?
If we prefer MAT, are the eigenvectors the rows or the columns? [currently columns, it seems]
Advantage of MAT is that there is a guarantee all vectors are the same length (and over same ring);
but even if the fn returns a LIST it should implicitly guarantee these properties.
#5 Updated by John Abbott over 2 years ago
- in the case that the eigenvalue is rational (i.e. in the field), the eigenvector was a column matrix over the field
- in the case that the eigenvalue is not rational (i.e. algebraic), the eigenvectors involves entries in the ring of
x
(supplied as argument)
So if we want to return eigenvectors as columns in a matrix, then we mist also consider the ring in which the matrix entries lie.
We could choose entries the coeff field when the eigenvalue is rational; and use the ring of x
for irrational eigenvalues.
This could be a "nice" solution, but must be well documented!
#6 Updated by John Abbott about 2 years ago
- Target version changed from CoCoA-5.4.0 to CoCoA-5.4.2