(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.2' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. 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@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[ 40251, 751]*) (*NotebookOutlinePosition[ 40933, 774]*) (* CellTagsIndexPosition[ 40889, 770]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Contributed example", "Title"], Cell[CellGroupData[{ Cell["Introduction", "Subsection"], Cell[TextData[{ "The following example was contributed by ", ButtonBox["Christopher Klausmeier", ButtonData:>{ URL[ "http://www.kbs.msu.edu/Faculty/Klausmeier/Index.htm"], None}, ButtonStyle->"Hyperlink"], " of the Kellogg Biological Station, Michigan State University. Execute the \ entire notebook to view the GUI. " }], "Text"] }, Open ]], Cell[CellGroupData[{ Cell["Code", "Subsection"], Cell[BoxData[ RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"ModelSetupDialog", "[", RowBox[{"modelstructure_", ",", "pre_"}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ "nguilds", ",", "ncomps", ",", "ntraits", ",", "naux", ",", "nguildspre", ",", "ncompspre", ",", "ntraitspre", ",", "nauxpre", ",", "pops", ",", "traits", ",", "auxs", ",", "button", ",", "guildbox", ",", "auxbox", ",", "res"}], "}"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"nguilds", "=", RowBox[{ RowBox[{"Length", "[", "modelstructure", "]"}], "-", "1"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"ncomps", "[", "\[DoubleStruckG]", "]"}], "=", RowBox[{"modelstructure", "[", RowBox[{"[", RowBox[{"\[DoubleStruckG]", ",", "1"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"ntraits", "[", "\[DoubleStruckG]", "]"}], "=", RowBox[{"modelstructure", "[", RowBox[{"[", RowBox[{"\[DoubleStruckG]", ",", "2"}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"\[DoubleStruckG]", ",", "1", ",", "nguilds"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"nguildspre", "=", RowBox[{"Length", "[", RowBox[{"pre", "[", RowBox[{"[", "1", "]"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"naux", "=", RowBox[{"modelstructure", "[", RowBox[{"[", RowBox[{"nguilds", "+", "1"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"ncompspre", "[", "\[DoubleStruckG]", "]"}], "=", RowBox[{"Length", "[", RowBox[{"pre", "[", RowBox[{"[", RowBox[{"1", ",", "\[DoubleStruckG]"}], "]"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"ntraitspre", "[", "\[DoubleStruckG]", "]"}], "=", RowBox[{"Length", "[", RowBox[{"pre", "[", RowBox[{"[", RowBox[{"2", ",", "\[DoubleStruckG]"}], "]"}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"\[DoubleStruckG]", ",", "1", ",", "nguildspre"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"nauxpre", "=", RowBox[{"Length", "[", RowBox[{"pre", "[", RowBox[{"[", "3", "]"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"pops", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"Unique", "[", RowBox[{"{", RowBox[{ "comp", ",", "compmin", ",", "compmax", ",", "compeqn"}], "}"}], "]"}], ",", RowBox[{"{", RowBox[{"\[DoubleStruckC]", ",", "1", ",", RowBox[{ "ncomps", "[", "\[DoubleStruckG]", "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"\[DoubleStruckG]", ",", "1", ",", "nguilds"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"traits", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"Unique", "[", RowBox[{"{", RowBox[{ "trait", ",", "traitmin", ",", "traitmax"}], "}"}], "]"}], ",", RowBox[{"{", RowBox[{"\[DoubleStruckT]", ",", "1", ",", RowBox[{ "ntraits", "[", "\[DoubleStruckG]", "]"}]}], "}"}]}], "]"}], ",", RowBox[{"{", RowBox[{"\[DoubleStruckG]", ",", "1", ",", "nguilds"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"auxs", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"Unique", "[", RowBox[{"{", RowBox[{ "aux", ",", "auxmin", ",", "auxmax", ",", "auxeqn"}], "}"}], "]"}], ",", RowBox[{"{", RowBox[{"\[DoubleStruckA]", ",", "1", ",", "naux"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"guildbox", "[", "\[DoubleStruckG]", "]"}], "=", "\[IndentingNewLine]", RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"SuperWidgetLabelledBox", "[", RowBox[{"Null", ",", RowBox[{"\"\\"", "<>", RowBox[{ "ToString", "[", "\[DoubleStruckG]", "]"}]}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ SubscriptBox["\[Paragraph]", "10"], ",", "\[IndentingNewLine]", RowBox[{ "Table", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{ SubscriptBox["\[Paragraph]", "10"], ",", RowBox[{"\"\\"", "<>", RowBox[{ "ToString", "[", "\[DoubleStruckC]", "]"}], "<>", "\"\<:\>\""}], ",", RowBox[{"SuperWidgetStringBox", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{"pops", "[", RowBox[{"[", RowBox[{ "\[DoubleStruckG]", ",", "\[DoubleStruckC]", ",", "1"}], "]"}], "]"}], "]"}], ",", RowBox[{ "Character\[Breve]Width", "\[Rule]", "5"}]}], "]"}], ",", "\"\<\[Element] [\>\"", ",", RowBox[{"SuperWidgetStringBox", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{"pops", "[", RowBox[{"[", RowBox[{ "\[DoubleStruckG]", ",", "\[DoubleStruckC]", ",", "2"}], "]"}], "]"}], "]"}], ",", RowBox[{ "Character\[Breve]Width", "\[Rule]", "5"}]}], "]"}], ",", "\"\<,\>\"", ",", RowBox[{"SuperWidgetStringBox", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{"pops", "[", RowBox[{"[", RowBox[{ "\[DoubleStruckG]", ",", "\[DoubleStruckC]", ",", "3"}], "]"}], "]"}], "]"}], ",", RowBox[{ "Character\[Breve]Width", "\[Rule]", "5"}]}], "]"}], ",", "\"\<], Equation:\>\"", ",", RowBox[{"SuperWidgetStringBox", "[", RowBox[{"Evaluate", "[", RowBox[{"pops", "[", RowBox[{"[", RowBox[{ "\[DoubleStruckG]", ",", "\[DoubleStruckC]", ",", "4"}], "]"}], "]"}], "]"}], "]"}], ",", SubscriptBox["\[Paragraph]", "10"], ",", RowBox[{"SuperWidgetButton", "[", RowBox[{ "Null", ",", "\"\<-\>\"", ",", RowBox[{ RowBox[{ RowBox[{"-", "\[DoubleStruckG]"}], "*", "1000"}], "-", "\[DoubleStruckC]"}], ",", RowBox[{ "Tool\[Breve]Tip", "\[Rule]", "\"\\""}]}], "]"}], ",", SubscriptBox["\[Paragraph]", "0"]}], "}"}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{ "\[DoubleStruckC]", ",", "1", ",", RowBox[{ "ncomps", "[", "\[DoubleStruckG]", "]"}]}], "}"}]}], "]"}], "\[IndentingNewLine]", ",", SubscriptBox["\[Paragraph]", "10"]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ SubscriptBox["\[Paragraph]", "10"], ",", RowBox[{"SuperWidgetButton", "[", RowBox[{"Null", ",", "\"\<+\>\"", ",", RowBox[{ "\[DoubleStruckG]", "+", "1000"}], ",", RowBox[{ "Tool\[Breve]Tip", "\[Rule]", RowBox[{ "\"\\"", "<>", RowBox[{ "ToString", "[", "\[DoubleStruckG]", "]"}]}]}]}], "]"}], ",", SubscriptBox["\[Paragraph]", "0"]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ SubscriptBox["\[Paragraph]", "10"], ",", "\[IndentingNewLine]", RowBox[{ "Table", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{ SubscriptBox["\[Paragraph]", "10"], ",", RowBox[{"\"\\"", "<>", RowBox[{ "ToString", "[", "\[DoubleStruckT]", "]"}], "<>", "\"\<:\>\""}], ",", RowBox[{"SuperWidgetStringBox", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{"traits", "[", RowBox[{"[", RowBox[{ "\[DoubleStruckG]", ",", "\[DoubleStruckT]", ",", "1"}], "]"}], "]"}], "]"}], ",", RowBox[{ "Character\[Breve]Width", "\[Rule]", "5"}]}], "]"}], ",", "\"\<\[Element] [\>\"", ",", RowBox[{"SuperWidgetStringBox", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{"traits", "[", RowBox[{"[", RowBox[{ "\[DoubleStruckG]", ",", "\[DoubleStruckT]", ",", "2"}], "]"}], "]"}], "]"}], ",", RowBox[{ "Character\[Breve]Width", "\[Rule]", "5"}]}], "]"}], ",", "\"\<,\>\"", ",", RowBox[{"SuperWidgetStringBox", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{"traits", "[", RowBox[{"[", RowBox[{ "\[DoubleStruckG]", ",", "\[DoubleStruckT]", ",", "3"}], "]"}], "]"}], "]"}], ",", RowBox[{ "Character\[Breve]Width", "\[Rule]", "5"}]}], "]"}], ",", "\"\<]\>\"", ",", SubscriptBox["\[Paragraph]", "10"], ",", RowBox[{"SuperWidgetButton", "[", RowBox[{ "Null", ",", "\"\<-\>\"", ",", RowBox[{ RowBox[{ RowBox[{"-", "\[DoubleStruckG]"}], "*", "1000"}], "-", "\[DoubleStruckT]", "-", "1000000"}], ",", RowBox[{ "Tool\[Breve]Tip", "\[Rule]", "\"\\""}]}], "]"}], ",", SubscriptBox["\[Paragraph]", "0"]}], "}"}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{ "\[DoubleStruckT]", ",", "1", ",", RowBox[{ "ntraits", "[", "\[DoubleStruckG]", "]"}]}], "}"}]}], "]"}], "\[IndentingNewLine]", ",", SubscriptBox["\[Paragraph]", "10"]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ SubscriptBox["\[Paragraph]", "10"], ",", RowBox[{"SuperWidgetButton", "[", RowBox[{"Null", ",", "\"\<+\>\"", ",", RowBox[{ "\[DoubleStruckG]", "+", "2000"}], ",", RowBox[{ "Tool\[Breve]Tip", "\[Rule]", RowBox[{ "\"\\"", "<>", RowBox[{ "ToString", "[", "\[DoubleStruckG]", "]"}]}]}]}], "]"}], ",", SubscriptBox["\[Paragraph]", "0"]}], "}"}]}], "\[IndentingNewLine]", "}"}]}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"SuperWidgetButton", "[", RowBox[{"Null", ",", "\"\<-\>\"", ",", RowBox[{"-", "\[DoubleStruckG]"}], ",", RowBox[{"Tool\[Breve]Tip", "\[Rule]", RowBox[{"\"\\"", "<>", RowBox[{ "ToString", "[", "\[DoubleStruckG]", "]"}]}]}]}], "]"}], ",", SubscriptBox["\[Paragraph]", "10"]}], "}"}]}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"\[DoubleStruckG]", ",", "1", ",", "nguilds"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"auxbox", "=", RowBox[{"SuperWidgetLabelledBox", "[", RowBox[{ "Null", ",", "\"\\"", ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ SubscriptBox["\[Paragraph]", "10"], ",", "\[IndentingNewLine]", RowBox[{"Table", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{ SubscriptBox["\[Paragraph]", "10"], ",", RowBox[{"\"\\"", "<>", RowBox[{ "ToString", "[", "\[DoubleStruckA]", "]"}], "<>", "\"\<:\>\""}], ",", RowBox[{"SuperWidgetStringBox", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{"auxs", "[", RowBox[{"[", RowBox[{ "\[DoubleStruckA]", ",", "1"}], "]"}], "]"}], "]"}], ",", RowBox[{ "Character\[Breve]Width", "\[Rule]", "5"}]}], "]"}], ",", "\"\<\[Element] [\>\"", ",", RowBox[{"SuperWidgetStringBox", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{"auxs", "[", RowBox[{"[", RowBox[{ "\[DoubleStruckA]", ",", "2"}], "]"}], "]"}], "]"}], ",", RowBox[{ "Character\[Breve]Width", "\[Rule]", "5"}]}], "]"}], ",", "\"\<,\>\"", ",", RowBox[{"SuperWidgetStringBox", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{"auxs", "[", RowBox[{"[", RowBox[{ "\[DoubleStruckA]", ",", "3"}], "]"}], "]"}], "]"}], ",", RowBox[{ "Character\[Breve]Width", "\[Rule]", "5"}]}], "]"}], ",", "\"\<], Equation:\>\"", ",", RowBox[{"SuperWidgetStringBox", "[", RowBox[{"Evaluate", "[", RowBox[{"auxs", "[", RowBox[{"[", RowBox[{ "\[DoubleStruckA]", ",", "4"}], "]"}], "]"}], "]"}], "]"}], ",", SubscriptBox["\[Paragraph]", "10"], ",", RowBox[{"SuperWidgetButton", "[", RowBox[{"Null", ",", "\"\<-\>\"", ",", RowBox[{ RowBox[{"-", "2000000"}], "-", "\[DoubleStruckA]"}], ",", RowBox[{ "Tool\[Breve]Tip", "\[Rule]", RowBox[{ "\"\\"", "<>", RowBox[{ "ToString", "[", "\[DoubleStruckA]", "]"}]}]}]}], "]"}], ",", SubscriptBox["\[Paragraph]", "0"]}], "}"}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{ "\[DoubleStruckA]", ",", "1", ",", "naux"}], "}"}]}], "]"}], "\[IndentingNewLine]", ",", SubscriptBox["\[Paragraph]", "10"]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ SubscriptBox["\[Paragraph]", "10"], ",", RowBox[{"SuperWidgetButton", "[", RowBox[{ "Null", ",", "\"\<+\>\"", ",", "3", ",", RowBox[{ "Tool\[Breve]Tip", "\[Rule]", "\"\\""}]}], "]"}], ",", SubscriptBox["\[Paragraph]", "0"]}], "}"}]}], "\[IndentingNewLine]", "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"Evaluate", "[", RowBox[{"pops", "[", RowBox[{"[", RowBox[{ "\[DoubleStruckG]", ",", "\[DoubleStruckC]"}], "]"}], "]"}], "]"}], "=", RowBox[{"pre", "[", RowBox[{"[", RowBox[{ "1", ",", "\[DoubleStruckG]", ",", "\[DoubleStruckC]"}], "]"}], "]"}]}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"\[DoubleStruckC]", ",", "1", ",", RowBox[{ "ncompspre", "[", "\[DoubleStruckG]", "]"}]}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"Evaluate", "[", RowBox[{"traits", "[", RowBox[{"[", RowBox[{ "\[DoubleStruckG]", ",", "\[DoubleStruckT]"}], "]"}], "]"}], "]"}], "=", RowBox[{"pre", "[", RowBox[{"[", RowBox[{ "2", ",", "\[DoubleStruckG]", ",", "\[DoubleStruckT]"}], "]"}], "]"}]}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"\[DoubleStruckT]", ",", "1", ",", RowBox[{ "ntraitspre", "[", "\[DoubleStruckG]", "]"}]}], "}"}]}], "]"}], ";"}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"\[DoubleStruckG]", ",", "1", ",", "nguildspre"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Do", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"Evaluate", "[", RowBox[{"auxs", "[", RowBox[{"[", "\[DoubleStruckA]", "]"}], "]"}], "]"}], "=", RowBox[{"pre", "[", RowBox[{"[", RowBox[{"3", ",", "\[DoubleStruckA]"}], "]"}], "]"}]}], "\[IndentingNewLine]", ",", RowBox[{"{", RowBox[{"\[DoubleStruckA]", ",", "1", ",", "nauxpre"}], "}"}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"button", "=", RowBox[{"SuperGUIRunModal", "[", RowBox[{"SuperWidgetFrame", "[", RowBox[{"frame", ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ SubscriptBox["\[Paragraph]", "10"], ",", RowBox[{"Table", "[", RowBox[{ RowBox[{ "guildbox", "[", "\[DoubleStruckG]", "]"}], ",", RowBox[{"{", RowBox[{ "\[DoubleStruckG]", ",", "1", ",", "nguilds"}], "}"}]}], "]"}], ",", SubscriptBox["\[Paragraph]", "10"]}], "}"}], ",", RowBox[{"{", RowBox[{ SubscriptBox["\[Paragraph]", "10"], ",", RowBox[{"SuperWidgetButton", "[", RowBox[{ "Null", ",", "\"\<+\>\"", ",", "2", ",", RowBox[{ "Tool\[Breve]Tip", "\[Rule]", "\"\\""}]}], "]"}], ",", SubscriptBox["\[Paragraph]", "0"]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ SubscriptBox["\[Paragraph]", "10"], ",", "auxbox", ",", SubscriptBox["\[Paragraph]", "10"]}], "}"}], ",", SubscriptBox["\[Paragraph]", "10"], ",", RowBox[{"{", RowBox[{ SubscriptBox["\[Paragraph]", "0"], ",", RowBox[{"SuperWidgetButton", "[", RowBox[{ "Null", ",", "\"\\"", ",", "0"}], "]"}], ",", SubscriptBox["\[Paragraph]", "10"], ",", RowBox[{"SuperWidgetButton", "[", RowBox[{"Null", ",", "\"\\"", ",", "1"}], "]"}], ",", SubscriptBox["\[Paragraph]", "10"]}], "}"}], ",", SubscriptBox["\[Paragraph]", "10"]}], "}"}], ",", RowBox[{"Title", "\[Rule]", "\"\\""}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"res", "=", RowBox[{"{", RowBox[{"pops", ",", "traits", ",", "auxs"}], "}"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Return", "[", RowBox[{"{", RowBox[{"button", ",", "res"}], "}"}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}]}], ";"}]], "Input", CellDingbat->None], Cell[BoxData[ \(\(ModelSetup := Module[{res, nguilds, ncomps, ntraits, naux, done, tmp, \[DoubleStruckG]x, \[DoubleStruckC]x, \[DoubleStruckA]x, \ \[DoubleStruckT]x}, \[IndentingNewLine]Block[{nsp}, \[IndentingNewLine]\ \[IndentingNewLine]res = {{{{"\", "\<0\>", "\<1\>", "\"}}}, \ {{{"\", "\<-1\>", "\<1\>"}}}, {{"\", "\<0\>", "\<1\>", "\"}}}; \ \[IndentingNewLine]\[IndentingNewLine]nguilds = 1; \[IndentingNewLine]ncomps[1] = 1; \[IndentingNewLine]ntraits[1] = 1; \[IndentingNewLine]naux = 1; \[IndentingNewLine]\[IndentingNewLine]done = False; \[IndentingNewLine]\[IndentingNewLine]While[\(! done\), \ \[IndentingNewLine]\[IndentingNewLine]tmp = ModelSetupDialog[{Sequence @@ Table[{ncomps[\[DoubleStruckG]], ntraits[\[DoubleStruckG]]}, {\[DoubleStruckG], 1, nguilds}], naux}, res]; \[IndentingNewLine]\[IndentingNewLine]If[ tmp[\([1]\)] \[Equal] 0, done = True]; \ (*\ cancel\ *) \[IndentingNewLine]If[tmp[\([1]\)] \[Equal] 1, done = True]; \ (*\ OK\ *) \[IndentingNewLine]\[IndentingNewLine] (*\ add\ guild\ *) \[IndentingNewLine]If[ tmp[\([1]\)] \[Equal] 2, \[IndentingNewLine]nguilds = nguilds + 1; \[IndentingNewLine]ncomps[nguilds] = 1; \[IndentingNewLine]ntraits[nguilds] = 1;\[IndentingNewLine]]; \[IndentingNewLine]\ \[IndentingNewLine] (*\ add\ aux\ *) \[IndentingNewLine]If[ tmp[\([1]\)] \[Equal] 3, \[IndentingNewLine]\(naux = naux + 1;\)\[IndentingNewLine]]; \[IndentingNewLine]\ \[IndentingNewLine] (*\ add\ component\ *) \[IndentingNewLine]If[ 1000 < tmp[\([1]\)] < 1999, \[IndentingNewLine]\(ncomps[tmp[\([1]\)] - 1000] = ncomps[tmp[\([1]\)] - 1000] + 1;\)\[IndentingNewLine]]; \[IndentingNewLine]\ \[IndentingNewLine] (*\ add\ trait\ *) \[IndentingNewLine]If[ 2000 < tmp[\([1]\)] < 2999, \[IndentingNewLine]\(ntraits[tmp[\([1]\)] - 2000] = ntraits[tmp[\([1]\)] - 2000] + 1;\)\[IndentingNewLine]]; \[IndentingNewLine]\ \[IndentingNewLine] (*\ delete\ aux\ var\ *) \[IndentingNewLine]If[ tmp[\([1]\)] < \(-2000000\), \[IndentingNewLine]\ \[DoubleStruckA]x = \(-\((tmp[\([1]\)] + 2000000)\)\); \[IndentingNewLine]tmp = Delete[tmp, {2, 3, \[DoubleStruckA]x}]; \[IndentingNewLine]naux = naux - 1;\[IndentingNewLine]]; \[IndentingNewLine]\ \[IndentingNewLine] (*\ delete\ guild\ *) \[IndentingNewLine]If[ 0 > tmp[\([1]\)] > \(-999\), \[IndentingNewLine]\ \[DoubleStruckG]x = \(-tmp[\([1]\)]\); \[IndentingNewLine]tmp = Delete[tmp, {{2, 1, \[DoubleStruckG]x}, {2, 2, \[DoubleStruckG]x}}]; \[IndentingNewLine]nguilds = nguilds - 1;\[IndentingNewLine]]; \[IndentingNewLine]\ \[IndentingNewLine] (*\ delete\ component\ *) \[IndentingNewLine]If[\(-1000\) > tmp[\([1]\)] > \(-999999\), \[IndentingNewLine]\ \[DoubleStruckG]x = Quotient[\(-tmp[\([1]\)]\), 1000]; \[IndentingNewLine]\[DoubleStruckC]x = Mod[\(-tmp[\([1]\)]\), 1000]; \[IndentingNewLine]tmp = Delete[tmp, {2, 1, \[DoubleStruckG]x, \[DoubleStruckC]x}]; \ \[IndentingNewLine]ncomps[\[DoubleStruckG]x] = ncomps[\[DoubleStruckG]x] - 1;\[IndentingNewLine]]; \[IndentingNewLine]\ \[IndentingNewLine] (*\ delete\ trait\ *) \[IndentingNewLine]If[\(-1000000\) > tmp[\([1]\)], \[IndentingNewLine]\[DoubleStruckG]x = Quotient[\(-\((tmp[\([1]\)] + 1000000)\)\), 1000]; \[IndentingNewLine]\[DoubleStruckT]x = Mod[\(-\((tmp[\([1]\)] + 1000000)\)\), 1000]; \[IndentingNewLine]tmp = Delete[tmp, {2, 2, \[DoubleStruckG]x, \[DoubleStruckT]x}]; \ \[IndentingNewLine]ntraits[\[DoubleStruckG]x] = ntraits[\[DoubleStruckG]x] - 1;\[IndentingNewLine]]; \[IndentingNewLine]\ \[IndentingNewLine]res = tmp[\([2]\)];\[IndentingNewLine]]; \[IndentingNewLine]\ \[IndentingNewLine]If[tmp[\([1]\)] \[Equal] 0, res = {}]; \ (*\ cancel\ *) \[IndentingNewLine]\[IndentingNewLine]Return[ ToExpression[ res]];\[IndentingNewLine]\[IndentingNewLine]]];\)\)], "Input",\ CellDingbat->None], Cell[BoxData[ \(ModelSetup\)], "Input"] }, Open ]] }, Open ]] }, FrontEndVersion->"5.2 for Microsoft Windows", ScreenRectangle->{{0, 1280}, {0, 967}}, WindowSize->{1108, 586}, WindowMargins->{{4, Automatic}, {Automatic, 4}}, StyleDefinitions -> "HelpBrowser.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->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1776, 53, 36, 0, 155, "Title"], Cell[CellGroupData[{ Cell[1837, 57, 34, 0, 58, "Subsection"], Cell[1874, 59, 350, 8, 56, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[2261, 72, 26, 0, 58, "Subsection"], Cell[2290, 74, 87, 1, 40, "Input"], Cell[2380, 77, 32833, 579, 2458, "Input"], Cell[35216, 658, 4961, 86, 2094, "Input"], Cell[40180, 746, 43, 1, 40, "Input"] }, Open ]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)