= QQbar[]
///
}}}
{{{id=17|
R
///
Univariate Polynomial Ring in x over Algebraic Field
}}}
{{{id=18|
a, b = (x^2-2).roots()
///
}}}
{{{id=21|
a[0].minpoly()
///
x^2 - 2
}}}
{{{id=22|
m = random_matrix(ZZ, 5, density=0.2)
///
}}}
{{{id=23|
m
///
[ 0 0 1 0 0]
[-4 0 0 0 0]
[ 0 1 0 0 0]
[-1 0 0 0 0]
[ 0 1 0 0 0]
}}}
{{{id=24|
b = random_matrix(ZZ, 5, 5) * m
///
}}}
{{{id=25|
x = m.solve_left(b)
///
}}}
{{{id=26|
x*m == b
///
True
}}}
{{{id=27|
x = m.solve_right(b)
///
}}}
{{{id=28|
m*x == b
///
True
}}}
{{{id=29|
x = m \ b
///
}}}
{{{id=30|
m*x
///
(1, 2, 3, 4, 5)
}}}
{{{id=31|
m = random_matrix(ZZ, 3000, density=.001)
///
}}}
{{{id=32|
time m.rank()
///
2652
Time: CPU 17.56 s, Wall: 17.11 s
}}}
{{{id=33|
m = random_matrix(ZZ, 3)
///
}}}
{{{id=34|
show(m.eigenspaces())
///
\left[\left(a_{0}, \mathrm{RowSpan}_{\Bold{Q}[a_{0}]/(a_{0}^{3} + 4 a_{0}^{2} + 7)}\left(\begin{array}{rrr}
1 & -\frac{1}{3} a_{0}^{2} - \frac{2}{3} a_{0} + \frac{7}{3} & \frac{1}{3} a_{0}^{2} + \frac{5}{3} a_{0} + \frac{2}{3}
\end{array}\right)\right)\right]
}}}
{{{id=35|
m = random_matrix(GF(17), 3)
///
}}}
{{{id=36|
m.eigenspaces()
///
[
(15, Vector space of degree 3 and dimension 1 over Finite Field of size 17
User basis matrix:
[1 7 6]),
(13, Vector space of degree 3 and dimension 1 over Finite Field of size 17
User basis matrix:
[ 1 13 12]),
(9, Vector space of degree 3 and dimension 1 over Finite Field of size 17
User basis matrix:
[ 1 11 5])
]
}}}
{{{id=37|
m = random_matrix(QQ, 10)
///
}}}
{{{id=38|
m.minpoly()
///
x^10 - x^9 - 11*x^8 + 73/8*x^7 - 100*x^6 - 541/32*x^5 + 45189/64*x^4 + 2135/32*x^3 - 220523/128*x^2 - 670739/64*x - 959713/128
}}}
{{{id=39|
R = Frac(Qp(7)['x,y,z'])
///
}}}
{{{id=41|
m = matrix(R, [[1,2],[3,R.gen()]]); show(m)
///
\left(\begin{array}{rr}
1 + O(7^{20}) & 2 + O(7^{20}) \\
3 + O(7^{20}) & x
\end{array}\right)
}}}
{{{id=42|
show(m^4)
///
\left(\begin{array}{rr}
(6 + O(7^{20})) x^{2} + (5 + 7 + O(7^{20})) x + 6 + 7^{2} + O(7^{20}) & (2 + O(7^{20})) x^{3} + (2 + O(7^{20})) x^{2} + (5 + 3 \cdot 7 + O(7^{20})) x + 5 + 3 \cdot 7 + O(7^{20}) \\
(3 + O(7^{20})) x^{3} + (3 + O(7^{20})) x^{2} + (4 + 5 \cdot 7 + O(7^{20})) x + 4 + 5 \cdot 7 + O(7^{20}) & x^{4} + (4 + 2 \cdot 7 + O(7^{20})) x^{2} + (5 + 7 + O(7^{20})) x + 6 \cdot 7 + O(7^{20})
\end{array}\right)
}}}
{{{id=43|
show(m.echelon.261_form())
///
\left(\begin{array}{rr}
1 + O(7^{20}) & 0 \\
0 & \frac{x + 1 + 6 \cdot 7 + 6 \cdot 7^{2} + 6 \cdot 7^{3} + 6 \cdot 7^{4} + 6 \cdot 7^{5} + 6 \cdot 7^{6} + 6 \cdot 7^{7} + 6 \cdot 7^{8} + 6 \cdot 7^{9} + 6 \cdot 7^{10} + 6 \cdot 7^{11} + 6 \cdot 7^{12} + 6 \cdot 7^{13} + 6 \cdot 7^{14} + 6 \cdot 7^{15} + 6 \cdot 7^{16} + 6 \cdot 7^{17} + 6 \cdot 7^{18} + 6 \cdot 7^{19} + O(7^{20})}{x + 1 + 6 \cdot 7 + 6 \cdot 7^{2} + 6 \cdot 7^{3} + 6 \cdot 7^{4} + 6 \cdot 7^{5} + 6 \cdot 7^{6} + 6 \cdot 7^{7} + 6 \cdot 7^{8} + 6 \cdot 7^{9} + 6 \cdot 7^{10} + 6 \cdot 7^{11} + 6 \cdot 7^{12} + 6 \cdot 7^{13} + 6 \cdot 7^{14} + 6 \cdot 7^{15} + 6 \cdot 7^{16} + 6 \cdot 7^{17} + 6 \cdot 7^{18} + 6 \cdot 7^{19} + O(7^{20})}
\end{array}\right)
}}}
{{{id=44|
show(m.echelon_form())
///
\left(\begin{array}{rr}
1 + O(7^{20}) & 0 \\
0 & \frac{x + 1 + 6 \cdot 7 + 6 \cdot 7^{2} + 6 \cdot 7^{3} + 6 \cdot 7^{4} + 6 \cdot 7^{5} + 6 \cdot 7^{6} + 6 \cdot 7^{7} + 6 \cdot 7^{8} + 6 \cdot 7^{9} + 6 \cdot 7^{10} + 6 \cdot 7^{11} + 6 \cdot 7^{12} + 6 \cdot 7^{13} + 6 \cdot 7^{14} + 6 \cdot 7^{15} + 6 \cdot 7^{16} + 6 \cdot 7^{17} + 6 \cdot 7^{18} + 6 \cdot 7^{19} + O(7^{20})}{x + 1 + 6 \cdot 7 + 6 \cdot 7^{2} + 6 \cdot 7^{3} + 6 \cdot 7^{4} + 6 \cdot 7^{5} + 6 \cdot 7^{6} + 6 \cdot 7^{7} + 6 \cdot 7^{8} + 6 \cdot 7^{9} + 6 \cdot 7^{10} + 6 \cdot 7^{11} + 6 \cdot 7^{12} + 6 \cdot 7^{13} + 6 \cdot 7^{14} + 6 \cdot 7^{15} + 6 \cdot 7^{16} + 6 \cdot 7^{17} + 6 \cdot 7^{18} + 6 \cdot 7^{19} + O(7^{20})}
\end{array}\right)
}}}
{{{id=45|
m = random_matrix(ZZ, 5)
///
}}}
{{{id=46|
show(m.smith_form())
///
\left(\left(\begin{array}{rrrrr}
1 & 0 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 & 0 \\
0 & 0 & 1 & 0 & 0 \\
0 & 0 & 0 & 3 & 0 \\
0 & 0 & 0 & 0 & 375
\end{array}\right), \left(\begin{array}{rrrrr}
0 & 0 & 0 & 0 & 1 \\
0 & 0 & 0 & 1 & 0 \\
0 & 0 & 1 & 0 & 0 \\
0 & 1 & 0 & -2 & -2 \\
1 & -83 & 0 & -21 & 42
\end{array}\right), \left(\begin{array}{rrrrr}
59 & 89 & -2 & 118 & 177 \\
-30 & -46 & 1 & -61 & -94 \\
-29 & -44 & 1 & -58 & -87 \\
0 & 0 & 0 & 0 & 1 \\
-2 & -3 & 0 & -4 & -6
\end{array}\right)\right)
}}}
{{{id=47|
m = random_matrix(ZZ, 150)
time h = (m.hermite_form())
///
Time: CPU 1.13 s, Wall: 1.36 s
}}}
{{{id=48|
h[-1,-1]
///
8375677550724595192675641077288237457048522483917710157652778465125657401802410520334228193073121691278932506332980975346116095028405721348080390321223130549269468876005491649019466447132328083540300918478697656344292037964238876241671235887400940698709674611150640552770635581963126609487375496376019485012273435032381048445132650095
}}}
{{{id=49|
m = random_matrix(ZZ, 5); m
///
[ 2 1 23 -1 0]
[ 0 -1 1 0 -8]
[ 4 -2 7 4 3]
[ 2 -3 0 -1 2]
[ 0 -1 0 -1 1]
}}}
{{{id=50|
m.column(2)
///
(0, 0, 1)
}}}
{{{id=51|
m[:2,:3]
///
[ 2 1 23]
[ 0 -1 1]
}}}
{{{id=52|
L = range(10)
L
///
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
}}}
{{{id=53|
L[:4]
///
[0, 1, 2, 3]
}}}
{{{id=54|
L[2:4]
///
[2, 3]
}}}
{{{id=55|
V = QQ^3
V
///
Vector space of dimension 3 over Rational Field
}}}
{{{id=60|
V.basis()
///
[
(1, 0, 0),
(0, 1, 0),
(0, 0, 1)
]
}}}
{{{id=59|
V.1
///
(0, 1, 0)
}}}
{{{id=56|
W = span(QQ, (V.gen(0), V.1))
///
}}}
{{{id=57|
V/W
///
Vector space quotient V/W of dimension 1 over Rational Field where
V: Vector space of dimension 3 over Rational Field
W: Vector space of degree 3 and dimension 2 over Rational Field
Basis matrix:
[1 0 0]
[0 1 0]
}}}
{{{id=58|
///
}}}