(************** Content-type: application/mathematica ************** 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[ 22946, 781]*) (*NotebookOutlinePosition[ 37233, 1106]*) (* CellTagsIndexPosition[ 35939, 1059]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{Cell[TextData[{ "Introduction to Programming with ", StyleBox["Mathematica", FontSlant->"Italic"] }], "Title", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ By Richard J. Gaylord (gaylord@ux1.cso.uiuc.edu) Samuel N. Kamin (kamin@cs.uiuc.edu) Paul R. Wellin (wellin@sonoma.edu)\ \>", "Subsubtitle", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Copyright \[Copyright] 1993 by TELOS/Springer-Verlag\ \>", "Subsubtitle", ImageRegion->{{0, 1}, {0, 1}}, FontSlant->"Plain"], Cell[CellGroupData[{Cell["Chapter 7 \[Dash] Recursion", "Subtitle", ImageRegion->{{0, 1}, {0, 1}}], Cell["(Mathematica code)", "Subsubtitle", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Functions defined in this Notebook", "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ F (Fibonacci function)...129-131 sumElts...132 addPairs...131 multPairwise...133 deal...133 carddeck...133 doubleUptoZero...135 runEncode...135-138 maxima...137,139 interleave2...137 ddx (symbolic derivatives)...141-144 solve...147 elimx1...147 subtractE1...147 encodeString...157,161 decode...158 printTree...152,154 printIndented...152 zip...154 extend...154 drawTree... drawSepTree...251 placeTree...250 TR...250 TR1...250 width...250 drawTree1... drawTree2... drawSepTree2... settext... drawBox... revtree... transGraphic... enlargeDisk... fruitTree graphic... World tree graphic...154 huffmanTree... 156 huffman2...157 FF (Fibonacci function)...162 map...164,166 nest...165 repeat...165\ \>", "Text", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Initialization (evaluate to turn off spell messages)", "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell["Off[General::spell]", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["Off[General::spell1]", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Section 7.1 Fibonacci numbers", "Section", ImageRegion->{{0, 1}, {0, 1}}, CellTags->"F (Fibonacci function)"], Cell["Clear[F,n]", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ F[0] := 0 F[1] := 1 F[n_] := F[n-2] + F[n-1] /; n > 1\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["Table[F[i], {i,0,10}]", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Section 7.2 List Functions", "Section", ImageRegion->{{0, 1}, {0, 1}}, CellTags->{"sumElts", "addPairs", "multPairwise", "deal", "carddeck"}], Cell[CellGroupData[{Cell["sumElts (3 versions)", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["sumElts[lis_] := Apply[Plus, lis]", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["sumElts[lis_] := Fold[Plus, 0, lis]", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ sumElts[{}] := 0 sumElts[{x_, r___}] := x + sumElts[{r}]\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["addPairs", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ addPairs[{}, {}] := {} addPairs[{x1_, r1___}, {x2_, r2___}] := Join[{x1+x2}, addPairs[{r1}, {r2}]]\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["addPairs[{1, 2, 3}, {4, 5, 6}]", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["multPairwise", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ multPairwise[{}] := {} multPairwise[{x_, y_, r___}] := \t\tJoin[{x y}, multPairwise[{r}]]\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["multPairwise[{3, 9, 17, 2, 6, 60}]", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["deal", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["Clear[c,d,h,s,J,Q,K,A]", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ carddeck = Flatten[Outer[List, {c, d, h, s}, \t\tJoin[Range[2, 10], {J, Q, K, A}]], 1];\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["deal[0] := {}", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ deal[n_] := Module[{dealt = deal[n-1]}, Append[dealt, Complement[carddeck,dealt][[Random[Integer, {1, 53-n}]]]]]\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["deal[5]", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]]}, Open]], Cell[CellGroupData[{Cell["Section 7.3 Thinking Recursively", "Section", ImageRegion->{{0, 1}, {0, 1}}, CellTags->{"doubleUptoZero", "runEncode", "maxima", "interleave2"}], Cell[CellGroupData[{Cell["doubleUptoZero", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ doubleUptoZero[{}] := {} doubleUptoZero[{0, y___}] := {0, y} doubleUptoZero[{x_, y___}] := \t\tJoin[{2x}, doubleUptoZero[{y}]]\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["doubleUptoZero[{2, 3, 0, 4, 5}]", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["doubleUptoZero[{2, 3, 4, 5}]", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["runEncode", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Version 1", "Subsubsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ runEncode[{}] := {} runEncode[{x_}] := {{x, 1}} runEncode[{x_, r___}] := Module[{R = runEncode[{r}]}, (* R = \ {{y, k},...} *) Module[{p = First[R], rst = Rest[R]}, (* p = {y, k} \ *) If[x == First[p], (* \ First[p] = y *) Join[{{x, p[[2]]+1}}, rst], (* p[[2]] = k \ *) Join[{{x, 1}}, R]]]]\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["runEncode[{9, 9, 9, 9, 9, 4, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5}]", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Version 2", "Subsubsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ runEncode[{}] := {} runEncode[{x_}] := {{x, 1}} runEncode[{x_, r__}] := runEncode[{r}] /. {{y_, k_}, s___} -> If[x==y, {{x, k+1}, s}, {{x, 1}, {y, k}, s}]\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["runEncode[{9, 9, 9, 9, 9, 4, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5}]", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Version 3 (Frank Zizza)", "Subsubsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ runEncode[L_] := \tMap[({#, 1})&, L] //. \t\t{x___, {y_, i_}, {y_, j_}, z___} -> {x, {y, i+j}, z}\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["runEncode[{9, 9, 9, 9, 9, 4, 3, 3, 3, 3, 5, 5, 5, 5, 5, 5}]", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]]}, Open]], Cell[CellGroupData[{Cell["maxima", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ maxima[{}] := {} maxima[{x_, r___}] := \tJoin[{x}, Select[maxima[{r}], (#>x)&]]\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["maxima[{9, 2, 10, 3, 14, 9}]", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["interleave2", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["Clear[a,b,c,d,e,f]", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ interleave2[{}, M_] := M interleave2[L_, {}] := L interleave2[{x_, r___}, {y_, s___}] := \tJoin[{x, y}, interleave2[{r}, {s}]]\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["interleave2[{a, b, c}, {1, 2, 3, 4, 5}]", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["interleave2[{a, b, c, d, e, f}, {1, 2, 3}]", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]]}, Open]], Cell[CellGroupData[{Cell["Section 7.4 Recursion and Symbolic Computations", "Section", ImageRegion->{{0, 1}, {0, 1}}, CellTags->"ddx (symbolic derivatives)"], Cell["Clear[x,ddx]", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ ddx[c_?NumberQ] := 0 ddx[x] := 1 ddx[u_ + v_] := ddx[u] + ddx[v] ddx[u_ - v_] := ddx[u] - ddx[v] ddx[u_ v_] := u ddx[v] + v ddx[u] ddx[u_ / v_] := (v ddx[u] - u ddx[v]) / v^2 ddx[u_ ^ c_?NumberQ] := c u^(c-1) ddx[u]\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ ddx[5 x^3 - 2x^2 + 3/x]\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["ddx[x^3 (x^2+4)^2]", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Section 7.5 Gaussian Elimination", "Section", ImageRegion->{{0, 1}, {0, 1}}, CellTags->{"solve", "elimx1", "subtractE1"}], Cell["m = N[Table[1/(i+j-1), {i, 15}, {j, 15}]];", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["b = Table[Random[], {15}];", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["xs = LinearSolve[m, b]", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["m.xs - b", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ solve[S_] := Module[{E1 = First[S], x2toxn = solve[elimx1[S]]}, Module[{b1 = Last[E1], a11 = First[E1], a12toa1n = Drop[Rest[E1], -1]}, Join[{(b1 - a12toa1n . x2toxn) / a11}, x2toxn]]]\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["solve[{{a11_, b1_}}] := {b1/a11}", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ elimx1[S_] := Map[subtractE1[S[[1]], #]&, Rest[S]] subtractE1[E1_, Ei_] := Module[{z = Ei[[1]]/E1[[1]]}, Module[{newE1 = z * Rest[E1]}, Rest[Ei] - newE1]]\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["solve[{{1, 2, 3}, {4, 5, 6}}]", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Section 7.6 Binary Trees", "Section", ImageRegion->{{0, 1}, {0, 1}}, CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}], Cell[CellGroupData[{Cell["encodeString", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Htree = {\" ABEHONST\", {\" AT\", {\" \"}, {\"AT\", {\"T\"}, {\"A\"}}}, {\"BEHONS\", {\"EON\", {\"E\"}, {\"ON\", {\"O\"}, {\"N\"}}}, {\"BHS\", {\"BH\", {\"H\"}, {\"B\"}}, {\"S\"}}}};\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["stringMemberQ[str_, ch_] := StringPosition[str, ch] != {}", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ encodeChar[c_, {_, lc_, rc_}] := If[stringMemberQ[First[lc], c], (* if c in left subtree *) Join[{0}, encodeChar[c, lc]], (* prepend 0 *) Join[{1}, encodeChar[c, rc]]] (* otherwise prepend 1 *)\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["encodeChar[_, {_}] := {}", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["encodeChar[c_] := encodeChar[c, Htree]", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ encodeString[str_] := Flatten[Map[encodeChar, Characters[str]]]\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["encodeString[\"HONEST ABE\"]", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["decode", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ decode[code_, {ch_}] := (* leaf node - label is character *) StringJoin[ch, decode[code, Htree]] decode[{0, r___}, {_, lc_, _}] := decode[{r}, lc] decode[{1, r___}, {_, _, rc_}] := decode[{r}, rc] decode[{}, _] := \"\"\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["decode[code_] := decode[code, Htree]", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Code for trees", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ printTree[t_] := printTree[t, 0] printTree[{lab_}, k_] := (printIndented[lab, 3k]; Null) printTree[{lab_, lc_, rc_}, k_] := (printIndented[lab, 3k]; Map[(printTree[#, k+1])&, {lc, rc}];) printIndented[x_, spaces_] := Print[Apply[StringJoin, Table[\" \", {spaces}]], x] zip[{}, _] := {} zip[_, {}] := {} zip[{x1_, y1___}, {x2_, y2___}] := Join[{{x1, x2}}, zip[{y1}, {y2}]] extend[edges1_, edges2_, sep_] := Join[edges1+sep, Take[edges2, Min[0, Length[edges1]-Length[edges2]]] - sep] drawTree[t_] := drawSepTree[TR[t][[1]], 0, 0] drawSepTree[{}, lev_, xaxis_] := {Disk[{xaxis, lev}, 0.2]} drawSepTree[{sep_, lc_, rc_}, lev_, xaxis_] := Join[{Disk[{xaxis, lev}, 0.2], Line[{{xaxis,lev}, {xaxis-sep, lev-1}}], Line[{{xaxis,lev}, {xaxis+sep, lev-1}}]}, drawSepTree[lc, lev-1, xaxis-sep], drawSepTree[rc, lev-1, xaxis+sep]] placeTree[{_}] := {{}, 0, 0} placeTree[{_, lc_, rc_}] := With[{left = placeTree[lc], right = placeTree[rc], minsep = 1.0}, With[{sep = left[[3]] + right[[2]] + minsep}, {{sep, left[[1]], right[[1]]}, left[[2]]+sep/2, right[[3]]+sep/2}]] TR[{_}] := {{}, {}, {}} TR[{_, lc_, rc_}] := With[{left = TR[lc], right = TR[rc], minsep = 2.0}, With[{sep = (Max[0, Apply[Max, Map[Apply[Plus, #]&, zip[left[[3]], right[[2]]]]]] + minsep) / 2}, With[{newtree = {sep, left[[1]], right[[1]]}, leftedge = Join[{sep}, extend[left[[2]], right[[2]], sep]], rightedge = Join[{sep}, extend[right[[3]], left[[3]], sep]]}, {newtree, leftedge, rightedge}]]] TR1[{x_}] := {{}, {width[x]/2}, {width[x]/2}} TR1[{x_, lc_, rc_}] := With[{left = TR1[lc], right = TR1[rc], minsep = 0.5}, With[{sep = (Max[0, Apply[Max, Map[Apply[Plus, #]&, zip[left[[3]], right[[2]]]]]] + minsep) / 2}, With[{newtree = {sep, left[[1]], right[[1]]}, leftedge = Join[{width[x]/2}, extend[left[[2]], right[[2]], sep]], rightedge = Join[{width[x]/2}, extend[right[[3]], left[[3]], sep]]}, {newtree, leftedge, rightedge}]]] width[t_] := 0 drawTree1[t_] := drawSepTree1[t, TR1[t][[1]], 0, 0] drawTree2[t_] := drawSepTree2[t, TR1[t][[1]], 0, 0] drawSepTree1[{lab_}, {}, lev_, xaxis_] := {Text[settext[lab], {xaxis, lev}]} (* should be: drawBox[width[lab], lev, xaxis] *) drawSepTree1[{lab_, lc_, rc_}, {sep_, ls_, rs_}, lev_, xaxis_] := With[{h1 = If[lab == \"\", 0, .3], h2 = If[lc[[1]] == \"\", 0, .3], h3 = If[rc[[1]] == \"\", 0, .3]}, Join[{Text[settext[lab], {xaxis, lev}], Line[{{xaxis-sep*(h1/2), lev-h1/2}, {xaxis-sep+sep*(h2/2), lev-1+h2/2}}], Line[{{xaxis+sep*(h1/2), lev-h1/2}, {xaxis+sep-sep*(h3/2), lev-1+h3/2}}]}, drawSepTree1[lc, ls, lev-1, xaxis-sep], drawSepTree1[rc, rs, lev-1, xaxis+sep]]] drawSepTree2[{lab_}, {}, lev_, xaxis_] := {Text[settext[lab], {xaxis, lev}]} drawSepTree2[{lab_, lc_, rc_}, {sep_, ls_, rs_}, lev_, xaxis_] := With[{h1 = If[lab == \"\", 0, .5], h2 = If[lc[[1]] == \"\", 0, .5], h3 = If[rc[[1]] == \"\", 0, .5]}, Join[{Text[settext[lab], {xaxis, lev}], Line[{{xaxis-sep*(h1/2), lev-h1/2}, {xaxis-sep+sep*(h2/2), lev-1+h2/2}}], Line[{{xaxis+sep*(h1/2), lev-h1/2}, {xaxis+sep-sep*(h3/2), lev-1+h3/2}}]}, drawSepTree2[lc, ls, lev-1, xaxis-sep], drawSepTree2[rc, rs, lev-1, xaxis+sep]]] (* should be: drawBox[width[lab], lev, xaxis], *) settext[lab_] := FontForm[lab, {\"Times-Roman\", 10}] drawBox[w_, y_, x_] := (* open rectangle of height ?, width w, centered at (x, y) *) With[{height = .3}, {Line[{{x-w/2, y-height/2}, {x-w/2, y+height/2}}], Line[{{x-w/2, y+height/2}, {x+w/2, y+height/2}}], Line[{{x+w/2, y+height/2}, {x+w/2, y-height/2}}], Line[{{x+w/2, y-height/2}, {x-w/2, y-height/2}}]}] revtree[{x_}] := {x} revtree[{x_, t1_, t2_}] := {x, revtree[t2], revtree[t1]} Clear[transGraphic] transGraphic[Line[x_], o_] := Line[transGraphic[x, o]] transGraphic[Disk[x_, w_], o_] := Disk[transGraphic[x, o], w] transGraphic[Text[t_, x_], o_] := Text[t, transGraphic[x, o]] transGraphic[{i_, j_}, o_] := {i+o, j} /; NumberQ[i] transGraphic[{p1__}, o_] := Map[transGraphic[#, o]&, {p1}] transGraphic[{any_}, o_] := {transGraphic[any, o]} enlargeDisk[Disk[x_, w_], f_] := Disk[x, w*f] enlargeDisk[x_, f_] := x\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["f[x, y + 1] tree (p. 150)", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ t1 = {\"f\", {\"x\"}, {\"+\", {\"y\"}, {\"1\"}}}; figtree1 = drawTree1[t1];\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["Show[Graphics[figtree1, PlotRange->{-2.1, .1}]];", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Fruit tree (p. 151)", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ t2 = {\"fig\", {\"date\", {\"kumquat\"}, {\"papaya\"}}, {\"mango\"}}; fruitTree = drawTree1[t2]; Show[Graphics[fruitTree, \tPlotRange->{{-.6, .32},{-2.13, .14}}]];\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["World tree (p. 154)", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ worldTree = {Text[\"World\", {1.5, 2}], Text[\"Asia\", {0, 1}], Text[\"Europe\", {1, 1}], Text[\"America\", {2, 1}], Text[\"Africa\", {3, 1}], Text[\"North\", {1.5, 0}], Text[\"South\", {2.5, 0}], Line[{{1.5, 1.8}, {0, 1.2}}], Line[{{1.5, 1.8}, {1, 1.2}}], Line[{{1.5, 1.8}, {2, 1.2}}], Line[{{1.5, 1.8}, {3, 1.2}}], Line[{{2, .8}, {1.5, .2}}], Line[{{2, .8}, {2.5, .2}}] };\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Show[Graphics[worldTree, \t\tPlotRange->{{-.12, 3.2},{-.07,2.1}}]];\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Huffman encoding tree (p. 156)", "Subsection", ImageRegion->{{0, 1}, {0, 1}}, CellTags->"huffmanTree"], Cell["\<\ t3 = {\"\", {\"\", {\"b\"}, {\"\", {\"T\"}, {\"A\"}}}, {\"\", {\"\", {\"E\"}, {\"\", {\"O\"}, {\"N\"}}}, {\"\", {\"\", {\"H\"}, {\"B\"}}, {\"S\"}}}};\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}, CellTags->"huffmanTree"], Cell["\<\ huffmanTree = drawTree2[t3]; Show[Graphics[huffmanTree, PlotRange->{-4.2, .1}]];\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}, CellTags->"huffmanTree"]}, Open]], Cell[CellGroupData[{Cell["Huffman tree with interior labels (p. 157)", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ t4 = {\"bABEHONST\", {\"bAT\", {\"b\"}, {\"AT\", {\"T\"}, {\"A\"}}}, {\"BEHONS\", {\"EON\", {\"E\"}, {\"ON\", {\"O\"}, {\"N\"}}}, {\"BHS\", {\"BH\", {\"H\"}, {\"B\"}}, {\"S\"}}}}; huffmanTree2 = drawTree2[t4];\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["Show[Graphics[huffmanTree2, PlotRange->{-4.2,.1}]];", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]]}, Open]], Cell[CellGroupData[{Cell["Section 7.7 Dynamic Programming", "Section", ImageRegion->{{0, 1}, {0, 1}}, CellTags->"FF (Fibonacci function)"], Cell[CellGroupData[{Cell["Fibonacci numbers", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ FF[0] := 0 FF[1] := 1 FF[n_] := (FF[n] = FF[n-2] + FF[n-1])\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["Table[FF[j], {j, 1, 10}]", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]]}, Open]], Cell[CellGroupData[{Cell["Section 7.8 Higher-Order Functions and Recursion", "Section", ImageRegion->{{0, 1}, {0, 1}}, CellTags->{"map", "nest", "repeat"}], Cell[CellGroupData[{Cell["map", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ map[f_, {}] := {} map[f_, {x_, y___}] := Join[{f[x]}, map[f, {y}]]\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["map[Cos, {1, 2, 3}]", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["nest", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ nest[f_, x_, 0] := x nest[f_, x_, n_] := f[nest[f, x, n-1]]\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["nest[Cos, 1.0, 50]", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["repeat", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ repeat[f_, L_, pred_] := L /; pred[Drop[L, -1], Last[L]] repeat[f_, L_, pred_] := repeat[f, Append[L, f[Last[L]]], pred]\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["repeatCount[f_, n_] := repeat[f, {n}, MemberQ]", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["plus4mod20[x_] := Mod[x+4, 20]", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["repeatCount[plus4mod20, 0]", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]]}, Open]], Cell[CellGroupData[{Cell["Section 7.9 Debugging", "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ F[0] := 0 F[1] := 1 F[n_] := F[n-2] + F[n-1] /; n > 1\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["?F", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["Trace[F[2]]", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["TracePrint[F[2]]", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["Trace[F[2], F]", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["TracePrint[F[2], F]", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["TracePrint[F[2], F[_]]", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["TracePrint[F[2], F[n_Integer] -> n]", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["F[n_] := (Print[n]; F[n-2] + F[n-1]) /; n > 1", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["F[4]", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]]}, Open]]}, Open]] }, FrontEndVersion->"4.1 for Microsoft Windows", ScreenRectangle->{{0, 1024}, {0, 695}}, WindowToolbars->{}, CellGrouping->Manual, WindowSize->{499, 599}, WindowMargins->{{220, Automatic}, {Automatic, 0}}, PrivateNotebookOptions->{"ColorPalette"->{RGBColor, -1}}, ShowCellLabel->True, ShowCellTags->False, RenderingOptions->{"ObjectDithering"->True, "RasterDithering"->False} ] (******************************************************************* 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->{ "F (Fibonacci function)"->{ Cell[3574, 142, 120, 2, 70, "Section", CellTags->"F (Fibonacci function)"]}, "sumElts"->{ Cell[3977, 159, 152, 2, 70, "Section", CellTags->{ "sumElts", "addPairs", "multPairwise", "deal", "carddeck"}]}, "addPairs"->{ Cell[3977, 159, 152, 2, 70, "Section", CellTags->{ "sumElts", "addPairs", "multPairwise", "deal", "carddeck"}]}, "multPairwise"->{ Cell[3977, 159, 152, 2, 70, "Section", CellTags->{ "sumElts", "addPairs", "multPairwise", "deal", "carddeck"}]}, "deal"->{ Cell[3977, 159, 152, 2, 70, "Section", CellTags->{ "sumElts", "addPairs", "multPairwise", "deal", "carddeck"}]}, "carddeck"->{ Cell[3977, 159, 152, 2, 70, "Section", CellTags->{ "sumElts", "addPairs", "multPairwise", "deal", "carddeck"}]}, "doubleUptoZero"->{ Cell[5864, 229, 155, 2, 70, "Section", CellTags->{"doubleUptoZero", "runEncode", "maxima", "interleave2"}]}, "runEncode"->{ Cell[5864, 229, 155, 2, 70, "Section", CellTags->{"doubleUptoZero", "runEncode", "maxima", "interleave2"}]}, "maxima"->{ Cell[5864, 229, 155, 2, 70, "Section", CellTags->{"doubleUptoZero", "runEncode", "maxima", "interleave2"}]}, "interleave2"->{ Cell[5864, 229, 155, 2, 70, "Section", CellTags->{"doubleUptoZero", "runEncode", "maxima", "interleave2"}]}, "ddx (symbolic derivatives)"->{ Cell[9015, 336, 142, 2, 70, "Section", CellTags->"ddx (symbolic derivatives)"]}, "solve"->{ Cell[9692, 369, 132, 2, 70, "Section", CellTags->{"solve", "elimx1", "subtractE1"}]}, "elimx1"->{ Cell[9692, 369, 132, 2, 70, "Section", CellTags->{"solve", "elimx1", "subtractE1"}]}, "subtractE1"->{ Cell[9692, 369, 132, 2, 70, "Section", CellTags->{"solve", "elimx1", "subtractE1"}]}, "encodeString"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "decode"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "printTree"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "printIndented"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "zip"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "extend"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "drawTree"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "drawSepTree"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "placeTree"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "TR"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "TR1"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "width"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "drawTree1"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "drawTree2"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "drawSepTree2"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "settext"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "drawBox"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "revtree"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "transGraphic"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "enlargeDisk"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "fruitTree graphic"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "World tree graphic"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "huffman2"->{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}]}, "huffmanTree"->{ Cell[19238, 649, 112, 2, 70, "Subsection", CellTags->"huffmanTree"], Cell[19353, 653, 259, 6, 70, "Input", CellTags->"huffmanTree"], Cell[19615, 661, 165, 5, 70, "Input", CellTags->"huffmanTree"]}, "FF (Fibonacci function)"->{ Cell[20349, 682, 123, 2, 70, "Section", CellTags->"FF (Fibonacci function)"]}, "map"->{ Cell[20805, 699, 140, 2, 70, "Section", CellTags->{"map", "nest", "repeat"}]}, "nest"->{ Cell[20805, 699, 140, 2, 70, "Section", CellTags->{"map", "nest", "repeat"}]}, "repeat"->{ Cell[20805, 699, 140, 2, 70, "Section", CellTags->{"map", "nest", "repeat"}]} } *) (*CellTagsIndex CellTagsIndex->{ {"F (Fibonacci function)", 23769, 805}, {"sumElts", 23871, 808}, {"addPairs", 24016, 812}, {"multPairwise", 24165, 816}, {"deal", 24306, 820}, {"carddeck", 24451, 824}, {"doubleUptoZero", 24602, 828}, {"runEncode", 24738, 831}, {"maxima", 24871, 834}, {"interleave2", 25009, 837}, {"ddx (symbolic derivatives)", 25162, 840}, {"solve", 25266, 843}, {"elimx1", 25376, 846}, {"subtractE1", 25490, 849}, {"encodeString", 25606, 852}, {"decode", 26023, 860}, {"printTree", 26443, 868}, {"printIndented", 26867, 876}, {"zip", 27281, 884}, {"extend", 27698, 892}, {"drawTree", 28117, 900}, {"drawSepTree", 28539, 908}, {"placeTree", 28959, 916}, {"TR", 29372, 924}, {"TR1", 29786, 932}, {"width", 30202, 940}, {"drawTree1", 30622, 948}, {"drawTree2", 31042, 956}, {"drawSepTree2", 31465, 964}, {"settext", 31883, 972}, {"drawBox", 32301, 980}, {"revtree", 32719, 988}, {"transGraphic", 33142, 996}, {"enlargeDisk", 33564, 1004}, {"fruitTree graphic", 33992, 1012}, {"World tree graphic", 34421, 1020}, {"huffman2", 34840, 1028}, {"huffmanTree", 35262, 1036}, {"FF (Fibonacci function)", 35521, 1043}, {"map", 35621, 1046}, {"nest", 35722, 1049}, {"repeat", 35825, 1052} } *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1727, 52, 151, 5, 70, "Title"], Cell[1881, 59, 188, 11, 70, "Subsubtitle"], Cell[2072, 72, 138, 4, 70, "Subsubtitle"], Cell[CellGroupData[{ Cell[2233, 78, 80, 1, 70, "Subtitle"], Cell[2316, 81, 74, 1, 70, "Subsubtitle"], Cell[CellGroupData[{ Cell[2413, 84, 86, 1, 70, "Section"], Cell[2502, 87, 759, 44, 70, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[3293, 133, 104, 1, 70, "Section"], Cell[3400, 136, 69, 1, 70, "Input"], Cell[3472, 139, 70, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[3574, 142, 120, 2, 70, "Section", CellTags->"F (Fibonacci function)"], Cell[3697, 146, 60, 1, 70, "Input"], Cell[3760, 149, 111, 5, 70, "Input"], Cell[3874, 156, 71, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[3977, 159, 152, 2, 70, "Section", CellTags->{"sumElts", "addPairs", "multPairwise", "deal", "carddeck"}], Cell[CellGroupData[{ Cell[4152, 163, 75, 1, 70, "Subsection"], Cell[4230, 166, 83, 1, 70, "Input"], Cell[4316, 169, 85, 1, 70, "Input"], Cell[4404, 172, 114, 4, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[4550, 178, 63, 1, 70, "Subsection"], Cell[4616, 181, 170, 5, 70, "Input"], Cell[4789, 188, 80, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[4901, 191, 67, 1, 70, "Subsection"], Cell[4971, 194, 148, 5, 70, "Input"], Cell[5122, 201, 84, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[5238, 204, 59, 1, 70, "Subsection"], Cell[5300, 207, 72, 1, 70, "Input"], Cell[5375, 210, 149, 5, 70, "Input"], Cell[5527, 217, 63, 1, 70, "Input"], Cell[5593, 220, 170, 4, 70, "Input"], Cell[5766, 226, 57, 1, 70, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[5864, 229, 155, 2, 70, "Section", CellTags->{"doubleUptoZero", "runEncode", "maxima", "interleave2"}], Cell[CellGroupData[{ Cell[6042, 233, 69, 1, 70, "Subsection"], Cell[6114, 236, 185, 6, 70, "Input"], Cell[6302, 244, 81, 1, 70, "Input"], Cell[6386, 247, 78, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[6496, 250, 64, 1, 70, "Subsection"], Cell[CellGroupData[{ Cell[6583, 253, 67, 1, 70, "Subsubsection"], Cell[6653, 256, 512, 14, 70, "Input"], Cell[7168, 272, 109, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[7309, 275, 67, 1, 70, "Subsubsection"], Cell[7379, 278, 231, 7, 70, "Input"], Cell[7613, 287, 109, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[7754, 290, 81, 1, 70, "Subsubsection"], Cell[7838, 293, 156, 5, 70, "Input"], Cell[7997, 300, 109, 1, 70, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[8147, 303, 61, 1, 70, "Subsection"], Cell[8211, 306, 138, 5, 70, "Input"], Cell[8352, 313, 78, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[8462, 316, 66, 1, 70, "Subsection"], Cell[8531, 319, 68, 1, 70, "Input"], Cell[8602, 322, 185, 6, 70, "Input"], Cell[8790, 330, 89, 1, 70, "Input"], Cell[8882, 333, 92, 1, 70, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[9015, 336, 142, 2, 70, "Section", CellTags->"ddx (symbolic derivatives)"], Cell[9160, 340, 62, 1, 70, "Input"], Cell[9225, 343, 279, 15, 70, "Input"], Cell[9507, 360, 82, 4, 70, "Input"], Cell[9592, 366, 68, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[9692, 369, 132, 2, 70, "Section", CellTags->{"solve", "elimx1", "subtractE1"}], Cell[9827, 373, 92, 1, 70, "Input"], Cell[9922, 376, 76, 1, 70, "Input"], Cell[10001, 379, 72, 1, 70, "Input"], Cell[10076, 382, 58, 1, 70, "Input"], Cell[10137, 385, 311, 9, 70, "Input"], Cell[10451, 396, 82, 1, 70, "Input"], Cell[10536, 399, 266, 8, 70, "Input"], Cell[10805, 409, 79, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[10916, 412, 410, 7, 70, "Section", CellTags->{ "encodeString", "decode", "printTree", "printIndented", "zip", "extend", "drawTree", "drawSepTree", "placeTree", "TR", "TR1", "width", "drawTree1", "drawTree2", "drawSepTree2", "settext", "drawBox", "revtree", "transGraphic", "enlargeDisk", "fruitTree graphic", "World tree graphic", "huffman2"}], Cell[CellGroupData[{ Cell[11349, 421, 67, 1, 70, "Subsection"], Cell[11419, 424, 265, 5, 70, "Input"], Cell[11687, 431, 107, 1, 70, "Input"], Cell[11797, 434, 270, 6, 70, "Input"], Cell[12070, 442, 74, 1, 70, "Input"], Cell[12147, 445, 88, 1, 70, "Input"], Cell[12238, 448, 125, 4, 70, "Input"], Cell[12366, 454, 78, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[12476, 457, 61, 1, 70, "Subsection"], Cell[12540, 460, 286, 7, 70, "Input"], Cell[12829, 469, 86, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[12947, 472, 69, 1, 70, "Subsection"], Cell[13019, 475, 4773, 122, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[17824, 599, 80, 1, 70, "Subsection"], Cell[17907, 602, 133, 4, 70, "Input"], Cell[18043, 608, 98, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[18173, 611, 74, 1, 70, "Subsection"], Cell[18250, 614, 222, 6, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[18504, 622, 74, 1, 70, "Subsection"], Cell[18581, 625, 496, 16, 70, "Input"], Cell[19080, 643, 126, 4, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[19238, 649, 112, 2, 70, "Subsection", CellTags->"huffmanTree"], Cell[19353, 653, 259, 6, 70, "Input", CellTags->"huffmanTree"], Cell[19615, 661, 165, 5, 70, "Input", CellTags->"huffmanTree"] }, Closed]], Cell[CellGroupData[{ Cell[19812, 668, 97, 1, 70, "Subsection"], Cell[19912, 671, 292, 6, 70, "Input"], Cell[20207, 679, 101, 1, 70, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[20349, 682, 123, 2, 70, "Section", CellTags->"FF (Fibonacci function)"], Cell[CellGroupData[{ Cell[20495, 686, 72, 1, 70, "Subsection"], Cell[20570, 689, 117, 5, 70, "Input"], Cell[20690, 696, 74, 1, 70, "Input"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[20805, 699, 140, 2, 70, "Section", CellTags->{"map", "nest", "repeat"}], Cell[CellGroupData[{ Cell[20968, 703, 58, 1, 70, "Subsection"], Cell[21029, 706, 124, 4, 70, "Input"], Cell[21156, 712, 69, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[21257, 715, 59, 1, 70, "Subsection"], Cell[21319, 718, 117, 4, 70, "Input"], Cell[21439, 724, 68, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[21539, 727, 61, 1, 70, "Subsection"], Cell[21603, 730, 178, 4, 70, "Input"], Cell[21784, 736, 96, 1, 70, "Input"], Cell[21883, 739, 80, 1, 70, "Input"], Cell[21966, 742, 76, 1, 70, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[22083, 745, 74, 1, 70, "Section"], Cell[22160, 748, 111, 5, 70, "Input"], Cell[22274, 755, 52, 1, 70, "Input"], Cell[22329, 758, 61, 1, 70, "Input"], Cell[22393, 761, 66, 1, 70, "Input"], Cell[22462, 764, 64, 1, 70, "Input"], Cell[22529, 767, 69, 1, 70, "Input"], Cell[22601, 770, 72, 1, 70, "Input"], Cell[22676, 773, 85, 1, 70, "Input"], Cell[22764, 776, 95, 1, 70, "Input"], Cell[22862, 779, 54, 1, 70, "Input"] }, Closed]] }, Open ]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)