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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
\documentclass{article}
\usepackage{axiom}
\begin{document}
\title{\$SPAD/src/input nepip.input}
\author{The Axiom Team}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
\section{License}
<<license>>=
--Copyright The Numerical Algorithms Group Limited 1996.
@
<<*>>=
<<license>>
-- Note that the conversions of results from DoubleFloat to Float
-- will become unnecessary if outputGeneral is extended to apply to
-- DoubleFloat quantities.
outputGeneral 5
mA1 := matrix [[ 0.5 , 1.5 , 6.6 , 4.8], _
[ 1.5 , 6.5 , 16.2 , 8.6], _
[ 6.6 , 16.2 , 37.6 , 9.8], _
[ 4.8 , 8.6 , 9.8 , -17.1]];
mB1 := matrix[[ 1 , 3 , 4 , 1], _
[ 3 , 13 , 16 , 11], _
[ 4 , 16 , 24 , 18], _
[ 1 , 11 , 18 , 27]];
mA2 := matrix [[ 3.9 , 12.5 , -34.5 , -0.5], _
[ 4.3 , 21.5 , -47.5 , 7.5], _
[ 4.3 , 21.5 , -43.5 , 3.5], _
[ 4.4 , 26.0 , -46.0 , 6.0]];
mB2 := matrix[[ 1 , 2 , -3 , 1], _
[ 1 , 3 , -5 , 4], _
[ 1 , 3 , -4 , 3], _
[ 1 , 3 , -4 , 4]];
nagEigenvalues(mA1,mB1) :: List Float
-- [- 3.0,- 1.0,2.0,4.0]
vv1 := nagEigenvectors(mA1,mB1);
(vv1.eigenvalues) :: List Float
-- [- 3.0,- 1.0,2.0,4.0]
(vv1.eigenvectors) :: List Vector Complex Float
-- [[- 4.35,0.05,1.0,- 0.5], [- 2.05,0.15,0.5,- 0.5], [- 3.95,0.85,0.5,- 0.5],
-- [2.65,0.05,- 1.0,0.5]]
nagEigenvalues(mA2,mB2)
-- all components are O(1) or more so:
% :: List Complex Float
-- [2.0,3.0 + 4.0 %i,3.0 - 4.0 %i,4.0]
vv2 := nagEigenvectors(mA2,mB2);
vv2.eigenvalues
-- all components are O(1) or more so:
% :: List Complex Float
-- [2.0,3.0 + 4.0 %i,3.0 - 4.0 %i,4.0]
vv2.eigenvectors :: List Vector Complex Float
-- [[0.99606,0.0056917,0.062609,0.062609],
--
-- [0.94491, 0.18898 + 0.26077 E -14 %i, 0.11339 - 0.15119 %i,
-- 0.11339 - 0.15119 %i]
-- ,
--
-- [0.94491, 0.18898 - 0.26077 E -14 %i, 0.11339 + 0.15119 %i,
-- 0.11339 + 0.15119 %i]
-- ,
-- [0.98752,0.010972,- 0.032917,0.15361]]
-- The same call with eps=0.0001:
vv2a := nagEigenvectors(mA2,mB2,0.0001);
vv2a.eigenvalues :: List Complex Float
-- [1.9989,3.0003 + 3.9994 %i,3.0003 - 3.9994 %i,4.0]
vv2a.eigenvectors :: List Vector Complex Float
-- [[0.99605,0.0057355,0.062656,0.062656],
--
-- [0.94491, 0.18899 - 0.000048882 %i, 0.11336 - 0.15119 %i,
-- 0.11336 - 0.15119 %i]
-- ,
--
-- [0.94491, 0.18899 + 0.000048882 %i, 0.11336 + 0.15119 %i,
-- 0.11336 + 0.15119 %i]
-- ,
-- [0.98751,0.011031,- 0.032912,0.15367]]
mB1(1,1) := -1;
-- The next test should fail on F02ADF then call F02BJF:
nagEigenvalues(mA1,mB1)
-- all components are O(1) or more so:
% :: List Complex Float
-- [3.5016,- 1.5471,0.041212 + 0.21738 %i,0.041212 - 0.21738 %i]
-- Similarly, this should fail on F02AEF then call F02BJF:
vv3 := nagEigenvectors(mA1,mB1);
vv3.eigenvalues
-- all components are O(1) or more so:
% :: List Complex Float
-- [3.5016,- 1.5471,0.041212 + 0.21738 %i,0.041212 - 0.21738 %i]
vv3.eigenvectors :: List Vector Complex Float
-- [[- 0.034577,0.63045,- 0.75202,0.1892],
-- [0.17876,- 0.73845,0.047413,0.64845],
--
-- [0.80838, - 0.00095133 + 0.47557 %i, - 0.20354 - 0.21737 %i,
-- 0.15404 + 0.089179 %i]
-- ,
--
-- [0.80838, - 0.00095133 - 0.47557 %i, - 0.20354 + 0.21737 %i,
-- 0.15404 - 0.089179 %i]
-- ]
outputGeneral()
output "End of tests"
@
\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}
|