(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 13.2' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] NotebookDataLength[ 13753, 349] NotebookOptionsPosition[ 13098, 329] NotebookOutlinePosition[ 13529, 345] CellTagsIndexPosition[ 13486, 342] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"Op", "[", RowBox[{"A_", ",", "op_"}], "]"}], ":=", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{"e", ",", "cad", ",", "i", ",", "n"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"e", "[", RowBox[{"i_", ",", "m_"}], "]"}], ":=", RowBox[{ RowBox[{"IdentityMatrix", "[", "m", "]"}], "\[LeftDoubleBracket]", "i", "\[RightDoubleBracket]"}]}], ";", "\[IndentingNewLine]", RowBox[{"cad", "=", RowBox[{"ToString", "[", RowBox[{"Hold", "[", "op", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"pi", "=", RowBox[{ RowBox[{"StringPosition", "[", RowBox[{"cad", ",", "\"\<=\>\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"i", "=", RowBox[{"ToExpression", "[", RowBox[{"StringTake", "[", RowBox[{"cad", ",", RowBox[{"{", RowBox[{"7", ",", RowBox[{"pi", "-", "1"}]}], "}"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"cadexp", "=", RowBox[{"StringTake", "[", RowBox[{"cad", ",", RowBox[{"{", RowBox[{ RowBox[{"pi", "+", "1"}], ",", RowBox[{ RowBox[{"StringLength", "[", "cad", "]"}], "-", "1"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"cadexp", "=", RowBox[{"StringReplace", "[", RowBox[{"cadexp", ",", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"\"\\"", "<>", RowBox[{"ToString", "[", "j", "]"}]}], "->", RowBox[{"\"\\"", "<>", RowBox[{"ToString", "[", "j", "]"}], "<>", "\"\<,n]\>\""}]}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "9"}], "}"}]}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"cadexp", "=", RowBox[{"StringReplace", "[", RowBox[{"cadexp", ",", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"\"\\"", "<>", RowBox[{"ToString", "[", "j", "]"}]}], "->", RowBox[{"\"\\"", "<>", RowBox[{"ToString", "[", "j", "]"}], "<>", "\"\<,n]\>\""}]}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "9"}], "}"}]}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"cadexp", "=", RowBox[{"StringReplace", "[", RowBox[{"cadexp", ",", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"\"\\"", "<>", RowBox[{"ToString", "[", "j", "]"}]}], "->", RowBox[{"\"\\"", "<>", RowBox[{"ToString", "[", "j", "]"}], "<>", "\"\<,n]\>\""}]}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "9"}], "}"}]}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"cadexp", "=", RowBox[{"StringReplace", "[", RowBox[{"cadexp", ",", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"\"\\"", "<>", RowBox[{"ToString", "[", "j", "]"}]}], "->", RowBox[{"\"\\"", "<>", RowBox[{"ToString", "[", "j", "]"}], "<>", "\"\<,n]\>\""}]}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "9"}], "}"}]}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"StringTake", "[", RowBox[{"cad", ",", RowBox[{"{", "6", "}"}]}], "]"}], "==", "\"\\""}], " ", "||", " ", RowBox[{ RowBox[{"StringTake", "[", RowBox[{"cad", ",", RowBox[{"{", "6", "}"}]}], "]"}], "==", "\"\\""}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"n", "=", RowBox[{ RowBox[{"Dimensions", "[", "A", "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"exp", "=", RowBox[{"ToExpression", "[", "cadexp", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"c", "=", RowBox[{"IdentityMatrix", "[", "n", "]"}]}], ";", RowBox[{ RowBox[{"c", "[", RowBox[{"[", "i", "]"}], "]"}], "=", "exp"}], ";", "\[IndentingNewLine]", RowBox[{"c", ".", "A"}]}], "\[IndentingNewLine]", ",", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"StringTake", "[", RowBox[{"cad", ",", RowBox[{"{", "6", "}"}]}], "]"}], "==", "\"\\""}], " ", "||", " ", RowBox[{ RowBox[{"StringTake", "[", RowBox[{"cad", ",", RowBox[{"{", "6", "}"}]}], "]"}], "==", "\"\\""}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"n", "=", RowBox[{ RowBox[{"Dimensions", "[", "A", "]"}], "[", RowBox[{"[", "2", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"exp", "=", RowBox[{"ToExpression", "[", "cadexp", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"c", "=", RowBox[{"IdentityMatrix", "[", "n", "]"}]}], ";", RowBox[{ RowBox[{"c", "[", RowBox[{"[", "i", "]"}], "]"}], "=", "exp"}], ";", "\[IndentingNewLine]", RowBox[{"A", ".", RowBox[{"Transpose", "[", "c", "]"}]}]}]}], "\[IndentingNewLine]", "]"}]}], "]"}]}]}], "\[IndentingNewLine]", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"Attributes", "[", "Op", "]"}], "=", RowBox[{"{", "HoldRest", "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"OpEl", "[", RowBox[{"A_", ",", "opl_"}], "]"}], ":=", RowBox[{"(", "\[IndentingNewLine]", RowBox[{ RowBox[{"ca", "=", RowBox[{"ToString", "[", RowBox[{"Hold", "[", "opl", "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ca", "=", RowBox[{"StringReplace", "[", RowBox[{"ca", ",", RowBox[{"{", RowBox[{ RowBox[{"\"\\"", "->", "\"\<\>\""}], ",", RowBox[{"\"\<}]\>\"", "->", "\"\<\>\""}], ",", RowBox[{"\"\< = \>\"", "->", "\"\<=\>\""}], ",", RowBox[{"\"\<, \>\"", "->", "\"\<,\>\""}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ca", "=", RowBox[{"StringSplit", "[", RowBox[{"ca", ",", "\"\<,\>\""}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ci", "=", "0"}], ";", "\[IndentingNewLine]", RowBox[{"pA", "=", "A"}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"ci", "=", "1"}], ",", RowBox[{"ci", "<=", RowBox[{"Length", "[", "ca", "]"}]}], ",", RowBox[{"ci", "++"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"pA", "=", RowBox[{"Op", "[", RowBox[{"pA", ",", RowBox[{"Evaluate", "[", RowBox[{"ca", "[", RowBox[{"[", "ci", "]"}], "]"}], "]"}]}], "]"}]}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", RowBox[{"MatrixForm", "[", "pA", "]"}]}], "\[IndentingNewLine]", ")"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"Attributes", "[", "OpEl", "]"}], "=", RowBox[{"{", "HoldRest", "}"}]}], ";"}]}], "Input", CellOpen->False, InitializationCell->True, CellChangeTimes->{{3.9106701079721994`*^9, 3.910670142896896*^9}, 3.9106701759170732`*^9, {3.9106702142275558`*^9, 3.9106702961381454`*^9}, { 3.9106704088422856`*^9, 3.910670477278556*^9}, {3.9106758045108123`*^9, 3.910676048665928*^9}, {3.9106762062166147`*^9, 3.910676288016717*^9}, { 3.910676355820918*^9, 3.910676498659377*^9}, {3.910676542649712*^9, 3.910676585945266*^9}, {3.9106766198765483`*^9, 3.9106767305995836`*^9}, { 3.9106767877804747`*^9, 3.9106768373354616`*^9}, {3.9106768725469656`*^9, 3.9106769056720314`*^9}, {3.91067695782072*^9, 3.910676998348654*^9}, { 3.9106770331924934`*^9, 3.9106770608802185`*^9}, {3.910677138861722*^9, 3.910677193528962*^9}, {3.9106772730442066`*^9, 3.9106772731667757`*^9}, { 3.9106774167293005`*^9, 3.9106774434015646`*^9}, {3.9106774828721066`*^9, 3.910677508326985*^9}, {3.910677571497817*^9, 3.910677644289525*^9}, { 3.9106776850124807`*^9, 3.9106776853685637`*^9}, {3.9106777314714055`*^9, 3.910677756660405*^9}, {3.9106777905682125`*^9, 3.910677797100269*^9}, { 3.9106778537617674`*^9, 3.910677882128625*^9}, {3.9106828127682247`*^9, 3.9106828170437765`*^9}, {3.910683145086891*^9, 3.9106831731477833`*^9}, { 3.910683205717691*^9, 3.9106832555872326`*^9}, {3.9106833221499786`*^9, 3.91068332733928*^9}, {3.9106845572144947`*^9, 3.910684579871645*^9}, { 3.9106846473602514`*^9, 3.9106846508124385`*^9}, {3.91068477320247*^9, 3.9106847810259256`*^9}, {3.9106848418855963`*^9, 3.910684870696096*^9}, { 3.9106849123087487`*^9, 3.910684919971698*^9}, {3.9106849923755827`*^9, 3.9106850194316487`*^9}, {3.9106850522347183`*^9, 3.9106850743539157`*^9}, {3.9106851139999313`*^9, 3.9106851435714674`*^9}, {3.910685203215618*^9, 3.910685210513958*^9}, { 3.9106852445368743`*^9, 3.910685254148567*^9}, {3.910685345238678*^9, 3.910685374493074*^9}, {3.910685462486183*^9, 3.910685491713555*^9}, { 3.9106855950995393`*^9, 3.91068559698924*^9}}, CellLabel->"In[1]:=",ExpressionUUID->"21db4411-c06b-4978-a721-c93d1cb52891"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"OpEl", "[", RowBox[{ RowBox[{"(", GridBox[{ {"1", "2", "2", "3", "2", "1"}, {"1", "2", "0", "2", "1", "0"}, {"1", "2", "1", "1", "0", "1"}, {"1", "1", "0", "1", "1", "2"} }], ")"}], ",", RowBox[{"{", RowBox[{ RowBox[{"F2", "=", RowBox[{"F2", "-", "f1"}]}], ",", RowBox[{"F3", "=", RowBox[{"F3", "-", "F1"}]}], ",", RowBox[{"f4", "=", RowBox[{"f4", "-", "f1"}]}]}], "}"}]}], "]"}]], "Input", CellChangeTimes->{{3.910681748059988*^9, 3.91068178744925*^9}, { 3.9106818422183895`*^9, 3.910681844936588*^9}, {3.910681888817644*^9, 3.910681891455205*^9}, {3.910682354000143*^9, 3.910682364028227*^9}, 3.9106826396022415`*^9, {3.9106854165799465`*^9, 3.9106854442531404`*^9}, { 3.9106855318999414`*^9, 3.9106855648500447`*^9}, {3.9106856012994156`*^9, 3.9106856033499947`*^9}}, CellLabel->"In[5]:=",ExpressionUUID->"985d2103-2f71-4014-a25b-691bb0412ec1"], Cell[BoxData[ TagBox[ RowBox[{"(", "\[NoBreak]", GridBox[{ {"1", "2", "2", "3", "2", "1"}, {"0", "0", RowBox[{"-", "2"}], RowBox[{"-", "1"}], RowBox[{"-", "1"}], RowBox[{"-", "1"}]}, {"0", "0", RowBox[{"-", "1"}], RowBox[{"-", "2"}], RowBox[{"-", "2"}], "0"}, {"0", RowBox[{"-", "1"}], RowBox[{"-", "2"}], RowBox[{"-", "2"}], RowBox[{"-", "1"}], "1"} }, GridBoxAlignment->{"Columns" -> {{Center}}, "Rows" -> {{Baseline}}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}}], "\[NoBreak]", ")"}], Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]], "Output", CellChangeTimes->{ 3.910684304820856*^9, 3.9106843393420143`*^9, {3.9106843771325717`*^9, 3.910684392417798*^9}, 3.910684430994776*^9, {3.910684614708597*^9, 3.910684631516529*^9}, {3.9106847916559243`*^9, 3.9106848272000027`*^9}, 3.91068488629278*^9, 3.9106849339789915`*^9, 3.91068502469981*^9, 3.9106850856311207`*^9, {3.910685123765725*^9, 3.910685149455593*^9}, { 3.910685232498723*^9, 3.9106852798888683`*^9}, {3.9106853664086328`*^9, 3.9106854014746103`*^9}, {3.9106854317499757`*^9, 3.9106854447982903`*^9}, {3.9106855520911064`*^9, 3.91068560382703*^9}, 3.9106857157354136`*^9}, CellLabel-> "Out[5]//MatrixForm=",ExpressionUUID->"3eeeb538-28cf-4712-a090-\ 3a00a0d76849"] }, Open ]] }, WindowSize->{811.1999999999999, 470.09999999999997`}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, FrontEndVersion->"13.2 para Microsoft Windows (64-bit) (November 18, 2022)", StyleDefinitions->"Default.nb", ExpressionUUID->"9c1786ae-3594-493b-b24d-f433c6ddabb9" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[558, 20, 9968, 236, 19, "Input",ExpressionUUID->"21db4411-c06b-4978-a721-c93d1cb52891", CellOpen->False, InitializationCell->True], Cell[CellGroupData[{ Cell[10551, 260, 973, 23, 78, "Input",ExpressionUUID->"985d2103-2f71-4014-a25b-691bb0412ec1"], Cell[11527, 285, 1555, 41, 147, "Output",ExpressionUUID->"3eeeb538-28cf-4712-a090-3a00a0d76849"] }, Open ]] } ] *)