aboutsummaryrefslogtreecommitdiff
path: root/src/input/eigen.input.pamphlet
blob: 9447c5ecdc388ac59a62f12a509bc9bbe7a79e1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
\documentclass{article}
\usepackage{axiom}
\begin{document}
\title{\$SPAD/src/input eigen.input}
\author{The Axiom Team}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
\section{License}
<<license>>=
--Copyright The Numerical Algorithms Group Limited 1991.
@
<<*>>=
<<license>>

-- Computation of eigenvalues and eigenvectors
)cl all

-- computation of characteristic polynomial
 
-- for matrix of integers
m:=matrix([[1,2,1],[2,1,-2],[1,-2,4]])
 
characteristicPolynomial m
characteristicPolynomial(m,x)
 
-- for matrix of polynomials
p:=matrix([[x+1,2-x*y,x**2+1],[2-x,y+2*x,x**2-2],[y**2,x-2,4-x*y]])
characteristicPolynomial p
characteristicPolynomial(p,t)
 
-- for general matrix of FRAC POLY INT
n:=matrix([[a,b,c],[d,e,f],[g,h,k]])
characteristicPolynomial n
 
-- there are many functions for the computation of  eigenvalues and
-- eigenvectors:
-- the function eigenvalues returns the eigenvalues :
leig := eigenvalues m

alpha:=leig.1
-- alpha is a rational eigenvalue; the corresponding eigenvector can be 
-- computed with the function eigenvector:
eigenvector(alpha,m)

beta:=leig.2
-- beta is a "symbolic" eigenvalue, i.e. it is a root (symbolically expressed)
-- of an irreducible factor of the characteristic polynomial. In this case
-- too we can compute the associate eigenvectors.
eigenvector(beta,m)$EP(INT)
-- eigenvector(beta,m)  not accepted by the interpreter

-- eigenvalues and eigenvectors can be computed simultaneously
--  with the function eigenvectors
eigenvectors m
 
q:=matrix [[x**2-y**2,(x-y)*(2*x+3*y)],[x+y,2*x+3*y]]
 
eigenvectors(q)

p:=matrix([[76,-18,58,-10],[-4,78,2,-2],[-6,15,45,3],[22,-75,7,41]])
ll := eigenvectors p

-- In this case the algebraic multiplicity (the field eigmult) is different
-- from the geometric multiplicity (the length of the field eigvec).

generalizedEigenvectors p
generalizedEigenvector(ll.1,p)$EP(INT)
-- generalizedEigenvector(ll.1,p) the interpreter can not handle this
 
-- these functions return respectively the complete set of 
-- generalized eigenvectors
-- or the generalized eigenvectors associated to a particular eigenvalue alpha,
-- i.e. a basis of the nullSpace((p-alpha*I)**k) where k is the  algebraic
-- multiplicity of alpha.

-- In the case of symbolic eigenvalues it is possible to convert the symbolic
-- eigenvalue and the corresponding eigenvectors in a more explicit form.
m
mm:=matrix([[30,4,24],[-17,8,-7],[-31,-54,-5]])
-- the function radicalEigenvalues expresses, when possible, the eigenvalues 
-- in terms of radicals.
le1:=radicalEigenvalues m
le2:=radicalEigenvalues mm

-- the function radicalEigenvector computes the eigenvectors assocoted to
-- a given eigenvalue, expressed in terms of radicals
radicalEigenvector(le1.2, m)
radicalEigenvector(le2.2,mm)

-- the function radicalEigenvectors computes simoultaneously all the
-- eigenvalues and the associated eigenvectors  and expresses the , when
-- it is possible, in terms of radical.
radicalEigenvectors m
radicalEigenvectors mm

-- there exist analogous functions for the computation of real and complex
-- eigenvalues and eigenvectors.

-- in order to compute respectively the eigenvalues or the
-- eigenvalues and the associared eigevectors of a matrix m and express them
-- as rational numbers (Gaussian rational) up to precision 1/1000000 use
realEigenvalues(m,1/1000000)
complexEigenvalues(mm,1/1000000)

realEigenvectors(m,1/1000000)
complexEigenvectors(mm,1/1000000)
-- to have the eigenvalues expressed as real float (complex float) use
realEigenvalues(m,.000001)
realEigenvectors(m,.000001)

complexEigenvalues(mm,.000001)
complexEigenvectors(mm,.000001)
@
\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}