Questions about RoxReduce
- To: mathgroup at smc.vnet.net
- Subject: [mg23871] Questions about RoxReduce
- From: jmcornil <jmcornil at club-internet.fr>
- Date: Thu, 15 Jun 2000 00:51:09 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hello, I have a few questions about the function RowReduce. Please see the attached NoteBook Thank You for answer J.M. CORNIL (*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 4.0, MathReader 4.0, or any compatible application. The data for the notebook starts with the line containing 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[ 6966, 203]*) (*NotebookOutlinePosition[ 7874, 230]*) (* CellTagsIndexPosition[ 7830, 226]*) (*WindowFrame->Normal*) Notebook[{ Cell["\<\ I have a few questions about the function RowReduce, please see the atthached \ NoteBook. \ \>", "Text"], Cell[CellGroupData[{ Cell["First question : ", "Subsection"], Cell["\<\ The function RowReduce perform a Gauss-Jordan reduction putting 1 on the \"diagonal\" and 0 elsewhere so long it is possible. But is there an other function (or an option for RowReduce) performing a simple Gauss reduction i.e. putting 0 ONLY UNDER the first diagonal ? By the way I saw there is an option \"Method\" for the function.\ \>", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(Options[RowReduce]\)], "Input"], Cell[BoxData[ \(TraditionalForm\`{Method \[Rule] Automatic, Modulus \[Rule] 0, ZeroTest \[Rule] Automatic}\)], "Output"] }, Open ]], Cell["and I did not found any help on it. How to use it ? ", "Text"] }, Open ]], Cell[CellGroupData[{ Cell["Second question : ", "Subsection"], Cell[TextData[{ "I did not foud any function to perform a \"limited\" Gauss reduction, i.e. \ a function performing\na reduction up to a column number . Such an option \ woud be useful in a case as follows \nto get equations of the image of a \ matrice. \n\nIf you let RowReduce working as it will, you also reduce the \ last column (since for\nformally the polynoms in ", Cell[BoxData[ \(TraditionalForm\`y\_i\)]], " are not ZERO) and you cannot get the equations." }], "Text"], Cell[BoxData[{ \(\(n = 5;\)\), "\[IndentingNewLine]", \(\(m = Table[\((i + j - 1)\)^2, {i, n}, {j, n}];\)\), "\[IndentingNewLine]", \(\(v = Table[y\_i, {i, n}];\)\), "\[IndentingNewLine]", \(\(<< LinearAlgebra`MatrixManipulation`;\)\), "\[IndentingNewLine]", \(mv = AppendRows[m, Transpose[{v}]]\)}], "Input"], Cell[BoxData[ FormBox[ RowBox[{"(", "\[NoBreak]", GridBox[{ {"1", "4", "9", "16", "25", \(y\_1\)}, {"4", "9", "16", "25", "36", \(y\_2\)}, {"9", "16", "25", "36", "49", \(y\_3\)}, {"16", "25", "36", "49", "64", \(y\_4\)}, {"25", "36", "49", "64", "81", \(y\_5\)} }], "\[NoBreak]", ")"}], TraditionalForm]], "Output"], Cell[CellGroupData[{ Cell[BoxData[ \(RowReduce[mv]\)], "Input"], Cell[BoxData[ FormBox[ RowBox[{"(", "\[NoBreak]", GridBox[{ {"1", "0", "0", "1", "3", "0"}, {"0", "1", "0", \(-3\), \(-8\), "0"}, {"0", "0", "1", "3", "6", "0"}, {"0", "0", "0", "0", "0", "1"}, {"0", "0", "0", "0", "0", "0"} }, ColumnAlignments->{Decimal}], "\[NoBreak]", ")"}], TraditionalForm]], "Output"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Third and (last) question : ", "Subsection"], Cell[TextData[{ "So I qickly wrote some lines to get my aim. But I am just beginning to \ program with ", StyleBox["Mathematica", FontSlant->"Italic"], "\nand it is written as with Pascal and other classical languages.\nIs ther \ a mean to write such a function using more pattern-matching ? " }], "Text"], Cell[BoxData[ \(\(\(gaussElim[m_, jmax_]\)\(:=\)\(\[IndentingNewLine]\)\(Module[{}, \ \[IndentingNewLine]mm = m; \[IndentingNewLine]nl = \(Dimensions[ mm]\)[\([1]\)]; \[IndentingNewLine]nc = \(Dimensions[ mm]\)[\([2]\)]; \[IndentingNewLine]For[i0 = 1; j0 = 1, \[IndentingNewLine]\ \ \ \ \ \ i0 <= nl; j0 <= Min[nc, jmax], \[IndentingNewLine]\ \ \ \ \ \ \ \(i0++\)\ ; \(j0++\)\ , \ \[IndentingNewLine]\ \ \ \ \ \ ip = i0; \[IndentingNewLine]\ \ \ \ \ \ While[ ip < nl && mm[\([ip, j0]\)] == 0, \(ip++\)]; \[IndentingNewLine]\ \ \ \ \ \ If[ mm[\([ip, j0]\)] \[Equal] 0, \(i0--\); Continue[]]; \[IndentingNewLine]\ \ \ \ \ \ \n\ \ \ \ \ \ \ {mm[\([i0]\)], mm[\([ip]\)]} = {mm[\([ip]\)], mm[\([i0]\)]}; \n\ \ \ \ \ \ \ \ \ \[IndentingNewLine]\ \ \ \ \ \ For[i = i0 + 1, \[IndentingNewLine]\ \ \ \ \ \ \ \ \ \ \ \ \ \ i \[LessEqual] nl, \[IndentingNewLine]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \(i++\), \ \[IndentingNewLine]\ \ \ \ \ \ \ \ \ \ \ \ \ \ mm[\([i]\)] = Simplify[ mm[\([i]\)] - mm[\([i, j0]\)]/mm[\([i0, j0]\)]* mm[\([i0]\)]]];\[IndentingNewLine]]; \ \[IndentingNewLine]mm]\)\(\[IndentingNewLine]\)\)\)], "Input"], Cell[CellGroupData[{ Cell[BoxData[ \(gaussElim[mv, 5]\)], "Input"], Cell[BoxData[ FormBox[ RowBox[{"(", "\[NoBreak]", GridBox[{ {"1", "4", "9", "16", "25", \(y\_1\)}, {"0", \(-7\), \(-20\), \(-39\), \(-64\), \(y\_2 - 4\ y\_1\)}, {"0", "0", \(8\/7\), \(24\/7\), \(48\/7\), \(\(17\ y\_1\)\/7 - \(20\ \ y\_2\)\/7 + y\_3\)}, {"0", "0", "0", "0", "0", \(\(-y\_1\) + 3\ y\_2 - 3\ y\_3 + y\_4\)}, {"0", "0", "0", "0", "0", \(\(-3\)\ y\_1 + 8\ y\_2 - 6\ y\_3 + y\_5\)} }], "\[NoBreak]", ")"}], TraditionalForm]], "Output"] }, Open ]] }, Open ]], Cell["Thanks very much for answer,", "Text"], Cell["\<\ Jack-Michel CORNIL VERSAILLES-FRANCE\ \>", "Subsubtitle"] }, FrontEndVersion->"4.0 for Microsoft Windows", ScreenRectangle->{{0, 800}, {0, 527}}, CellGrouping->Manual, WindowSize->{671, 459}, WindowMargins->{{Automatic, 31}, {18, Automatic}}, StyleDefinitions -> FrontEnd`FileName[{ParentDirectory[ParentDirectory[]], \ "Program Files", "Wolfram Research", "Mathematica", "4.0", "SystemFiles", \ "FrontEnd", "StyleSheets"}, "Default.nb", CharacterEncoding -> "WindowsANSI"] ] (*********************************************************************** 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->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[1717, 49, 114, 4, 52, "Text"], Cell[CellGroupData[{ Cell[1856, 57, 39, 0, 47, "Subsection"], Cell[1898, 59, 360, 7, 128, "Text"], Cell[CellGroupData[{ Cell[2283, 70, 51, 1, 30, "Input"], Cell[2337, 73, 131, 2, 29, "Output"] }, Open ]], Cell[2483, 78, 68, 0, 33, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[2588, 83, 40, 0, 47, "Subsection"], Cell[2631, 85, 492, 9, 128, "Text"], Cell[3126, 96, 355, 7, 110, "Input"], Cell[3484, 105, 398, 8, 99, "Output"], Cell[CellGroupData[{ Cell[3907, 117, 46, 1, 30, "Input"], Cell[3956, 120, 406, 10, 99, "Output"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[4411, 136, 50, 0, 47, "Subsection"], Cell[4464, 138, 315, 7, 71, "Text"], Cell[4782, 147, 1368, 25, 430, "Input"], Cell[CellGroupData[{ Cell[6175, 176, 49, 1, 30, "Input"], Cell[6227, 179, 573, 12, 109, "Output"] }, Open ]] }, Open ]], Cell[6827, 195, 44, 0, 33, "Text"], Cell[6874, 197, 88, 4, 89, "Subsubtitle"] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)