📄 polynomialmatricestest.nb
字号:
ButtonBoxOptions->{Active->True},
GridBoxOptions->{ColumnAlignments->{Left}}]
}, Open ]],
Cell["Some examples on how to use all these functions follow.", "Text",
Editable->True,
Evaluatable->False],
Cell[CellGroupData[{
Cell["Hermite, Smith and McMillan forms", "Section",
Editable->True,
Evaluatable->False],
Cell["\<\
These three functions have two versions: one computing only the \
canonical form\
\>", "Text",
Editable->True,
Evaluatable->False],
Cell[CellGroupData[{
Cell[BoxData[
\(HermiteForm[m = {{x\^2, x + 1, 0}, {x, x - 1, 1}, {x + 1, x, 1}}] //
MatrixForm\)], "Input"],
Cell[BoxData[
TagBox[
RowBox[{"(", "\[NoBreak]", GridBox[{
{"1", "0", "1"},
{"0", "1", \(-1\)},
{"0", "0", \(\(-1\) - x + x\^2\)}
},
RowSpacings->1,
ColumnSpacings->1,
ColumnAlignments->{Left}], "\[NoBreak]", ")"}],
Function[ BoxForm`e$,
MatrixForm[ BoxForm`e$]]]], "Output"]
}, Open ]],
Cell["\<\
and an extended version returning the unimodular matrices that lead \
to that form too\
\>", "Text",
Editable->True,
Evaluatable->False],
Cell[CellGroupData[{
Cell["{h,u}=ExtendedHermiteForm[m]", "Input",
Editable->True],
Cell[BoxData[
\({{{1, 0, 1}, {0, 1, \(-1\)}, {0, 0, \(-1\) - x + x\^2}}, {{0, x,
1 - x}, {0, \(-1\) - x, x}, {\(-1\), \(-1\) - 2\ x - x\^2 + x\^3,
x + 2\ x\^2 - x\^3}}}\)], "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell["h===Expand[u.m]", "Input",
Editable->True],
Cell[BoxData[
\(True\)], "Output"],
Cell["u is unimodular", "Text"],
Cell[CellGroupData[{
Cell["Det[u]", "Input",
Editable->True],
Cell[BoxData[
\(\(-1\)\)], "Output"]
}, Open ]]
}, Open ]]
}, Open ]],
Cell["\<\
The function HermiteForm computes the Hermite form of matrices with dependent \
columns as well:\
\>", "Text",
Editable->True,
Evaluatable->False],
Cell[CellGroupData[{
Cell[BoxData[
\(HermiteForm[{{x, x\^2, x}, {x\^2, x\^3, x + 1}, {x\^3, x\^4, x + 2}}] //
MatrixForm\)], "Input"],
Cell[BoxData[
TagBox[
RowBox[{"(", "\[NoBreak]", GridBox[{
{"x", \(x\^2\), "0"},
{"0", "0", "1"},
{"0", "0", "0"}
},
RowSpacings->1,
ColumnSpacings->1,
ColumnAlignments->{Left}], "\[NoBreak]", ")"}],
Function[ BoxForm`e$,
MatrixForm[ BoxForm`e$]]]], "Output"]
}, Open ]],
Cell["\<\
The functions that compute the Smith and McMillan forms can be used \
the same way\
\>", "Text",
Editable->True,
Evaluatable->False],
Cell[CellGroupData[{
Cell["\<\
SmithForm[m={{x-1,x+1,0},{x,x-2,1},{x+1,2x,1}}]//MatrixForm
MatrixForm/@({s,u,v}=ExtendedSmithForm[m])
s===Expand[u.m.v]\
\>", "Input",
Editable->True],
Cell[BoxData[
TagBox[
RowBox[{"(", "\[NoBreak]", GridBox[{
{"1", "0", "0"},
{"0", "1", "0"},
{"0", "0", \(\(-3\) + x\^2\)}
},
RowSpacings->1,
ColumnSpacings->1,
ColumnAlignments->{Left}], "\[NoBreak]", ")"}],
Function[ BoxForm`e$,
MatrixForm[ BoxForm`e$]]]], "Output"],
Cell[BoxData[
RowBox[{"{",
RowBox[{
TagBox[
RowBox[{"(", "\[NoBreak]", GridBox[{
{"1", "0", "0"},
{"0", "1", "0"},
{"0", "0", \(\(-3\) + x\^2\)}
},
RowSpacings->1,
ColumnSpacings->1,
ColumnAlignments->{Left}], "\[NoBreak]", ")"}],
Function[ BoxForm`e$,
MatrixForm[ BoxForm`e$]]], ",",
TagBox[
RowBox[{"(", "\[NoBreak]", GridBox[{
{"0", "1", "0"},
{"0", \(-1\), "1"},
{\(-1\), \(1 - x\), \(\(-1\) + x\)}
},
RowSpacings->1,
ColumnSpacings->1,
ColumnAlignments->{Left}], "\[NoBreak]", ")"}],
Function[ BoxForm`e$,
MatrixForm[ BoxForm`e$]]], ",",
TagBox[
RowBox[{"(", "\[NoBreak]", GridBox[{
{"0", "1", \(\(-2\) - x\)},
{"0", "0", "1"},
{"1", \(-x\), \(2 + x + x\^2\)}
},
RowSpacings->1,
ColumnSpacings->1,
ColumnAlignments->{Left}], "\[NoBreak]", ")"}],
Function[ BoxForm`e$,
MatrixForm[ BoxForm`e$]]]}], "}"}]], "Output"],
Cell[BoxData[
\(True\)], "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[{
\(SmithForm[
m = DiagonalMatrix[{1 - x, 1 - x, 1 - x,
1 - x, \(-2\) - x, \(-2\) - x}]] // MatrixForm\), "\n",
\(MatrixForm /@ \(({s, u, v} = ExtendedSmithForm[m])\)\), "\n",
\(s === Expand[u . m . v]\)}], "Input"],
Cell[BoxData[
TagBox[
RowBox[{"(", "\[NoBreak]", GridBox[{
{"1", "0", "0", "0", "0", "0"},
{"0", "1", "0", "0", "0", "0"},
{"0", "0", \(\(-1\) + x\), "0", "0", "0"},
{"0", "0", "0", \(\(-1\) + x\), "0", "0"},
{"0", "0", "0", "0", \(\(-2\) + x + x\^2\), "0"},
{"0", "0", "0", "0", "0", \(\(-2\) + x + x\^2\)}
},
RowSpacings->1,
ColumnSpacings->1,
ColumnAlignments->{Left}], "\[NoBreak]", ")"}],
Function[ BoxForm`e$,
MatrixForm[ BoxForm`e$]]]], "Output"],
Cell[BoxData[
RowBox[{"{",
RowBox[{
TagBox[
RowBox[{"(", "\[NoBreak]", GridBox[{
{"1", "0", "0", "0", "0", "0"},
{"0", "1", "0", "0", "0", "0"},
{"0", "0", \(\(-1\) + x\), "0", "0", "0"},
{"0", "0", "0", \(\(-1\) + x\), "0", "0"},
{"0", "0", "0", "0", \(\(-2\) + x + x\^2\), "0"},
{"0", "0", "0", "0", "0", \(\(-2\) + x + x\^2\)}
},
RowSpacings->1,
ColumnSpacings->1,
ColumnAlignments->{Left}], "\[NoBreak]", ")"}],
Function[ BoxForm`e$,
MatrixForm[ BoxForm`e$]]], ",",
TagBox[
RowBox[{"(", "\[NoBreak]", GridBox[{
{"0", "0", "0", \(1\/3\), \(-1\), "0"},
{"0",
"0", \(-\(1\/3\)\), \(1\/9 - x\/9\), \(\(-\(1\/3\)\) +
x\/3\), \(-1\)},
{\(-1\),
"0", \(1\/3 - x\/3\), \(2\/9 - x\/9 -
x\^2\/9\), \(\(-\(2\/3\)\) + x\/3 + x\^2\/3\), \(1 -
x\)},
{
"0", \(-1\), \(1\/3 - x\/3\), \(2\/9 - x\/9 -
x\^2\/9\), \(\(-\(2\/3\)\) + x\/3 + x\^2\/3\), \(1 -
x\)},
{"0",
"0", \(\(-\(2\/3\)\) - x\/3\), \(2\/9 - x\/9 -
x\^2\/9\), \(\(-\(2\/3\)\) + x\/3 + x\^2\/3\), \(1 -
x\)},
{"0", "0", "0", \(2\/3 + x\/3\), \(1 - x\), "0"}
},
RowSpacings->1,
ColumnSpacings->1,
ColumnAlignments->{Left}], "\[NoBreak]", ")"}],
Function[ BoxForm`e$,
MatrixForm[ BoxForm`e$]]], ",",
TagBox[
RowBox[{"(", "\[NoBreak]", GridBox[{
{"1", \(-1\), "1", "0", "0", "0"},
{"1", \(-1\), "0", "1", "0", "0"},
{"1", \(-1\), "0", "0", \(2 + x\), "0"},
{"1", "0", "0", "0", "0", \(\(-2\) - x\)},
{\(1\/3\), "0", "0", "0", "0", \(1\/3 - x\/3\)},
{"0", \(1\/3\), "0", "0", \(1\/3 - x\/3\), "0"}
},
RowSpacings->1,
ColumnSpacings->1,
ColumnAlignments->{Left}], "\[NoBreak]", ")"}],
Function[ BoxForm`e$,
MatrixForm[ BoxForm`e$]]]}], "}"}]], "Output"],
Cell[BoxData[
\(True\)], "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
\(McMillanForm[
m = {{x\/\(\(\((x + 1)\)\^2\) \((x + 2)\)\^2\),
x\/\((x + 2)\)\^2}, {\(-\(x\/\((x + 2)\)\^2\)\), \(-\(x\/\((x + \
2)\)\^2\)\)}}] // MatrixForm\)], "Input"],
Cell[BoxData[
TagBox[
RowBox[{"(", "\[NoBreak]", GridBox[{
{\(x\/\((2 + 3\ x + x\^2)\)\^2\), "0"},
{"0", \(x\^2\/\(2 + x\)\)}
},
RowSpacings->1,
ColumnSpacings->1,
ColumnAlignments->{Left}], "\[NoBreak]", ")"}],
Function[ BoxForm`e$,
MatrixForm[ BoxForm`e$]]]], "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell["\<\
MatrixForm/@({mc,u,v}=ExtendedMcMillanForm[m])
mc===Simplify[u.m.v]\
\>", "Input",
Editable->True,
AllowInlineCells->True],
Cell[BoxData[
RowBox[{"{",
RowBox[{
TagBox[
RowBox[{"(", "\[NoBreak]", GridBox[{
{\(x\/\((2 + 3\ x + x\^2)\)\^2\), "0"},
{"0", \(x\^2\/\(2 + x\)\)}
},
RowSpacings->1,
ColumnSpacings->1,
ColumnAlignments->{Left}], "\[NoBreak]", ")"}],
Function[ BoxForm`e$,
MatrixForm[ BoxForm`e$]]], ",",
TagBox[
RowBox[{"(", "\[NoBreak]", GridBox[{
{"1", "0"},
{\(1 + 2\ x + x\^2\), "1"}
},
RowSpacings->1,
ColumnSpacings->1,
ColumnAlignments->{Left}], "\[NoBreak]", ")"}],
Function[ BoxForm`e$,
MatrixForm[ BoxForm`e$]]], ",",
TagBox[
RowBox[{"(", "\[NoBreak]", GridBox[{
{"1", \(\(-1\) - 2\ x - x\^2\)},
{"0", "1"}
},
RowSpacings->1,
ColumnSpacings->1,
ColumnAlignments->{Left}], "\[NoBreak]", ")"}],
Function[ BoxForm`e$,
MatrixForm[ BoxForm`e$]]]}], "}"}]], "Output"],
Cell[BoxData[
\(True\)], "Output"]
}, Open ]],
Cell["\<\
These functions work on matrices whose elemtents are polynomials \
with symbolic coefficients as well; in this case one must specify the \
indeterminate, otherwise an error message is displayed:\
\>", "Text",
Editable->True,
Evaluatable->False],
Cell[CellGroupData[{
Cell[BoxData[
\(SmithForm[
m = {{x\^2 + d\ x + k, k, 0}, {d\ x, k, 1}, {x, x, d}}]\)], "Input"],
Cell[BoxData[
\(General::"badarg" \(\(:\)\(\ \)\)
"The argument has more than one variable. One more specifying an \
indeterminate is expected."\)], "Message"],
Cell[BoxData[
\($Failed\)], "Output"]
}, Open ]],
Cell["The right input is", "Text",
Editable->True,
Evaluatable->False]
}, Open ]],
Cell[CellGroupData[{
Cell["SmithForm[m,x]", "Input",
Editable->True],
Cell[BoxData[
\({{1, 0, 0}, {0, 1, 0}, {0,
0, \(-d\)\ k\^2 + d\ x\^2 - d\ k\ x\^2 + x\^3}}\)], "Output"]
}, Open ]],
Cell[CellGroupData[{
Cell["Division", "Section",
Editable->True,
Evaluatable->False],
Cell["\<\
The result of LDivision[a,b] is a list {q,r} consisting of the \
quotient and the remainder obtained by left division of matrix a by matrix b \
(a=b.q+r). The matrices a and b must have the same number of rows.\
\>", \
"Text",
Editable->True,
Evaluatable->False],
Cell[CellGroupData[{
Cell[BoxData[{
\({q, r} =
LDivision[a = {{x\^2 + 2 x\^4}, {1 + x + x\^2}},
b = {{x\^2 + 1, 1}, {1, x\^2}}]\), "\[IndentingNewLine]",
\(a === Expand[b . q + r]\)}], "Input"],
Cell[BoxData[
\({{{\(-1\) + 2\ x\^2}, {\(-1\)}}, {{2}, {2 + x}}}\)], "Output"],
Cell[BoxData[
\(True\)], "Output"]
}, Open ]],
Cell["\<\
The functions LQuotient and LRemainder compute only the left \
quotient and remainder respectively:\
\>", "Text",
Editable->True,
Evaluatable->False],
Cell[CellGroupData[{
Cell["\<\
LQuotient[a,b]
LRemainder[a,b]\
\>", "Input",
Editable->True],
Cell[BoxData[
\({{\(-1\) + 2\ x\^2}, {\(-1\)}}\)], "Output"],
Cell[BoxData[
\({{2}, {2 + x}}\)], "Output"]
}, Open ]],
Cell["\<\
LGCD computes the greatest common left divisor of two polynomial \
matrices\
\>", "Text",
Editable->True,
Evaluatable->False],
Cell[CellGroupData[{
Cell[BoxData[{
\(g =
LGCD[a = {{x\^2 + x}, {x\^2 + x}},
b = {{x\^2, x}, {x\^2 - x + 1, x}}]\), "\[IndentingNewLine]",
\(LRemainder[a, g, x]\), "\[IndentingNewLine]",
\(LRemainder[b, g, x]\)}], "Input"],
Cell[BoxData[
\({{x, 0}, {x, 1 - x}}\)], "Output"],
Cell[BoxData[
\({{0}, {0}}\)], "Output"],
Cell[BoxData[
\({{0, 0}, {0, 0}}\)], "Output"]
}, Open ]],
Cell["\<\
The least common left multiple of two polynomial matrices is given \
by Llcm\
\>", "Text",
Editable->True,
Evaluatable->False],
Cell[CellGroupData[{
Cell[BoxData[
\(Llcm[{{x - 1, 1}, {x + 1, 0}}, {{x\^2, 1}, {1, 0}}]\)], "Input"],
Cell[BoxData[
\({{1 + x, 0}, {\(-1\) + x, 1}}\)], "Output"]
}, Open ]],
Cell["\<\
The function LCoprime is a left coprimality test for polynomial \
matrices\
\>", "Text",
Editable->True,
Evaluatable->False],
Cell[CellGroupData[{
Cell[BoxData[
\(LCoprime[{{x, x + 1, x - 2}, {0, x, 0}}, {{x, x - 1}, {x\^2,
1}}]\)], "Input"],
Cell[BoxData[
\(True\)], "Output"]
}, Open ]],
Cell["\<\
The functions for the right division are: RDivision, RQuotient, \
RRemainder, RGCD, Rlcm, RCoprime and their usage is the same.\
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -