aboutsummaryrefslogtreecommitdiff
path: root/src/input/linalg.input.pamphlet
blob: c39e5c77fe3c538c058f069c519e4a2638a1e945 (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
\documentclass{article}
\usepackage{axiom}
\begin{document}
\title{\$SPAD/src/input linalg.input}
\author{The Axiom Team}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
<<*>>=

-- Input for page MatrixMoreFunctionsPage
)clear all

m1 := matrix([[1,-2,1],[4,2,-4]])
m2 := matrix([[0,1,2],[2,3,4],[3,4,5]])
m3 := matrix([[1,2,3],[2,4,6]])
m1 + m3
100 * m1
m1 * m2
-m1 + m3 * m2
m2 * m1
v := vector([1,0,1])
m3 * v
m5 : MATRIX POLY INT := new(4,4,1)
vars : LIST POLY INT := [x,y,z,u]
for i in 1..4 repeat for j in 1..3 repeat m5(i,j + 1) := (vars.i)**j
m5
trace(m5)
det := determinant(m5)
factor(det)
m6 := matrix([[1,2,1],[-2,3,4],[-1,5,6]])
m6inv := inverse(m6)
m6 * m6inv
m7 := matrix([[1,2,1],[-2,3,4],[-1,5,5]])
inverse(m7)
determinant(m7)
m8 : SQMATRIX(2,INT) := matrix([[1,2],[2,3]])
m9 : SQMATRIX(2,INT) := matrix([[1,1],[0,1]])
m8 ** 2
m9 ** 3
mm : SQMATRIX(2,SQMATRIX(2,INT)) := matrix([[1,m8],[m9,0]])
100 * mm
m8 * mm
mm * mm
p : POLY SQMATRIX(2,INT) := m8 * x**2 + m9 * x + m8 * m9
100 * p
m8 * p
p * p

-- Input for page MatrixCanonicalFormsPage
)clear all

m1 := matrix([[0,4,1],[5,3,-7],[-5,5,9]])
rank(m1)
rowEchelon(m1)
nullSpace(m1)
t := eigenMatrix(m1)
inverse(t) * m1 * t

-- Input for page MatrixBasicFunctionsPage
)clear all

m1 := matrix([[1,2,3,4],[2,3,4,5],[3,4,5,6],[4,5,6,7]])
m2 := matrix([[1,0,2],[20,30,10],[0,200,100]])
(m3,m4) : MATRIX PF 7
m3 := matrix([[1,0,1],[5,0,1]])
m4 := matrix([[1],[2],[5],[6]])
m2(1,1)
m2(1,1) := 99
m2
row(m2,2)
setRow!(m2,2,vector [66,77,88])
r := column(m2,1)
setColumn!(m2,2,r)
nrows(m1)
m5 : MATRIX INT := new(12,12,0)
for i in 2..nrows(m5) repeat m5(i-1,i):= 1
m5
d : MATRIX INT := diagonalMatrix([1,2,3,2,1])
m6 := matrix([[0,1,2,3,4],[5,6,7,8,9],[10,11,12,13,14]])
m7 := subMatrix(m6,1,3,2,4)
horizConcat(m6,m7)
vertConcat(m6,subMatrix(m6,1,1,1,5))
transpose(m6)
setsubMatrix(m6,1,3,1,3,transpose(subMatrix(m6,1,3,1,3)))
m6
m8 := matrix([[1,2],[3,4]])
m9 := m8
m10 := copy(m8)
m8(1,1) := 1000000
m8
m9
m10

-- Input for page EigenPage
)clear all

m1 : MATRIX FRAC INT := [[1,2,1],[2,1,-2],[1,-2,4]]
leig := eigenvalues(m1)
eigenvector(first(leig),m1)
eigenvectors(m1)
radicalEigenvectors(m1)
eigenMatrix(m1)
m2 : MATRIX FRAC INT := [[-5,-2],[18,7]]
eigenMatrix(m2)
m3 : MATRIX FRAC INT := [[1,2],[2,1]]
orthonormalBasis(m3)
@
\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}