(*********************************************************************** 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@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[ 1103478, 38371]*) (*NotebookOutlinePosition[ 1104456, 38403]*) (* CellTagsIndexPosition[ 1104412, 38399]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Oscillating Chemical Reactions", "Title", TextAlignment->Center], Cell[BoxData[ \(\ \)], "Input"], Cell[CellGroupData[{ Cell["Author Information", "Subtitle", CellFrame->{{0, 0}, {3, 0}}, TextAlignment->Center], Cell["\<\ Scot Martin Assistant Professor of Aquatic and Atmospheric Chemistry Department of Environmental Sciences and Engineering University of North Carolina at Chapel Hill scot_martin@unc.edu Created: August 16, 1998 Last update: August 28, 1998 Computer system: PowerMac 8500/150, 144 MB RAM\ \>", "Text", CellFrame->{{0, 0}, {3, 0}}, TextAlignment->Left] }, Closed]], Cell[CellGroupData[{ Cell["Belousov-Zhabotinskii Reaction", "Subtitle", CellFrame->{{0, 0}, {3, 0}}, TextAlignment->Center], Cell[TextData[{ "The net reaction is as follows:\n\n3 ", Cell[BoxData[ \(TraditionalForm\`CH\_2\)]], "(", Cell[BoxData[ \(TraditionalForm\`CO\_2\)]], "H", Cell[BoxData[ \(TraditionalForm\`\()\_2\)\)]], "+ 2 ", Cell[BoxData[ \(TraditionalForm\`\(BrO\_3\%-\)\)]], "+ 2 ", Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["H", FontSlant->"Plain"], "+"], TraditionalForm]]], " \[Rule] 2 BrCH(", Cell[BoxData[ \(TraditionalForm\`CO\_2\)]], "H", Cell[BoxData[ \(TraditionalForm\`\()\_2\)\)]], " + 3 ", Cell[BoxData[ \(TraditionalForm\`CO\_2\)]], " + 4 H", Cell[BoxData[ \(TraditionalForm\`\_2\)]], "O \n\nThe oscillatory reaction can be represented in 21 steps, but the \ following 6 elementary steps and 3 empirical steps retain the essential \ features of the system:\n\n1: ", Cell[BoxData[ \(TraditionalForm\`\(Br\^-\)\)]], " + HOBr + ", Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["H", FontSlant->"Plain"], "+"], TraditionalForm]]], " \[Rule] ", Cell[BoxData[ \(TraditionalForm\`Br\_2\)]], " + H", Cell[BoxData[ \(TraditionalForm\`\_2\)]], "O\t\t\t\t", Cell[BoxData[ FormBox[ RowBox[{\(k\_1\), "=", " ", FormBox[\(8\ \[Times]10\^9\), "TraditionalForm"]}], TraditionalForm]]], Cell[BoxData[ FormBox[ RowBox[{ SuperscriptBox[ StyleBox["M", FontSlant->"Plain"], \(-2\)], " "}], TraditionalForm]]], Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["s", FontSlant->"Plain"], \(-1\)], TraditionalForm]]], " \n\n2: ", Cell[BoxData[ \(TraditionalForm\`HBrO\_2\)]], "+ ", Cell[BoxData[ \(TraditionalForm\`\(Br\^-\)\)]], "+ ", Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["H", FontSlant->"Plain"], "+"], TraditionalForm]]], " \[Rule] 2 HOBr \t\t\t\t", Cell[BoxData[ FormBox[ RowBox[{\(k\_2\), "=", " ", FormBox[\(10\^6\), "TraditionalForm"]}], TraditionalForm]]], Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["M", FontSlant->"Plain"], \(-2\)], TraditionalForm]]], Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["s", FontSlant->"Plain"], \(-1\)], TraditionalForm]]], "\n\n3: ", Cell[BoxData[ \(TraditionalForm\`\(BrO\_3\%-\)\)]], " + ", Cell[BoxData[ \(TraditionalForm\`\(Br\^-\)\)]], "+ 2", Cell[BoxData[ FormBox[ RowBox[{" ", SuperscriptBox[ StyleBox["H", FontSlant->"Plain"], "+"]}], TraditionalForm]]], "\[Rule] ", Cell[BoxData[ \(TraditionalForm\`HBrO\_2\)]], "+ HOBr\t\t\t", Cell[BoxData[ FormBox[ RowBox[{\(k\_3\), "=", " ", FormBox["2", "TraditionalForm"]}], TraditionalForm]]], Cell[BoxData[ FormBox[ RowBox[{" ", SuperscriptBox[ StyleBox["M", FontSlant->"Plain"], \(-3\)]}], TraditionalForm]]], Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["s", FontSlant->"Plain"], \(-1\)], TraditionalForm]]], "\n\n4: 2 ", Cell[BoxData[ \(TraditionalForm\`HBrO\_2\)]], "\[Rule] ", Cell[BoxData[ \(TraditionalForm\`\(BrO\_3\%-\)\)]], " + HOBr\t + ", Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["H", FontSlant->"Plain"], "+"], TraditionalForm]]], "\t\t\t\t", Cell[BoxData[ FormBox[ RowBox[{\(k\_4\), "=", " ", FormBox[\(2\ \[Times]10\^3\), "TraditionalForm"]}], TraditionalForm]]], Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["M", FontSlant->"Plain"], \(-1\)], TraditionalForm]]], Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["s", FontSlant->"Plain"], \(-1\)], TraditionalForm]]], "\n\n5: ", Cell[BoxData[ \(TraditionalForm\`\(BrO\_3\%-\)\)]], "+ ", Cell[BoxData[ \(TraditionalForm\`HBrO\_2\)]], "+", Cell[BoxData[ FormBox[ RowBox[{" ", SuperscriptBox[ StyleBox["H", FontSlant->"Plain"], "+"]}], TraditionalForm]]], "\[Rule] 2", Cell[BoxData[ \(TraditionalForm\`\(BrO\_2\) \[Bullet]\)]], " + H", Cell[BoxData[ \(TraditionalForm\`\_2\)]], "O\t\t\t", Cell[BoxData[ FormBox[ RowBox[{\(k\_5\), "=", " ", FormBox[\(10\ \), "TraditionalForm"]}], TraditionalForm]]], Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["M", FontSlant->"Plain"], \(-2\)], TraditionalForm]]], Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["s", FontSlant->"Plain"], \(-1\)], TraditionalForm]]], "\n\n6: ", Cell[BoxData[ \(TraditionalForm\`\(BrO\_2\) \[Bullet]\)]], " + Ce(III) + ", Cell[BoxData[ FormBox[ RowBox[{" ", SuperscriptBox[ StyleBox["H", FontSlant->"Plain"], "+"]}], TraditionalForm]]], "\[Rule] ", Cell[BoxData[ \(TraditionalForm\`HBrO\_2\)]], "+ Ce(IV)\t\t", Cell[BoxData[ FormBox[ RowBox[{\(k\_6\), "=", " ", FormBox[\(6\ \[Times]10\^5\), "TraditionalForm"]}], TraditionalForm]]], Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["M", FontSlant->"Plain"], \(-2\)], TraditionalForm]]], Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["s", FontSlant->"Plain"], \(-1\)], TraditionalForm]]], "\n\n7: 2 Ce(IV) + BrCH(COOH", Cell[BoxData[ \(TraditionalForm\`\()\_2\)\)]], "+ ", Cell[BoxData[ \(TraditionalForm\`CH\_2\)]], "(", Cell[BoxData[ \(TraditionalForm\`CO\_2\)]], "H", Cell[BoxData[ \(TraditionalForm\`\()\_2\)\)]], "\[Rule]\t\t", Cell[BoxData[ FormBox[ RowBox[{\(k\_7\), "=", " ", FormBox["1", "TraditionalForm"]}], TraditionalForm]]], Cell[BoxData[ FormBox[ RowBox[{" ", SuperscriptBox[ StyleBox["M", FontSlant->"Plain"], \(-1\)]}], TraditionalForm]]], Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["s", FontSlant->"Plain"], \(-1\)], TraditionalForm]]], "\n\t2 Ce(III) + ", StyleBox["f ", FontSlant->"Italic"], Cell[BoxData[ \(TraditionalForm\`\(Br\^-\)\)]], "+ products\t\t\t\trate = -", Cell[BoxData[ \(TraditionalForm\`d[Ce(IV)]\/dt\)]], "=", Cell[BoxData[ \(TraditionalForm\`k\_7\)]], "[organic][Ce(IV)]\n\n" }], "Text"], Cell[TextData[{ "To simulate this system by numerical brute force, we write a rate equation \ for each reactant. The list of nine reactant species includes: ", Cell[BoxData[ \(TraditionalForm\`\(Br\^-\)\)]], ", HOBr, ", Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["H", FontSlant->"Plain"], "+"], TraditionalForm]]], ", ", Cell[BoxData[ \(TraditionalForm\`HBrO\_2\)]], ", ", Cell[BoxData[ \(TraditionalForm\`\(BrO\_3\%-\)\)]], ", ", Cell[BoxData[ \(TraditionalForm\`\(BrO\_2\) \[Bullet]\)]], ", Ce(III), Ce(IV), and [organic]. We then specify initial conditions, and \ seek a numerical solution.\n\nThe following ", StyleBox["Mathematica", FontSlant->"Italic"], " algorithm is design to assist this process." }], "Text"] }, Closed]], Cell[CellGroupData[{ Cell["\<\ Setting Up the Kinetic System\ \>", "Subtitle", CellFrame->{{0, 0}, {3, 0}}, InitializationCell->True, TextAlignment->Center], Cell[BoxData[ \(\ \)], "Input", InitializationCell->True], Cell[CellGroupData[{ Cell["User Specifications", "Subsubtitle", CellFrame->{{0, 0}, {0.5, 0}}, InitializationCell->True, TextAlignment->Center], Cell[TextData[StyleBox[ "Every place a user should change information to specify the kinetic system \ is shown in blue.", FontColor->RGBColor[0, 0, 1]]], "Text", InitializationCell->True, TextAlignment->Center], Cell[CellGroupData[{ Cell["Names of Species in Kinetic Analysis", "Section", InitializationCell->True], Cell[BoxData[ RowBox[{ RowBox[{ StyleBox["species", FontColor->GrayLevel[0]], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox["=", FontColor->GrayLevel[0]], \({\*"\"\<\!\(\(Br\^-\)\)\>\"", "\", \*"\"\<\!\(\(H\^+\)\)\>\"", \*"\"\<\!\(HBrO\_2\)\>\"", \*"\"\<\!\(\(BrO\_3\%-\)\)\>\"", \*"\"\<\!\(BrO\_2\)\[Bullet]\>\"", "\", "\", "\"}\)}], ";", "\n", "\n", StyleBox[\(totalspecies\ = \ Length[species]\), FontColor->GrayLevel[0]], StyleBox[";", FontColor->GrayLevel[0]]}]], "Input", InitializationCell->True, FontColor->RGBColor[0, 0, 1]] }, Closed]], Cell[CellGroupData[{ Cell["Initial Concentrations (M) of Chemical Species", "Section", InitializationCell->True], Cell[BoxData[ RowBox[{ RowBox[{"conditions", "=", RowBox[{"{", StyleBox[\(0.000625, 10\^\(-6\), 2, 10\^\(-6\), 0.0625, 10\^\(-6\), 10\^\(-6\), 0.002, 0.275\), FontColor->RGBColor[0, 0, 1]], "}"}]}], " ", ";"}]], "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell["Length of time over which to obtain kinetic solution", "Section", InitializationCell->True], Cell[BoxData[ RowBox[{ RowBox[{"integrationtime", " ", "=", StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[\(20*60\), FontColor->RGBColor[0, 0, 1]]}], ";"}]], "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell["Elementary Rate Equation for Each Species", "Section", InitializationCell->True], Cell[TextData[{ "This is the most complex step in the data entry process. However, once \ you have seen an example, it should be straightforward.\n\n", StyleBox["Example", FontVariations->{"Underline"->True}], ":\n\n2: ", Cell[BoxData[ \(TraditionalForm\`HBrO\_2\)]], "+ ", Cell[BoxData[ \(TraditionalForm\`\(Br\^-\)\)]], "+ ", Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["H", FontSlant->"Plain"], "+"], TraditionalForm]]], " \[Rule] 2 HOBr \t\t\t\t", Cell[BoxData[ FormBox[ RowBox[{\(k\_2\), "=", " ", FormBox[\(10\^6\), "TraditionalForm"]}], TraditionalForm]]], Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["M", FontSlant->"Plain"], \(-2\)], TraditionalForm]]], Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["s", FontSlant->"Plain"], \(-1\)], TraditionalForm]]], "\n\nThis equation would have the following entries:\n\n", Cell[BoxData[ \(\(\t{2, 4, "loss", {4, 1, 3}, 1, 10\^6}, \n \t\t{2, 1, "loss", {4, 1, 3}, 1, 10\^6}, \n \t\t{2, 3, "loss", {4, 1, 3}, 1, 10\^6}, \n \t\t{2, 2, "production", {4, 1, 3}, 2, 10\^6}\)\)]], "\n\nThe first line reads: in reaction #2, species #4 (i.e., ", Cell[BoxData[ \(TraditionalForm\`HBrO\_2\)]], ") is lost according to a rate law including species #4 (", Cell[BoxData[ \(TraditionalForm\`HBrO\_2\)]], "), #1 (", Cell[BoxData[ \(TraditionalForm\`\(Br\^-\)\)]], "), and #3 (", Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["H", FontSlant->"Plain"], "+"], TraditionalForm]]], ") with a rate constant of ", Cell[BoxData[ \(10\^6\)]], ". The corresponding differential equation is as follows:\n\n", Cell[BoxData[ \("2: d[\!\(HBrO\_2\)]/dt = -1.e6 \ [\!\(HBrO\_2\)][\!\(\(Br\^-\)\)][\!\(\(H\^+\)\)]"\)]], "\n\nNote that this is just one entry in the complete term for ", Cell[BoxData[ \(\(d[HBrO\_2]/dt\ \)\)]], ".\n\n\n", StyleBox["Explanation", FontVariations->{"Underline"->True}], ": For a single reaction, there are reactants and products. The \ time-dependent change in concentration of each product or reactant is \ expressed according to the stoichiometry of the reaction. The format of each \ entry is as follows:\n\n\t1. reaction number\n\t2. species number for \ time-derivative\n\t3. \"loss\" or \"production\" of species\n\t4. {first \ species, second species, ... and so on} of kinetic rate equation\n\t5. rate \ multiplier [account for stoichiometry]\n\t6. rate constant\n\t\n[N.B. \ Reactions that do not fit this mold can be manually adjusted in the kinetic \ equations later.]\n\n" }], "Text", InitializationCell->True], Cell[BoxData[ RowBox[{ RowBox[{"rates", "=", "\n", "\t", RowBox[{"{", "\n", StyleBox["\t", FontColor->RGBColor[0, 0, 1]], StyleBox[\({1, 1, "\", {1, 2, 3}, 1, 8\[Times]10\^9}, \n \t\t{1, 2, "\", {1, 2, 3}, 1, 8\[Times]10\^9}, \n \t\t{1, 3, "\", {1, 2, 3}, 1, 8\[Times]10\^9}, \n \t\t{2, 4, "\", {4, 1, 3}, 1, 10\^6}, \n \t\t{2, 1, "\", {4, 1, 3}, 1, 10\^6}, \n \t\t{2, 3, "\", {4, 1, 3}, 1, 10\^6}, \n \t\t{2, 2, "\", {4, 1, 3}, 2, 10\^6}, \n \t\t{3, 5, "\", {5, 1, 3, 3}, 1, 2}, \n \t\t{3, 1, "\", {5, 1, 3, 3}, 1, 2}, \n \t\t{3, 3, "\", {5, 1, 3, 3}, 2, 2}, \n \t\t{3, 4, "\", {5, 1, 3, 3}, 1, 2}, \n \t\t{3, 2, "\", {5, 1, 3, 3}, 1, 2}, \n \t\t{4, 4, "\", {4, 4}, 1, 2\[Times]10\^3}, \n \t\t{4, 5, "\", {4, 4}, 1, 2\[Times]10\^3}, \n \t\t{4, 2, "\", {4, 4}, 1, 2\[Times]10\^3}, \n \t\t{4, 3, "\", {4, 4}, 1, 2\[Times]10\^3}, \n \t\t{5, 5, "\", {5, 4, 3}, 1, 10}, \n \t\t{5, 4, "\", {5, 4, 3}, 1, 10}, \n \t\t{5, 3, "\", {5, 4, 3}, 1, 10}, \n \t\t{5, 6, "\", {5, 4, 3}, 2, 10}, \n \t\t{6, 6, "\", {6, 7, 3}, 1, 6\[Times]10\^5}, \n \t\t{6, 7, "\", {6, 7, 3}, 1, 6\[Times]10\^5}, \n \t\t{6, 3, "\", {6, 7, 3}, 1, 6\[Times]10\^5}, \n \t\t{6, 4, "\", {6, 7, 3}, 1, 6\[Times]10\^5}, \n \t\t{6, 8, "\", {6, 7, 3}, 1, 6\[Times]10\^5}, \n \t\t{7, 8, "\", {9, 8}, 1, 1}, \n \t\t{7, 9, "\", {9, 8}, 1, 1}, \n \t\t{7, 7, "\", {9, 8}, 1, 1}, \n \t\t{7, 1, "\", {9, 8}, 0.5 f, 1}\), FontColor->RGBColor[0, 0, 1]], "\n", "\t", "}"}]}], ";", "\n", "\n", \(totalrates = Length[rates]\), ";", "\n", "\n", \(totalreactions = Max[rates\ /. \ {a_, b_, c_, d_, e_, f_}\ -> \ {a}]\), ";"}]], "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell["Special Instructions", "Section", InitializationCell->True], Cell[TextData[{ "You may wish to have special instructions appended to the elementary rate \ equations . For example, in the Belousov-Zhabotinskii Reaction, there is the \ parameter ", StyleBox["f", FontSlant->"Italic"], ". What value should it take?" }], "Text", InitializationCell->True], Cell[BoxData[ \(\(specialinstructions\ = {f -> 2}; \)\)], "Input", InitializationCell->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["\<\ Input Verification\ \>", "Subsubtitle", CellFrame->{{0, 0}, {0.5, 0}}, InitializationCell->True, TextAlignment->Center], Cell["\<\ The kinetic system is now shown, as entered. The user should \ verify the kinetic system for accuracy.\ \>", "Text", InitializationCell->True], Cell[CellGroupData[{ Cell["This expression partially checks data integrity", "Section", InitializationCell->True], Cell["\<\ If the words \"loss\" and \"production\" are properly typed in \ (i.e., no typos), then the result of this operation should be zero.\ \>", "Text", InitializationCell->True], Cell[CellGroupData[{ Cell[BoxData[ \(\(Print[ Length[Cases[ rates, {a_, b_, c_, d___}\ /; \ c != "\"\ && \ c != "\"]]]; \)\)], "Input", InitializationCell->True], Cell[BoxData[ \(0\)], "Print"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell["\<\ Prints Out species numbers, labels, and initial concentrations\ \>", "Section", InitializationCell->True], Cell[CellGroupData[{ Cell[BoxData[ \(Table[{i, species[\([i]\)], conditions[\([i]\)]}, {i, totalspecies}] // TableForm\)], "Input", InitializationCell->True], Cell[BoxData[ TagBox[GridBox[{ {"1", \("\!\(\(Br\^-\)\)"\), StyleBox["0.000625`", StyleBoxAutoDelete->True, PrintPrecision->3]}, {"2", \("HOBr"\), \(1\/1000000\)}, {"3", \("\!\(\(H\^+\)\)"\), "2"}, {"4", \("\!\(HBrO\_2\)"\), \(1\/1000000\)}, {"5", \("\!\(\(BrO\_3\%-\)\)"\), StyleBox["0.0625`", StyleBoxAutoDelete->True, PrintPrecision->3]}, {"6", \("\!\(BrO\_2\)\[Bullet]"\), \(1\/1000000\)}, {"7", \("Ce(III)"\), \(1\/1000000\)}, {"8", \("Ce(IV)"\), StyleBox["0.002`", StyleBoxAutoDelete->True, PrintPrecision->1]}, {"9", \("organic"\), StyleBox["0.275`", StyleBoxAutoDelete->True, PrintPrecision->3]} }, RowSpacings->1, ColumnSpacings->3, RowAlignments->Baseline, ColumnAlignments->{Left}], (TableForm[ #]&)]], "Output"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell["Prints out individual kinetic terms, sorted by reaction", "Section", InitializationCell->True], Cell[CellGroupData[{ Cell[BoxData[ \(\(labelofspecies[a_] := StringJoin["\<[\>"\ , species[\([a]\)], "\<]\>"]; \n\n labelofspecies[{a__}] := StringJoin[Map[labelofspecies, {a}]]; \n\n temp = Table[\n\t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ StringJoin[\n \t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \t ToString[rates[\([i, 1]\)]], \n \t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "\<: \>", \n \t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "\", \n \t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ labelofspecies[rates[\([i, 2]\)]], \n \t\t\t\ \ \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\t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ rates[\([i, 5]\)]], \n \t\t\t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "\< \[Times] \>"]], \n \t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ToString[FortranForm[rates[\([i, 6]\)] // N]], \n \t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "\< \>", \n \t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ labelofspecies[rates[\([i, 4]\)]]\n \t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ], \n \t\t\ \ \ \ \ \ \ \ \ \ \ {i, totalrates}]; \n\n Print["\"]; \n\nPrint[TableForm[temp]]; \n\)\)], "Input", InitializationCell->True], Cell[BoxData[ \("Reaction"\)], "Print"], Cell[BoxData[ InterpretationBox[GridBox[{ { \("1: d[\!\(\(Br\^-\)\)]/dt = -8.e9 [\!\(\(Br\^-\)\)][HOBr][\!\(\ \(H\^+\)\)]"\)}, { \("1: d[HOBr]/dt = -8.e9 \ [\!\(\(Br\^-\)\)][HOBr][\!\(\(H\^+\)\)]"\)}, { \("1: d[\!\(\(H\^+\)\)]/dt = -8.e9 \ [\!\(\(Br\^-\)\)][HOBr][\!\(\(H\^+\)\)]"\)}, { \("2: d[\!\(HBrO\_2\)]/dt = -1.e6 \ [\!\(HBrO\_2\)][\!\(\(Br\^-\)\)][\!\(\(H\^+\)\)]"\)}, { \("2: d[\!\(\(Br\^-\)\)]/dt = -1.e6 \ [\!\(HBrO\_2\)][\!\(\(Br\^-\)\)][\!\(\(H\^+\)\)]"\)}, { \("2: d[\!\(\(H\^+\)\)]/dt = -1.e6 [\!\(HBrO\_2\)][\!\(\(Br\^-\)\ \)][\!\(\(H\^+\)\)]"\)}, { \("2: d[HOBr]/dt = 2 \[Times] 1.e6 [\!\(HBrO\_2\)][\!\(\(Br\^-\)\ \)][\!\(\(H\^+\)\)]"\)}, { \("3: d[\!\(\(BrO\_3\%-\)\)]/dt = -2. [\!\(\(BrO\_3\%-\)\)][\!\(\ \(Br\^-\)\)][\!\(\(H\^+\)\)][\!\(\(H\^+\)\)]"\)}, { \("3: d[\!\(\(Br\^-\)\)]/dt = -2. [\!\(\(BrO\_3\%-\)\)][\!\(\(Br\ \^-\)\)][\!\(\(H\^+\)\)][\!\(\(H\^+\)\)]"\)}, { \("3: d[\!\(\(H\^+\)\)]/dt = -2 \[Times] 2. \ [\!\(\(BrO\_3\%-\)\)][\!\(\(Br\^-\)\)][\!\(\(H\^+\)\)][\!\(\(H\^+\)\)]"\)}, { \("3: d[\!\(HBrO\_2\)]/dt = 2. [\!\(\(BrO\_3\%-\)\)][\!\(\(Br\^-\ \)\)][\!\(\(H\^+\)\)][\!\(\(H\^+\)\)]"\)}, { \("3: d[HOBr]/dt = 2. \ [\!\(\(BrO\_3\%-\)\)][\!\(\(Br\^-\)\)][\!\(\(H\^+\)\)][\!\(\(H\^+\)\)]"\)}, { \("4: d[\!\(HBrO\_2\)]/dt = -2000. \ [\!\(HBrO\_2\)][\!\(HBrO\_2\)]"\)}, { \("4: d[\!\(\(BrO\_3\%-\)\)]/dt = 2000. [\!\(HBrO\_2\)][\!\(HBrO\ \_2\)]"\)}, {\("4: d[HOBr]/dt = 2000. [\!\(HBrO\_2\)][\!\(HBrO\_2\)]"\)}, { \("4: d[\!\(\(H\^+\)\)]/dt = 2000. \ [\!\(HBrO\_2\)][\!\(HBrO\_2\)]"\)}, { \("5: d[\!\(\(BrO\_3\%-\)\)]/dt = -10. \ [\!\(\(BrO\_3\%-\)\)][\!\(HBrO\_2\)][\!\(\(H\^+\)\)]"\)}, { \("5: d[\!\(HBrO\_2\)]/dt = -10. \ [\!\(\(BrO\_3\%-\)\)][\!\(HBrO\_2\)][\!\(\(H\^+\)\)]"\)}, { \("5: d[\!\(\(H\^+\)\)]/dt = -10. [\!\(\(BrO\_3\%-\)\)][\!\(HBrO\ \_2\)][\!\(\(H\^+\)\)]"\)}, { \("5: d[\!\(BrO\_2\)\[Bullet]]/dt = 2 \[Times] 10. [\!\(\(BrO\_3\ \%-\)\)][\!\(HBrO\_2\)][\!\(\(H\^+\)\)]"\)}, { \("6: d[\!\(BrO\_2\)\[Bullet]]/dt = -600000. [\!\(BrO\_2\)\ \[Bullet]][Ce(III)][\!\(\(H\^+\)\)]"\)}, { \("6: d[Ce(III)]/dt = -600000. [\!\(BrO\_2\)\[Bullet]][Ce(III)][\ \!\(\(H\^+\)\)]"\)}, { \("6: d[\!\(\(H\^+\)\)]/dt = -600000. \ [\!\(BrO\_2\)\[Bullet]][Ce(III)][\!\(\(H\^+\)\)]"\)}, { \("6: d[\!\(HBrO\_2\)]/dt = 600000. \ [\!\(BrO\_2\)\[Bullet]][Ce(III)][\!\(\(H\^+\)\)]"\)}, { \("6: d[Ce(IV)]/dt = 600000. [\!\(BrO\_2\)\[Bullet]][Ce(III)][\!\ \(\(H\^+\)\)]"\)}, {\("7: d[Ce(IV)]/dt = -1. [organic][Ce(IV)]"\)}, {\("7: d[organic]/dt = -1. [organic][Ce(IV)]"\)}, {\("7: d[Ce(III)]/dt = 1. [organic][Ce(IV)]"\)}, { \("7: d[\!\(\(Br\^-\)\)]/dt = 0.5 f \[Times] 1. \ [organic][Ce(IV)]"\)} }, RowSpacings->1, ColumnSpacings->3, RowAlignments->Baseline, ColumnAlignments->{Left}], TableForm[ {"1: d[\!\(\(Br\^-\)\)]/dt = -8.e9 [\!\(\(Br\^-\)\)][HOBr][\!\(\(H\^+\ \)\)]", "1: d[HOBr]/dt = -8.e9 [\!\(\(Br\^-\)\)][HOBr][\!\(\(H\^+\)\)]", "1: d[\!\(\(H\^+\)\)]/dt = -8.e9 \ [\!\(\(Br\^-\)\)][HOBr][\!\(\(H\^+\)\)]", "2: d[\!\(HBrO\_2\)]/dt = -1.e6 \ [\!\(HBrO\_2\)][\!\(\(Br\^-\)\)][\!\(\(H\^+\)\)]", "2: d[\!\(\(Br\^-\)\)]/dt = -1.e6 \ [\!\(HBrO\_2\)][\!\(\(Br\^-\)\)][\!\(\(H\^+\)\)]", "2: d[\!\(\(H\^+\)\)]/dt = -1.e6 [\!\(HBrO\_2\)][\!\(\(Br\^-\)\)][\!\ \(\(H\^+\)\)]", "2: d[HOBr]/dt = 2 \[Times] 1.e6 [\!\(HBrO\_2\)][\!\(\(Br\^-\)\)][\!\ \(\(H\^+\)\)]", "3: d[\!\(\(BrO\_3\%-\)\)]/dt = -2. \ [\!\(\(BrO\_3\%-\)\)][\!\(\(Br\^-\)\)][\!\(\(H\^+\)\)][\!\(\(H\^+\)\)]", "3: d[\!\(\(Br\^-\)\)]/dt = -2. \ [\!\(\(BrO\_3\%-\)\)][\!\(\(Br\^-\)\)][\!\(\(H\^+\)\)][\!\(\(H\^+\)\)]", "3: d[\!\(\(H\^+\)\)]/dt = -2 \[Times] 2. [\!\(\(BrO\_3\%-\)\)][\!\(\ \(Br\^-\)\)][\!\(\(H\^+\)\)][\!\(\(H\^+\)\)]", "3: d[\!\(HBrO\_2\)]/dt = 2. [\!\(\(BrO\_3\%-\)\)][\!\(\(Br\^-\)\)][\ \!\(\(H\^+\)\)][\!\(\(H\^+\)\)]", "3: d[HOBr]/dt = 2. \ [\!\(\(BrO\_3\%-\)\)][\!\(\(Br\^-\)\)][\!\(\(H\^+\)\)][\!\(\(H\^+\)\)]", "4: d[\!\(HBrO\_2\)]/dt = -2000. [\!\(HBrO\_2\)][\!\(HBrO\_2\)]", "4: d[\!\(\(BrO\_3\%-\)\)]/dt = 2000. \ [\!\(HBrO\_2\)][\!\(HBrO\_2\)]", "4: d[HOBr]/dt = 2000. [\!\(HBrO\_2\)][\!\(HBrO\_2\)]", "4: d[\!\(\(H\^+\)\)]/dt = 2000. [\!\(HBrO\_2\)][\!\(HBrO\_2\)]", "5: d[\!\(\(BrO\_3\%-\)\)]/dt = -10. \ [\!\(\(BrO\_3\%-\)\)][\!\(HBrO\_2\)][\!\(\(H\^+\)\)]", "5: d[\!\(HBrO\_2\)]/dt = -10. [\!\(\(BrO\_3\%-\)\)][\!\(HBrO\_2\)][\ \!\(\(H\^+\)\)]", "5: d[\!\(\(H\^+\)\)]/dt = -10. \ [\!\(\(BrO\_3\%-\)\)][\!\(HBrO\_2\)][\!\(\(H\^+\)\)]", "5: d[\!\(BrO\_2\)\[Bullet]]/dt = 2 \[Times] 10. \ [\!\(\(BrO\_3\%-\)\)][\!\(HBrO\_2\)][\!\(\(H\^+\)\)]", "6: d[\!\(BrO\_2\)\[Bullet]]/dt = -600000. \ [\!\(BrO\_2\)\[Bullet]][Ce(III)][\!\(\(H\^+\)\)]", "6: d[Ce(III)]/dt = -600000. \ [\!\(BrO\_2\)\[Bullet]][Ce(III)][\!\(\(H\^+\)\)]", "6: d[\!\(\(H\^+\)\)]/dt = -600000. \ [\!\(BrO\_2\)\[Bullet]][Ce(III)][\!\(\(H\^+\)\)]", "6: d[\!\(HBrO\_2\)]/dt = 600000. \ [\!\(BrO\_2\)\[Bullet]][Ce(III)][\!\(\(H\^+\)\)]", "6: d[Ce(IV)]/dt = 600000. \ [\!\(BrO\_2\)\[Bullet]][Ce(III)][\!\(\(H\^+\)\)]", "7: d[Ce(IV)]/dt = -1. [organic][Ce(IV)]", "7: d[organic]/dt = -1. [organic][Ce(IV)]", "7: d[Ce(III)]/dt = 1. [organic][Ce(IV)]", "7: d[\!\(\(Br\^-\)\)]/dt = 0.5 f \[Times] 1. [organic][Ce(IV)]"}]]], "Print"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell["Prints out individual kinetic terms, sorted by species", "Section", InitializationCell->True], Cell[CellGroupData[{ Cell[BoxData[ \(temp = Table[{\n\t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ rates[\([i, 2]\)], \n \t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ StringJoin["\", labelofspecies[rates[\([i, 2]\)]], "\"], \n\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ StringJoin[\n\t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ If[rates[\([i, 3]\)] == "\", "\<-\>", "\<\>"], \n \t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ If[rates[\([i, 5]\)] != 1, \n \t\t\t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ StringJoin[ToString[rates[\([i, 5]\)]], "\< \[Times] \>"], \n \t\t\t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "\<\>", \n \t\t\t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ StringJoin[ToString[rates[\([i, 5]\)]], "\< \[Times] \>"]], \n \t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ToString[FortranForm[rates[\([i, 6]\)] // N]], \n \t\t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "\< \>", \n \t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ labelofspecies[rates[\([i, 4]\)]]\n \t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ]\n \t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }, \n \t\t\ \ \ \ \ \ \ \ \ \ \ \ {i, totalrates}]; \n\n Print["\"]; \n\ntemp = Sort[temp]; \n\nPrint[TableForm[temp]]; \)], "Input", InitializationCell->True], Cell[BoxData[ \("Species"\)], "Print"], Cell[BoxData[ TagBox[GridBox[{ {"1", \("d[\!\(\(Br\^-\)\)]/dt = "\), \("0.5 f \[Times] 1. [organic][Ce(IV)]"\)}, {"1", \("d[\!\(\(Br\^-\)\)]/dt = "\), \("-1.e6 [\!\(HBrO\_2\)][\!\(\(Br\^-\)\)][\!\(\(H\^+\)\)]"\)}, {"1", \("d[\!\(\(Br\^-\)\)]/dt = "\), \("-2. [\!\(\(BrO\_3\%-\)\)][\!\(\(Br\^-\)\)][\!\(\(H\^+\)\)][\!\(\ \(H\^+\)\)]"\)}, {"1", \("d[\!\(\(Br\^-\)\)]/dt = "\), \("-8.e9 [\!\(\(Br\^-\)\)][HOBr][\!\(\(H\^+\)\)]"\)}, {"2", \("d[HOBr]/dt = "\), \("2000. [\!\(HBrO\_2\)][\!\(HBrO\_2\)]"\)}, {"2", \("d[HOBr]/dt = "\), \("2. [\!\(\(BrO\_3\%-\)\)][\!\(\(Br\^-\)\)][\!\(\(H\^+\)\)][\!\(\ \(H\^+\)\)]"\)}, {"2", \("d[HOBr]/dt = "\), \("2 \[Times] 1.e6 \ [\!\(HBrO\_2\)][\!\(\(Br\^-\)\)][\!\(\(H\^+\)\)]"\)}, {"2", \("d[HOBr]/dt = "\), \("-8.e9 [\!\(\(Br\^-\)\)][HOBr][\!\(\(H\^+\)\)]"\)}, {"3", \("d[\!\(\(H\^+\)\)]/dt = "\), \("-10. [\!\(\(BrO\_3\%-\)\)][\!\(HBrO\_2\)][\!\(\(H\^+\)\)]"\)}, {"3", \("d[\!\(\(H\^+\)\)]/dt = "\), \("-1.e6 [\!\(HBrO\_2\)][\!\(\(Br\^-\)\)][\!\(\(H\^+\)\)]"\)}, {"3", \("d[\!\(\(H\^+\)\)]/dt = "\), \("2000. [\!\(HBrO\_2\)][\!\(HBrO\_2\)]"\)}, {"3", \("d[\!\(\(H\^+\)\)]/dt = "\), \("-2 \[Times] 2. \ [\!\(\(BrO\_3\%-\)\)][\!\(\(Br\^-\)\)][\!\(\(H\^+\)\)][\!\(\(H\^+\)\)]"\)}, {"3", \("d[\!\(\(H\^+\)\)]/dt = "\), \("-600000. [\!\(BrO\_2\)\[Bullet]][Ce(III)][\!\(\(H\^+\)\)]"\)}, {"3", \("d[\!\(\(H\^+\)\)]/dt = "\), \("-8.e9 [\!\(\(Br\^-\)\)][HOBr][\!\(\(H\^+\)\)]"\)}, {"4", \("d[\!\(HBrO\_2\)]/dt = "\), \("-10. [\!\(\(BrO\_3\%-\)\)][\!\(HBrO\_2\)][\!\(\(H\^+\)\)]"\)}, {"4", \("d[\!\(HBrO\_2\)]/dt = "\), \("-1.e6 [\!\(HBrO\_2\)][\!\(\(Br\^-\)\)][\!\(\(H\^+\)\)]"\)}, {"4", \("d[\!\(HBrO\_2\)]/dt = "\), \("-2000. [\!\(HBrO\_2\)][\!\(HBrO\_2\)]"\)}, {"4", \("d[\!\(HBrO\_2\)]/dt = "\), \("2. [\!\(\(BrO\_3\%-\)\)][\!\(\(Br\^-\)\)][\!\(\(H\^+\)\)][\!\(\ \(H\^+\)\)]"\)}, {"4", \("d[\!\(HBrO\_2\)]/dt = "\), \("600000. [\!\(BrO\_2\)\[Bullet]][Ce(III)][\!\(\(H\^+\)\)]"\)}, {"5", \("d[\!\(\(BrO\_3\%-\)\)]/dt = "\), \("-10. [\!\(\(BrO\_3\%-\)\)][\!\(HBrO\_2\)][\!\(\(H\^+\)\)]"\)}, {"5", \("d[\!\(\(BrO\_3\%-\)\)]/dt = "\), \("2000. [\!\(HBrO\_2\)][\!\(HBrO\_2\)]"\)}, {"5", \("d[\!\(\(BrO\_3\%-\)\)]/dt = "\), \("-2. [\!\(\(BrO\_3\%-\)\)][\!\(\(Br\^-\)\)][\!\(\(H\^+\)\)][\!\(\ \(H\^+\)\)]"\)}, {"6", \("d[\!\(BrO\_2\)\[Bullet]]/dt = "\), \("2 \[Times] 10. [\!\(\(BrO\_3\%-\)\)][\!\(HBrO\_2\)][\!\(\(H\^+\ \)\)]"\)}, {"6", \("d[\!\(BrO\_2\)\[Bullet]]/dt = "\), \("-600000. [\!\(BrO\_2\)\[Bullet]][Ce(III)][\!\(\(H\^+\)\)]"\)}, {"7", \("d[Ce(III)]/dt = "\), \("1. [organic][Ce(IV)]"\)}, {"7", \("d[Ce(III)]/dt = "\), \("-600000. [\!\(BrO\_2\)\[Bullet]][Ce(III)][\!\(\(H\^+\)\)]"\)}, {"8", \("d[Ce(IV)]/dt = "\), \("-1. [organic][Ce(IV)]"\)}, {"8", \("d[Ce(IV)]/dt = "\), \("600000. [\!\(BrO\_2\)\[Bullet]][Ce(III)][\!\(\(H\^+\)\)]"\)}, {"9", \("d[organic]/dt = "\), \("-1. [organic][Ce(IV)]"\)} }, RowSpacings->1, ColumnSpacings->3, RowAlignments->Baseline, ColumnAlignments->{Left}], (TableForm[ #]&)]], "Print"] }, Open ]] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["\<\ Translating User Specifications into Differential Equations\ \>", "Subsubtitle", CellFrame->{{0, 0}, {0.5, 0}}, InitializationCell->True, TextAlignment->Center], Cell[CellGroupData[{ Cell["Flux through each reaction channel", "Section", InitializationCell->True], Cell[CellGroupData[{ Cell[BoxData[ \(channels = Table[\n\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \((temp = Delete[\n \t\t\t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ First[\n\t\t\t\t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Cases[rates, {a_, b__}\ /; \ a == i]\n \t\t\t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \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InterpretationBox[GridBox[{ {\(8000000000\ \(y[1]\)[t]\ \(y[2]\)[t]\ \(y[3]\)[t]\)}, {\(1000000\ \(y[1]\)[t]\ \(y[3]\)[t]\ \(y[4]\)[t]\)}, {\(2\ \(y[1]\)[t]\ \(y[3]\)[t]\^2\ \(y[5]\)[t]\)}, {\(2000\ \(y[4]\)[t]\^2\)}, {\(10\ \(y[3]\)[t]\ \(y[4]\)[t]\ \(y[5]\)[t]\)}, {\(600000\ \(y[3]\)[t]\ \(y[6]\)[t]\ \(y[7]\)[t]\)}, {\(\(y[8]\)[t]\ \(y[9]\)[t]\)} }, RowSpacings->1, ColumnSpacings->3, RowAlignments->Baseline, ColumnAlignments->{Left}], TableForm[ { Times[ 8000000000, y[ 1][ t], y[ 2][ t], y[ 3][ t]], Times[ 1000000, y[ 1][ t], y[ 3][ t], y[ 4][ t]], Times[ 2, y[ 1][ t], Power[ y[ 3][ t], 2], y[ 5][ t]], Times[ 2000, Power[ y[ 4][ t], 2]], Times[ 10, y[ 3][ t], y[ 4][ t], y[ 5][ t]], Times[ 600000, y[ 3][ t], y[ 6][ t], y[ 7][ t]], Times[ y[ 8][ t], y[ 9][ t]]}]]], "Output"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell["Combine terms to construct rate laws", "Section", InitializationCell->True], Cell[CellGroupData[{ Cell[BoxData[ \(ratelaws = Table[\n\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \(y[i]'\)[t] == \n \t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \((\n\t\t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ sumofsourcesandsinks = {0}; \n \t\t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \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\ \ \ \ \ \ \ \ \ )\)\t\n\t\t\n \t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ , {i, totalspecies}]; \n\nratelaws // TableForm\)], "Input", InitializationCell->True], Cell[BoxData[ InterpretationBox[GridBox[{ { RowBox[{ RowBox[{ SuperscriptBox[\(y[1]\), "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "==", RowBox[{ \(\(-8000000000\)\ \(y[1]\)[t]\ \(y[2]\)[t]\ \(y[3]\)[t]\), "-", \(1000000\ \(y[1]\)[t]\ \(y[3]\)[t]\ \(y[4]\)[t]\), "-", \(2\ \(y[1]\)[t]\ \(y[3]\)[t]\^2\ \(y[5]\)[t]\), "+", RowBox[{ StyleBox["0.5`", StyleBoxAutoDelete->True, PrintPrecision->1], " ", "f", " ", \(\(y[8]\)[t]\), " ", \(\(y[9]\)[t]\)}]}]}]}, { RowBox[{ RowBox[{ SuperscriptBox[\(y[2]\), "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "==", \(\(-8000000000\)\ \(y[1]\)[t]\ \(y[2]\)[t]\ \(y[3]\)[t] + 2000000\ \(y[1]\)[t]\ \(y[3]\)[t]\ \(y[4]\)[t] + 2000\ \(y[4]\)[t]\^2 + 2\ \(y[1]\)[t]\ \(y[3]\)[t]\^2\ \(y[5]\)[t]\)}]}, { RowBox[{ RowBox[{ SuperscriptBox[\(y[3]\), "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "==", \(\(-8000000000\)\ \(y[1]\)[t]\ \(y[2]\)[t]\ \(y[3]\)[t] - 1000000\ \(y[1]\)[t]\ \(y[3]\)[t]\ \(y[4]\)[t] + 2000\ \(y[4]\)[t]\^2 - 4\ \(y[1]\)[t]\ \(y[3]\)[t]\^2\ \(y[5]\)[t] - 10\ \(y[3]\)[t]\ \(y[4]\)[t]\ \(y[5]\)[t] - 600000\ \(y[3]\)[t]\ \(y[6]\)[t]\ \(y[7]\)[t]\)}]}, { RowBox[{ RowBox[{ SuperscriptBox[\(y[4]\), "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "==", \(\(-1000000\)\ \(y[1]\)[t]\ \(y[3]\)[t]\ \(y[4]\)[t] - 2000\ \(y[4]\)[t]\^2 + 2\ \(y[1]\)[t]\ \(y[3]\)[t]\^2\ \(y[5]\)[t] - 10\ \(y[3]\)[t]\ \(y[4]\)[t]\ \(y[5]\)[t] + 600000\ \(y[3]\)[t]\ \(y[6]\)[t]\ \(y[7]\)[t]\)}]}, { RowBox[{ RowBox[{ SuperscriptBox[\(y[5]\), "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "==", \(2000\ \(y[4]\)[t]\^2 - 2\ \(y[1]\)[t]\ \(y[3]\)[t]\^2\ \(y[5]\)[t] - 10\ \(y[3]\)[t]\ \(y[4]\)[t]\ \(y[5]\)[t]\)}]}, { RowBox[{ RowBox[{ SuperscriptBox[\(y[6]\), "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "==", \(20\ \(y[3]\)[t]\ \(y[4]\)[t]\ \(y[5]\)[t] - 600000\ \(y[3]\)[t]\ \(y[6]\)[t]\ \(y[7]\)[t]\)}]}, { RowBox[{ RowBox[{ SuperscriptBox[\(y[7]\), "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "==", \(\(-600000\)\ \(y[3]\)[t]\ \(y[6]\)[t]\ \(y[7]\)[t] + \(y[8]\)[t]\ \(y[9]\)[t]\)}]}, { RowBox[{ RowBox[{ SuperscriptBox[\(y[8]\), "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "==", \(600000\ \(y[3]\)[t]\ \(y[6]\)[t]\ \(y[7]\)[t] - \(y[8]\)[t]\ \(y[9]\)[t]\)}]}, { RowBox[{ RowBox[{ SuperscriptBox[\(y[9]\), "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "==", \(\(-\(y[8]\)[t]\)\ \(y[9]\)[t]\)}]} }, RowSpacings->1, ColumnSpacings->3, RowAlignments->Baseline, ColumnAlignments->{Left}], TableForm[ { Equal[ Derivative[ 1][ y[ 1]][ t], Plus[ Times[ -8000000000, y[ 1][ t], y[ 2][ t], y[ 3][ t]], Times[ -1000000, y[ 1][ t], y[ 3][ t], y[ 4][ t]], Times[ -2, y[ 1][ t], Power[ y[ 3][ t], 2], y[ 5][ t]], Times[ 0.5, f, y[ 8][ t], y[ 9][ t]]]], Equal[ Derivative[ 1][ y[ 2]][ t], Plus[ Times[ -8000000000, y[ 1][ t], y[ 2][ t], y[ 3][ t]], Times[ 2000000, y[ 1][ t], y[ 3][ t], y[ 4][ t]], Times[ 2000, Power[ y[ 4][ t], 2]], Times[ 2, y[ 1][ t], Power[ y[ 3][ t], 2], y[ 5][ t]]]], Equal[ Derivative[ 1][ y[ 3]][ t], Plus[ Times[ -8000000000, y[ 1][ t], y[ 2][ t], y[ 3][ t]], Times[ -1000000, y[ 1][ t], y[ 3][ t], y[ 4][ t]], Times[ 2000, Power[ y[ 4][ t], 2]], Times[ -4, y[ 1][ t], Power[ y[ 3][ t], 2], y[ 5][ t]], Times[ -10, y[ 3][ t], y[ 4][ t], y[ 5][ t]], Times[ -600000, y[ 3][ t], y[ 6][ t], y[ 7][ t]]]], Equal[ Derivative[ 1][ y[ 4]][ t], Plus[ Times[ -1000000, y[ 1][ t], y[ 3][ t], y[ 4][ t]], Times[ -2000, Power[ y[ 4][ t], 2]], Times[ 2, y[ 1][ t], Power[ y[ 3][ t], 2], y[ 5][ t]], Times[ -10, y[ 3][ t], y[ 4][ t], y[ 5][ t]], Times[ 600000, y[ 3][ t], y[ 6][ t], y[ 7][ t]]]], Equal[ Derivative[ 1][ y[ 5]][ t], Plus[ Times[ 2000, Power[ y[ 4][ t], 2]], Times[ -2, y[ 1][ t], Power[ y[ 3][ t], 2], y[ 5][ t]], Times[ -10, y[ 3][ t], y[ 4][ t], y[ 5][ t]]]], Equal[ Derivative[ 1][ y[ 6]][ t], Plus[ Times[ 20, y[ 3][ t], y[ 4][ t], y[ 5][ t]], Times[ -600000, y[ 3][ t], y[ 6][ t], y[ 7][ t]]]], Equal[ Derivative[ 1][ y[ 7]][ t], Plus[ Times[ -600000, y[ 3][ t], y[ 6][ t], y[ 7][ t]], Times[ y[ 8][ t], y[ 9][ t]]]], Equal[ Derivative[ 1][ y[ 8]][ t], Plus[ Times[ 600000, y[ 3][ t], y[ 6][ t], y[ 7][ t]], Times[ -1, y[ 8][ t], y[ 9][ t]]]], Equal[ Derivative[ 1][ y[ 9]][ t], Times[ -1, y[ 8][ t], y[ 9][ t]]]}]]], "Output"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell["Express initial conditions in Mathematica language", "Section", InitializationCell->True], Cell[CellGroupData[{ Cell[BoxData[ \(initialconditions = \n\t\ \ \ \ \ \ \ \ \ \ \ \ \ Table[\n\t\t\n\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \(y[i]\)[0] == conditions[\([i]\)]\n\t\t\n \t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ , {i, totalspecies}]; \n\n initialconditions // TableForm\)], "Input", InitializationCell->True], Cell[BoxData[ InterpretationBox[GridBox[{ { RowBox[{\(\(y[1]\)[0]\), "==", StyleBox["0.000625`", StyleBoxAutoDelete->True, PrintPrecision->3]}]}, {\(\(y[2]\)[0] == 1\/1000000\)}, {\(\(y[3]\)[0] == 2\)}, {\(\(y[4]\)[0] == 1\/1000000\)}, { RowBox[{\(\(y[5]\)[0]\), "==", StyleBox["0.0625`", StyleBoxAutoDelete->True, PrintPrecision->3]}]}, {\(\(y[6]\)[0] == 1\/1000000\)}, {\(\(y[7]\)[0] == 1\/1000000\)}, { RowBox[{\(\(y[8]\)[0]\), "==", StyleBox["0.002`", StyleBoxAutoDelete->True, PrintPrecision->1]}]}, { RowBox[{\(\(y[9]\)[0]\), "==", StyleBox["0.275`", StyleBoxAutoDelete->True, PrintPrecision->3]}]} }, RowSpacings->1, ColumnSpacings->3, RowAlignments->Baseline, ColumnAlignments->{Left}], TableForm[ { Equal[ y[ 1][ 0], 0.00062500000000000001], Equal[ y[ 2][ 0], Rational[ 1, 1000000]], Equal[ y[ 3][ 0], 2], Equal[ y[ 4][ 0], Rational[ 1, 1000000]], Equal[ y[ 5][ 0], 0.0625], Equal[ y[ 6][ 0], Rational[ 1, 1000000]], Equal[ y[ 7][ 0], Rational[ 1, 1000000]], Equal[ y[ 8][ 0], 0.002], Equal[ y[ 9][ 0], 0.27500000000000002]}]]], "Output"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell["\<\ Link rate laws and initial conditions in Mathematica language\ \>", "Section", InitializationCell->True], Cell[CellGroupData[{ Cell[BoxData[ \(eqs = Join[ratelaws, initialconditions]; \n\neqs // TableForm\)], "Input", InitializationCell->True], Cell[BoxData[ InterpretationBox[GridBox[{ { RowBox[{ RowBox[{ SuperscriptBox[\(y[1]\), "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "==", RowBox[{ \(\(-8000000000\)\ \(y[1]\)[t]\ \(y[2]\)[t]\ \(y[3]\)[t]\), "-", \(1000000\ \(y[1]\)[t]\ \(y[3]\)[t]\ \(y[4]\)[t]\), "-", \(2\ \(y[1]\)[t]\ \(y[3]\)[t]\^2\ \(y[5]\)[t]\), "+", RowBox[{ StyleBox["0.5`", StyleBoxAutoDelete->True, PrintPrecision->1], " ", "f", " ", \(\(y[8]\)[t]\), " ", \(\(y[9]\)[t]\)}]}]}]}, { RowBox[{ RowBox[{ SuperscriptBox[\(y[2]\), "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "==", \(\(-8000000000\)\ \(y[1]\)[t]\ \(y[2]\)[t]\ \(y[3]\)[t] + 2000000\ \(y[1]\)[t]\ \(y[3]\)[t]\ \(y[4]\)[t] + 2000\ \(y[4]\)[t]\^2 + 2\ \(y[1]\)[t]\ \(y[3]\)[t]\^2\ \(y[5]\)[t]\)}]}, { RowBox[{ RowBox[{ SuperscriptBox[\(y[3]\), "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "==", \(\(-8000000000\)\ \(y[1]\)[t]\ \(y[2]\)[t]\ \(y[3]\)[t] - 1000000\ \(y[1]\)[t]\ \(y[3]\)[t]\ \(y[4]\)[t] + 2000\ \(y[4]\)[t]\^2 - 4\ \(y[1]\)[t]\ \(y[3]\)[t]\^2\ \(y[5]\)[t] - 10\ \(y[3]\)[t]\ \(y[4]\)[t]\ \(y[5]\)[t] - 600000\ \(y[3]\)[t]\ \(y[6]\)[t]\ \(y[7]\)[t]\)}]}, { RowBox[{ RowBox[{ SuperscriptBox[\(y[4]\), "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "==", \(\(-1000000\)\ \(y[1]\)[t]\ \(y[3]\)[t]\ \(y[4]\)[t] - 2000\ \(y[4]\)[t]\^2 + 2\ \(y[1]\)[t]\ \(y[3]\)[t]\^2\ \(y[5]\)[t] - 10\ \(y[3]\)[t]\ \(y[4]\)[t]\ \(y[5]\)[t] + 600000\ \(y[3]\)[t]\ \(y[6]\)[t]\ \(y[7]\)[t]\)}]}, { RowBox[{ RowBox[{ SuperscriptBox[\(y[5]\), "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "==", \(2000\ \(y[4]\)[t]\^2 - 2\ \(y[1]\)[t]\ \(y[3]\)[t]\^2\ \(y[5]\)[t] - 10\ \(y[3]\)[t]\ \(y[4]\)[t]\ \(y[5]\)[t]\)}]}, { RowBox[{ RowBox[{ SuperscriptBox[\(y[6]\), "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "==", \(20\ \(y[3]\)[t]\ \(y[4]\)[t]\ \(y[5]\)[t] - 600000\ \(y[3]\)[t]\ \(y[6]\)[t]\ \(y[7]\)[t]\)}]}, { RowBox[{ RowBox[{ SuperscriptBox[\(y[7]\), "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "==", \(\(-600000\)\ \(y[3]\)[t]\ \(y[6]\)[t]\ \(y[7]\)[t] + \(y[8]\)[t]\ \(y[9]\)[t]\)}]}, { RowBox[{ RowBox[{ SuperscriptBox[\(y[8]\), "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "==", \(600000\ \(y[3]\)[t]\ \(y[6]\)[t]\ \(y[7]\)[t] - \(y[8]\)[t]\ \(y[9]\)[t]\)}]}, { RowBox[{ RowBox[{ SuperscriptBox[\(y[9]\), "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "==", \(\(-\(y[8]\)[t]\)\ \(y[9]\)[t]\)}]}, { RowBox[{\(\(y[1]\)[0]\), "==", StyleBox["0.000625`", StyleBoxAutoDelete->True, PrintPrecision->3]}]}, {\(\(y[2]\)[0] == 1\/1000000\)}, {\(\(y[3]\)[0] == 2\)}, {\(\(y[4]\)[0] == 1\/1000000\)}, { RowBox[{\(\(y[5]\)[0]\), "==", StyleBox["0.0625`", StyleBoxAutoDelete->True, PrintPrecision->3]}]}, {\(\(y[6]\)[0] == 1\/1000000\)}, {\(\(y[7]\)[0] == 1\/1000000\)}, { RowBox[{\(\(y[8]\)[0]\), "==", StyleBox["0.002`", StyleBoxAutoDelete->True, PrintPrecision->1]}]}, { RowBox[{\(\(y[9]\)[0]\), "==", StyleBox["0.275`", StyleBoxAutoDelete->True, PrintPrecision->3]}]} }, RowSpacings->1, ColumnSpacings->3, RowAlignments->Baseline, ColumnAlignments->{Left}], TableForm[ { Equal[ Derivative[ 1][ y[ 1]][ t], Plus[ Times[ -8000000000, y[ 1][ t], y[ 2][ t], y[ 3][ t]], Times[ -1000000, y[ 1][ t], y[ 3][ t], y[ 4][ t]], Times[ -2, y[ 1][ t], Power[ y[ 3][ t], 2], y[ 5][ t]], Times[ 0.5, f, y[ 8][ t], y[ 9][ t]]]], Equal[ Derivative[ 1][ y[ 2]][ t], Plus[ Times[ -8000000000, y[ 1][ t], y[ 2][ t], y[ 3][ t]], Times[ 2000000, y[ 1][ t], y[ 3][ t], y[ 4][ t]], Times[ 2000, Power[ y[ 4][ t], 2]], Times[ 2, y[ 1][ t], Power[ y[ 3][ t], 2], y[ 5][ t]]]], Equal[ Derivative[ 1][ y[ 3]][ t], Plus[ Times[ -8000000000, y[ 1][ t], y[ 2][ t], y[ 3][ t]], Times[ -1000000, y[ 1][ t], y[ 3][ t], y[ 4][ t]], Times[ 2000, Power[ y[ 4][ t], 2]], Times[ -4, y[ 1][ t], Power[ y[ 3][ t], 2], y[ 5][ t]], Times[ -10, y[ 3][ t], y[ 4][ t], y[ 5][ t]], Times[ -600000, y[ 3][ t], y[ 6][ t], y[ 7][ t]]]], Equal[ Derivative[ 1][ y[ 4]][ t], Plus[ Times[ -1000000, y[ 1][ t], y[ 3][ t], y[ 4][ t]], Times[ -2000, Power[ y[ 4][ t], 2]], Times[ 2, y[ 1][ t], Power[ y[ 3][ t], 2], y[ 5][ t]], Times[ -10, y[ 3][ t], y[ 4][ t], y[ 5][ t]], Times[ 600000, y[ 3][ t], y[ 6][ t], y[ 7][ t]]]], Equal[ Derivative[ 1][ y[ 5]][ t], Plus[ Times[ 2000, Power[ y[ 4][ t], 2]], Times[ -2, y[ 1][ t], Power[ y[ 3][ t], 2], y[ 5][ t]], Times[ -10, y[ 3][ t], y[ 4][ t], y[ 5][ t]]]], Equal[ Derivative[ 1][ y[ 6]][ t], Plus[ Times[ 20, y[ 3][ t], y[ 4][ t], y[ 5][ t]], Times[ -600000, y[ 3][ t], y[ 6][ t], y[ 7][ t]]]], Equal[ Derivative[ 1][ y[ 7]][ t], Plus[ Times[ -600000, y[ 3][ t], y[ 6][ t], y[ 7][ t]], Times[ y[ 8][ t], y[ 9][ t]]]], Equal[ Derivative[ 1][ y[ 8]][ t], Plus[ Times[ 600000, y[ 3][ t], y[ 6][ t], y[ 7][ t]], Times[ -1, y[ 8][ t], y[ 9][ t]]]], Equal[ Derivative[ 1][ y[ 9]][ t], Times[ -1, y[ 8][ t], y[ 9][ t]]], Equal[ y[ 1][ 0], 0.00062500000000000001], Equal[ y[ 2][ 0], Rational[ 1, 1000000]], Equal[ y[ 3][ 0], 2], Equal[ y[ 4][ 0], Rational[ 1, 1000000]], Equal[ y[ 5][ 0], 0.0625], Equal[ y[ 6][ 0], Rational[ 1, 1000000]], Equal[ y[ 7][ 0], Rational[ 1, 1000000]], Equal[ y[ 8][ 0], 0.002], Equal[ y[ 9][ 0], 0.27500000000000002]}]]], "Output"] }, Open ]] }, Closed]], Cell["\<\ Optional: any manual editing of eqs can now take place \ \>", "Section", InitializationCell->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["\<\ Solving the Kinetic System\ \>", "Subtitle", CellFrame->{{0, 0}, {3, 0}}, InitializationCell->True, TextAlignment->Center], Cell[TextData[{ "N.B. I had some problems early because the bromide concentrations was \ going negative. To fix this problem, I set accuracygoal to infinity, as \ suggested in Mathematica text for solutions going near zero. Depending on \ the particular details of a kinetic system, some of the options (noted in \ blue) may need to be changed in order to get a good numerical solution. The \ user is referred to the ", StyleBox["Mathematica", FontSlant->"Italic"], " reference text.\n\nFor this specific system, there is an adjustable \ parameter, f, in the set of rate equations. We'll set it equal to 2." }], "Text", InitializationCell->True], Cell[BoxData[ RowBox[{ RowBox[{ \(kineticeqs\ = \ eqs\ /. \ specialinstructions\), ";", "\n", "\n", RowBox[{"solution", " ", "=", " ", RowBox[{ "NDSolve", "[", "\n", "\t\t ", RowBox[{ "kineticeqs", " ", ",", "\n", "\t\t ", \(Table[y[i], {i, totalspecies}]\), ",", "\n", "\t\t ", \({t, 0, integrationtime}\), ",", "\n", "\t\t ", StyleBox[\(MaxSteps -> 50000\), FontColor->RGBColor[0, 0, 1]], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox["\n", FontColor->RGBColor[0, 0, 1]], StyleBox["\t ", FontColor->RGBColor[0, 0, 1]], StyleBox[\(AccuracyGoal -> Infinity\), FontColor->RGBColor[0, 0, 1]]}], "]"}]}], ";"}], "\n", "\n"}]], "Input", InitializationCell->True] }, Closed]], Cell[CellGroupData[{ Cell["\<\ Looking at the Kinetic Solutions\ \>", "Subtitle", CellFrame->{{0, 0}, {3, 0}}, TextAlignment->Center], Cell[CellGroupData[{ Cell["Concentration of species at a specific time", "Section"], Cell[CellGroupData[{ Cell[BoxData[ \(Table[\n \t\ \ \ \ \ \ \ \ \ \ \ {i, \n\t\t\ \ \ \ \ \ \ \ \ \ First[\((\(y[i]\)[t]\ /. \ t -> 400\ )\) /. \ solution]}, \n \t\ \ \ \ \ {i, totalspecies}] // TableForm\)], "Input"], Cell[BoxData[ TagBox[GridBox[{ {"1", "2.67198078248313874`*^-7"}, {"2", "5.76004475275753158`*^-8"}, {"3", "1.76662337697442684`"}, {"4", "0.000169475217831801705`"}, {"5", "0.0377204157451839883`"}, {"6", "8.22873039304429809`*^-7"}, {"7", "0.000259353102607635044`"}, {"8", "0.00174164689739237665`"}, {"9", "0.17088467046427338`"} }, RowSpacings->1, ColumnSpacings->3, RowAlignments->Baseline, ColumnAlignments->{Left}], (TableForm[ #]&)]], "Output"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell["Species concentration versus time", "Section"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"axespositions", "=", RowBox[{"{", StyleBox[\(Automatic, Automatic, {0, 1.66}, Automatic, {0, 0.028}, Automatic, Automatic, Automatic, {0, 0.12}\), FontColor->RGBColor[0, 0, 1]], "}"}]}], ";", "\n", "\n", \(Table[\n\t\ \ \ \ \ \ \ \ \((\n\t\ \ \ \ \ \ \ \ \t temp = StringJoin["\<[\>", species[\([i]\)], "\<] (M)\>"]; \ \ \n \t\t\t\ \ \ \ \ \ \ Plot[Evaluate[\(y[i]\)[t]\ /. \ solution], \n \t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {t, 0, integrationtime}, \n\t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ TextStyle -> {FontFamily -> "\", FontSize -> 10}, \n \t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ImageSize -> {72\ 3, 72\ 2}, \n \t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ PlotRegion -> {{0, 1}, {.1, .9}}, \n \t\t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Epilog -> {\n \t\t\t\t\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Text["\