Bug in Minor[ ]
- To: mathgroup at smc.vnet.net
- Subject: [mg6212] Bug in Minor[ ]
- From: Mario Sancho Graca <M.S.Graca at Warwick.ac.uk>
- Date: Thu, 27 Feb 1997 02:55:16 -0500
- Organization: University of Warwick
- Sender: owner-wri-mathgroup at wolfram.com
The output of Minor[A,k] computes the minors of A based on submatrices of size k*k, but it seems that the ordering of the results is wrong. Attached you will find a short notebook illustrating the output and comparing with the basic formal definition of minors of a matrix. -- Mario Sancho Graca University of Warwick Department of Engineering Coventry CV4 7AL United Kingdom Email: M.S.Graca at Warwick.ac.uk (*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 3.0, MathReader 3.0, or any compatible application. The data for the notebook starts with the line of stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info at wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. ***********************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 15303, 472]*) (*NotebookOutlinePosition[ 16232, 506]*) (* CellTagsIndexPosition[ 16160, 500]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell[TextData[{ "Bug in ", StyleBox["Mathematica", FontSlant->"Italic"], " function Minor[ ]" }], "Title"], Cell[TextData[ "M.S. Gra\[CCedilla]a\n\nUniversity of Warwick\nDepartment of Engineering\n\ Coventry CV4 7AL\nUnited Kingdom\n\nEmail: M.S.Graca at Warwick.ac.uk"], "Author"], Cell[TextData[{ StyleBox["Mathematica", FontSlant->"Italic"], "'s function Minor[ ] computes the minors of a matrix \[ScriptCapitalA] \ correctly, but the ordering of the resultant elements is incorrect. This note \ illustrates the point." }], "Abstract"], Cell[CellGroupData[{ Cell[TextData["Expansion of det \[ScriptCapitalA] in cofactors"], "Subsection"], Cell[TextData[{ "Consider matrix \[ScriptCapitalA], ", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{"n", "\[Cross]", "n"}], " ", RowBox[{"(", RowBox[{"n", "\[GreaterEqual]", "2"}], ")"}]}], TraditionalForm]]], ". The determinant of \[ScriptCapitalA] is a combination of row ", StyleBox["i", FontSlant->"Italic"], " and the cofactors of row ", StyleBox["i", FontSlant->"Italic"], ":" }], "Text"], Cell[TextData[Cell[BoxData[ FormBox[ RowBox[{ RowBox[{"det", " ", "\[ScriptCapitalA]"}], "=", RowBox[{ RowBox[{ SubscriptBox["a", "i1"], SubscriptBox["\[ScriptCapitalA]", "i1"]}], "+", RowBox[{ SubscriptBox["a", "i2"], SubscriptBox["\[ScriptCapitalA]", "i2"]}], "+", "\[Ellipsis]", "+", RowBox[{ SubscriptBox["a", RowBox[{"i", "\[VeryThinSpace]", "n"}]], SubscriptBox["\[ScriptCapitalA]", RowBox[{"i", "\[VeryThinSpace]", "n"}]]}]}]}], TraditionalForm]]]], "Text"], Cell[TextData[{ StyleBox["Definition.", FontWeight->"Bold"], " The ", StyleBox["minor", FontWeight->"Bold"], " ", Cell[BoxData[ FormBox[ SubscriptBox["\[ScriptCapitalM]", RowBox[{"i", "\[VeryThinSpace]", "j"}]], TraditionalForm]]], " is the determinant of the ", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{"(", RowBox[{"n", "-", "1"}], ")"}], RowBox[{"(", RowBox[{"n", "-", "1"}], ")"}]}], TraditionalForm]]], " matrix formed by deleting row ", StyleBox["i", FontSlant->"Italic"], " and column ", StyleBox["j", FontSlant->"Italic"], " of \[ScriptCapitalA]." }], "Text"], Cell[TextData[{ StyleBox["Definition.", FontWeight->"Bold"], " The ", StyleBox["cofactor", FontWeight->"Bold"], " ", Cell[BoxData[ FormBox[ SubscriptBox["\[ScriptCapitalC]", RowBox[{"i", "\[VeryThinSpace]", "j"}]], TraditionalForm]]], " is the minor with corrected sign," }], "Text"], Cell[TextData[Cell[BoxData[ FormBox[ RowBox[{ SubscriptBox["\[ScriptCapitalC]", RowBox[{"i", "\[VeryThinSpace]", "j"}]], "=", RowBox[{ SuperscriptBox[ RowBox[{"(", RowBox[{"-", "1"}], ")"}], RowBox[{"i", "+", "j"}]], SubscriptBox["\[ScriptCapitalM]", RowBox[{"i", "\[VeryThinSpace]", "j"}]]}]}], TraditionalForm]]]], "Text"], Cell[CellGroupData[{ Cell[TextData["\[ScriptCapitalA] = Array[a, {3, 3}]"], "Input", CellTags->"S3.7.7"], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"a", "[", RowBox[{"1", ",", "1"}], "]"}], ",", RowBox[{"a", "[", RowBox[{"1", ",", "2"}], "]"}], ",", RowBox[{"a", "[", RowBox[{"1", ",", "3"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"a", "[", RowBox[{"2", ",", "1"}], "]"}], ",", RowBox[{"a", "[", RowBox[{"2", ",", "2"}], "]"}], ",", RowBox[{"a", "[", RowBox[{"2", ",", "3"}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"a", "[", RowBox[{"3", ",", "1"}], "]"}], ",", RowBox[{"a", "[", RowBox[{"3", ",", "2"}], "]"}], ",", RowBox[{"a", "[", RowBox[{"3", ",", "3"}], "]"}]}], "}"}]}], "}"}]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"\[ScriptCapitalA]", "//", "MatrixForm"}]], "Input"], Cell[BoxData[ TagBox[ RowBox[{"(", GridBox[{ { RowBox[{"a", "[", RowBox[{"1", ",", "1"}], "]"}], RowBox[{"a", "[", RowBox[{"1", ",", "2"}], "]"}], RowBox[{"a", "[", RowBox[{"1", ",", "3"}], "]"}]}, { RowBox[{"a", "[", RowBox[{"2", ",", "1"}], "]"}], RowBox[{"a", "[", RowBox[{"2", ",", "2"}], "]"}], RowBox[{"a", "[", RowBox[{"2", ",", "3"}], "]"}]}, { RowBox[{"a", "[", RowBox[{"3", ",", "1"}], "]"}], RowBox[{"a", "[", RowBox[{"3", ",", "2"}], "]"}], RowBox[{"a", "[", RowBox[{"3", ",", "3"}], "]"}]} }], ")"}], (MatrixForm[ #]&)]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[TextData["Det[ \[ScriptCapitalA] ]"], "Input", CellTags->"S3.7.7"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"-", RowBox[{"a", "[", RowBox[{"1", ",", "3"}], "]"}]}], " ", RowBox[{"a", "[", RowBox[{"2", ",", "2"}], "]"}], " ", RowBox[{"a", "[", RowBox[{"3", ",", "1"}], "]"}]}], "+", RowBox[{ RowBox[{"a", "[", RowBox[{"1", ",", "2"}], "]"}], " ", RowBox[{"a", "[", RowBox[{"2", ",", "3"}], "]"}], " ", RowBox[{"a", "[", RowBox[{"3", ",", "1"}], "]"}]}], "+", RowBox[{ RowBox[{"a", "[", RowBox[{"1", ",", "3"}], "]"}], " ", RowBox[{"a", "[", RowBox[{"2", ",", "1"}], "]"}], " ", RowBox[{"a", "[", RowBox[{"3", ",", "2"}], "]"}]}], "-", RowBox[{ RowBox[{"a", "[", RowBox[{"1", ",", "1"}], "]"}], " ", RowBox[{"a", "[", RowBox[{"2", ",", "3"}], "]"}], " ", RowBox[{"a", "[", RowBox[{"3", ",", "2"}], "]"}]}], "-", RowBox[{ RowBox[{"a", "[", RowBox[{"1", ",", "2"}], "]"}], " ", RowBox[{"a", "[", RowBox[{"2", ",", "1"}], "]"}], " ", RowBox[{"a", "[", RowBox[{"3", ",", "3"}], "]"}]}], "+", RowBox[{ RowBox[{"a", "[", RowBox[{"1", ",", "1"}], "]"}], " ", RowBox[{"a", "[", RowBox[{"2", ",", "2"}], "]"}], " ", RowBox[{"a", "[", RowBox[{"3", ",", "3"}], "]"}]}]}]], "Output"] }, Open ]], Cell["The computed determinant is correct.", "Text"], Cell[CellGroupData[{ Cell[TextData["Minors[\[ScriptCapitalA], 2]"], "Input", CellTags->"S3.7.7"], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"-", RowBox[{"a", "[", RowBox[{"1", ",", "2"}], "]"}]}], " ", RowBox[{"a", "[", RowBox[{"2", ",", "1"}], "]"}]}], "+", RowBox[{ RowBox[{"a", "[", RowBox[{"1", ",", "1"}], "]"}], " ", RowBox[{"a", "[", RowBox[{"2", ",", "2"}], "]"}]}]}], ",", RowBox[{ RowBox[{ RowBox[{"-", RowBox[{"a", "[", RowBox[{"1", ",", "3"}], "]"}]}], " ", RowBox[{"a", "[", RowBox[{"2", ",", "1"}], "]"}]}], "+", RowBox[{ RowBox[{"a", "[", RowBox[{"1", ",", "1"}], "]"}], " ", RowBox[{"a", "[", RowBox[{"2", ",", "3"}], "]"}]}]}], ",", RowBox[{ RowBox[{ RowBox[{"-", RowBox[{"a", "[", RowBox[{"1", ",", "3"}], "]"}]}], " ", RowBox[{"a", "[", RowBox[{"2", ",", "2"}], "]"}]}], "+", RowBox[{ RowBox[{"a", "[", RowBox[{"1", ",", "2"}], "]"}], " ", RowBox[{"a", "[", RowBox[{"2", ",", "3"}], "]"}]}]}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"-", RowBox[{"a", "[", RowBox[{"1", ",", "2"}], "]"}]}], " ", RowBox[{"a", "[", RowBox[{"3", ",", "1"}], "]"}]}], "+", RowBox[{ RowBox[{"a", "[", RowBox[{"1", ",", "1"}], "]"}], " ", RowBox[{"a", "[", RowBox[{"3", ",", "2"}], "]"}]}]}], ",", RowBox[{ RowBox[{ RowBox[{"-", RowBox[{"a", "[", RowBox[{"1", ",", "3"}], "]"}]}], " ", RowBox[{"a", "[", RowBox[{"3", ",", "1"}], "]"}]}], "+", RowBox[{ RowBox[{"a", "[", RowBox[{"1", ",", "1"}], "]"}], " ", RowBox[{"a", "[", RowBox[{"3", ",", "3"}], "]"}]}]}], ",", RowBox[{ RowBox[{ RowBox[{"-", RowBox[{"a", "[", RowBox[{"1", ",", "3"}], "]"}]}], " ", RowBox[{"a", "[", RowBox[{"3", ",", "2"}], "]"}]}], "+", RowBox[{ RowBox[{"a", "[", RowBox[{"1", ",", "2"}], "]"}], " ", RowBox[{"a", "[", RowBox[{"3", ",", "3"}], "]"}]}]}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"-", RowBox[{"a", "[", RowBox[{"2", ",", "2"}], "]"}]}], " ", RowBox[{"a", "[", RowBox[{"3", ",", "1"}], "]"}]}], "+", RowBox[{ RowBox[{"a", "[", RowBox[{"2", ",", "1"}], "]"}], " ", RowBox[{"a", "[", RowBox[{"3", ",", "2"}], "]"}]}]}], ",", RowBox[{ RowBox[{ RowBox[{"-", RowBox[{"a", "[", RowBox[{"2", ",", "3"}], "]"}]}], " ", RowBox[{"a", "[", RowBox[{"3", ",", "1"}], "]"}]}], "+", RowBox[{ RowBox[{"a", "[", RowBox[{"2", ",", "1"}], "]"}], " ", RowBox[{"a", "[", RowBox[{"3", ",", "3"}], "]"}]}]}], ",", RowBox[{ RowBox[{ RowBox[{"-", RowBox[{"a", "[", RowBox[{"2", ",", "3"}], "]"}]}], " ", RowBox[{"a", "[", RowBox[{"3", ",", "2"}], "]"}]}], "+", RowBox[{ RowBox[{"a", "[", RowBox[{"2", ",", "2"}], "]"}], " ", RowBox[{"a", "[", RowBox[{"3", ",", "3"}], "]"}]}]}]}], "}"}]}], "}"}]], "Output"] }, Open ]], Cell[TextData[{ "The function Minor[ ] is computing the minors ", StyleBox["but", FontWeight->"Bold"], " the ordering is,\n", Cell[BoxData[{ FormBox[ RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"Minor", "[", "\[ScriptCapitalA]", "]"}], ")"}], "\[LeftDoubleBracket]", RowBox[{"1", ",", "1"}], "\[RightDoubleBracket]"}], "=", SubscriptBox["M", RowBox[{"3", ",", "3"}]]}], TraditionalForm], FormBox[ RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"Minor", "[", "\[ScriptCapitalA]", "]"}], ")"}], "\[LeftDoubleBracket]", RowBox[{"1", ",", "2"}], "\[RightDoubleBracket]"}], "=", SubscriptBox["M", RowBox[{"3", ",", "2"}]]}], TraditionalForm], FormBox[ RowBox[{"\t\t\t", RowBox[{ RowBox[{ "\[VerticalEllipsis]", " ", RowBox[{ RowBox[{"\[VerticalEllipsis]", "\n", "(", RowBox[{"Minor", "[", "\[ScriptCapitalA]", "]"}], ")"}], "\[LeftDoubleBracket]", RowBox[{"i", ",", "j"}], "\[RightDoubleBracket]"}]}], "=", SubscriptBox["M", RowBox[{ RowBox[{"n", "-", "i", "+", "1"}], ",", RowBox[{"n", "-", "j", "+", "1"}]}]]}]}], TraditionalForm]}]] }], "Text"], Cell[TextData[StyleBox["References", FontWeight->"Bold"]], "Text"], Cell[TextData[{ "G. Strang, 1988, ", StyleBox["Linear Algebra and Its Applications", FontSlant->"Italic"], ", Harcourt Brace Jovanovich Publ., Third Edition, p. 226" }], "Reference"], Cell[TextData[{ "P.V. O'Neil, 1991, ", StyleBox["Advanced Engineering Mathematics", FontSlant->"Italic"], ", Wadsworth Publ., Third Edition, pp 688\[Dash]690" }], "Reference"] }, Open ]] }, Open ]] }, FrontEndVersion->"Microsoft Windows 3.0", ScreenRectangle->{{0, 1024}, {0, 675}}, WindowSize->{761, 547}, WindowMargins->{{80, Automatic}, {Automatic, 0}}, StyleDefinitions -> "Report.nb" ] (*********************************************************************** Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. ***********************************************************************) (*CellTagsOutline CellTagsIndex->{ "S3.7.7"->{ Cell[5006, 169, 85, 1, 56, "Input", CellTags->"S3.7.7"], Cell[7099, 236, 73, 1, 56, "Input", CellTags->"S3.7.7"], Cell[8780, 290, 77, 1, 56, "Input", CellTags->"S3.7.7"]} } *) (*CellTagsIndex CellTagsIndex->{ {"S3.7.7", 15933, 489} } *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1731, 51, 116, 5, 161, "Title"], Cell[1850, 58, 171, 2, 267, "Author"], Cell[2024, 62, 263, 6, 105, "Abstract"], Cell[CellGroupData[{ Cell[2312, 72, 79, 0, 59, "Subsection"], Cell[2394, 74, 470, 16, 62, "Text"], Cell[2867, 92, 646, 17, 38, "Text"], Cell[3516, 111, 692, 26, 64, "Text"], Cell[4211, 139, 328, 12, 42, "Text"], Cell[4542, 153, 439, 12, 41, "Text"], Cell[CellGroupData[{ Cell[5006, 169, 85, 1, 56, "Input", CellTags->"S3.7.7"], Cell[5094, 172, 957, 26, 116, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[6088, 203, 78, 1, 57, "Input"], Cell[6169, 206, 893, 25, 129, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[7099, 236, 73, 1, 56, "Input", CellTags->"S3.7.7"], Cell[7175, 239, 1513, 44, 141, "Output"] }, Open ]], Cell[8703, 286, 52, 0, 40, "Text"], Cell[CellGroupData[{ Cell[8780, 290, 77, 1, 56, "Input", CellTags->"S3.7.7"], Cell[8860, 293, 4470, 117, 291, "Output"] }, Open ]], Cell[13345, 413, 1476, 38, 142, "Text"], Cell[14824, 453, 68, 1, 40, "Text"], Cell[14895, 456, 192, 5, 58, "Reference"], Cell[15090, 463, 185, 5, 58, "Reference"] }, Open ]] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)