(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 8.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       157,          7]
NotebookDataLength[     15356,        531]
NotebookOptionsPosition[     10817,        389]
NotebookOutlinePosition[     14032,        487]
CellTagsIndexPosition[     13989,        484]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{

Cell[CellGroupData[{
Cell[TextData[{
 "Errata for \n",
 StyleBox[ButtonBox["Programming with Mathematica: An Introduction",
  BaseStyle->"Hyperlink",
  ButtonData->{
    URL["http://www.cambridge.org/wellin"], None},
  ButtonNote->"http://www.cambridge.org/wellin"],
  FontSlant->"Italic"]
}], "PrefaceSection"],

Cell["First edition, second printing (Dec 2013)", "AuthorInfo"],

Cell["\<\
Publisher: Cambridge University Press
Author: Paul R. Wellin
Copyright: \[Copyright] 2013 Paul R. Wellin
\
\>", "AuthorInfo"],

Cell[CellGroupData[{

Cell["Page 195, line 7", "Item"],

Cell[TextData[{
 "Change to: \[OpenCurlyDoubleQuote]\[Ellipsis]the loop is repeated a total \
of ",
 Cell[BoxData[
  FormBox[
   RowBox[{"max", "(", 
    RowBox[{
     StyleBox["0", "OsF"], ",", 
     RowBox[{
      RowBox[{
       StyleBox["\[LeftFloor]", "OperatorCharacter"], 
       RowBox[{
        RowBox[{
         StyleBox["(", "OperatorCharacter"], 
         RowBox[{
          SubscriptBox[
           StyleBox["i", "OperatorCharacter"], 
           StyleBox["max",
            FontSlant->"Italic"]], "-", 
          SubscriptBox["i", 
           StyleBox["min",
            FontSlant->"Italic"]]}], ")"}], "/", 
        StyleBox["di",
         FontSlant->"Italic"]}], 
       StyleBox["\[RightFloor]", "OperatorCharacter"]}], 
      StyleBox["+", "OperatorCharacter"], 
      StyleBox["1", "OsF"]}]}], ")"}], TraditionalForm]]],
 " times\[Ellipsis]\[CloseCurlyDoubleQuote]"
}], "TextFirst"],

Cell["Corrected in sources: Tue 11 Feb 2014 12:38:20", "TextFirst",
 FontColor->GrayLevel[0.5]]
}, Open  ]],

Cell[CellGroupData[{

Cell["Page 200, In[62] and In[63]", "Item"],

Cell[TextData[{
 "Change ",
 StyleBox["Function[", "MR"],
 StyleBox["var", "TI"],
 StyleBox["]", "MR"],
 " to ",
 Cell[BoxData[
  RowBox[{"Function", "[", 
   RowBox[{
    StyleBox["var", "TI"], ",", "\[Ellipsis]"}], "]"}]]]
}], "TextFirst"],

Cell["Corrected in sources: Tue 11 Feb 2014 12:40:13", "TextFirst",
 FontColor->GrayLevel[0.5]]
}, Open  ]],

Cell[CellGroupData[{

Cell["Page 220, Line 9", "Item"],

Cell[TextData[{
 "In last line of ",
 Cell[BoxData["quadrant"]],
 " function code, change comment to: ",
 Cell[BoxData[
  FormBox[
   RowBox[{"(*", " ", 
    RowBox[{
     RowBox[{"x", ">", "0"}], " ", "&&", " ", 
     RowBox[{"y", "<", "0"}]}], " ", "*)"}], TraditionalForm]], "MR"]
}], "TextFirst"],

Cell["Corrected in sources: Tue 11 Feb 2014 12:40:13", "TextFirst",
 FontColor->GrayLevel[0.5]]
}, Open  ]],

Cell[CellGroupData[{

Cell["Page 226, In[42]", "Item"],

Cell[TextData[{
 "In ",
 StyleBox["selectionSort", "MR"],
 " code, change iterator list for ",
 StyleBox["j", "MR"],
 " to: ",
 Cell[BoxData[
  RowBox[{"{", 
   RowBox[{"j", ",", 
    RowBox[{"i", "+", "1"}], ",", "len"}], "}"}]]],
 "."
}], "TextFirst"],

Cell["Corrected in sources: Tue 11 Feb 2014 12:40:13", "TextFirst",
 FontColor->GrayLevel[0.5]]
}, Open  ]],

Cell[CellGroupData[{

Cell[TextData[{
 "Page 246, ",
 "line ",
 Cell[BoxData[
  FormBox[
   RowBox[{"-", "10"}], TraditionalForm]]]
}], "Item"],

Cell[TextData[{
 "change to: ",
 Cell[BoxData[
  RowBox[{
   RowBox[{"runEncode", "[", 
    StyleBox["lis", "TI"], "]"}], "=", 
   RowBox[{"{", 
    RowBox[{"{", 
     RowBox[{"x", ",", "1"}], "}"}], "}"}]}]]],
 "."
}], "TextFirst"],

Cell["Corrected in sources: Tue 11 Feb 2014 12:40:13", "TextFirst",
 FontColor->GrayLevel[0.5]]
}, Open  ]],

Cell[CellGroupData[{

Cell[TextData[{
 "Page 302, line ",
 Cell[BoxData[
  FormBox[
   RowBox[{"-", "2"}], TraditionalForm]],
  FormatType->"TraditionalForm"]
}], "Item"],

Cell[TextData[{
 "In the formula for the  p-value, the variable ",
 StyleBox["n",
  FontSlant->"Italic"],
 " in the denominator should be under the square root sign: ",
 Cell[BoxData[
  FormBox[
   RowBox[{"erfc", "(", 
    FractionBox[
     RowBox[{
      SubscriptBox[
       SubscriptBox["V", "n"], "obs"], "-", 
      RowBox[{"2", "n", " ", 
       RowBox[{"\[Pi]", "(", 
        RowBox[{"1", "-", "\[Pi]"}], ")"}]}]}], 
     RowBox[{"2", 
      SqrtBox[
       RowBox[{"2", "n"}]], 
      RowBox[{"\[Pi]", "(", 
       RowBox[{"1", "-", "\[Pi]"}], ")"}]}]], ")"}], TraditionalForm]],
  FormatType->"TraditionalForm"],
 "."
}], "TextFirst"],

Cell["Corrected in sources: Wed 12 Feb 2014 09:45:57", "TextFirst",
 FontColor->GrayLevel[0.5]]
}, Open  ]],

Cell[CellGroupData[{

Cell["Page 542, line -11 through -9", "Item"],

Cell[TextData[{
 "Each of the function definitions ",
 StyleBox["f1", "MR"],
 ", ",
 StyleBox["f2", "MR"],
 ", and ",
 StyleBox["f3", "MR"],
 " in ",
 StyleBox["offLatticeWalk", "MR"],
 " should be delayed definitions. Corrected code is:"
}], "TextFirst"],

Cell[BoxData[
 RowBox[{
  RowBox[{"offLatticeWalk", "[", 
   RowBox[{"t_", ",", "dim_"}], "]"}], ":=", 
  RowBox[{"Module", "[", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{"f1", ",", "f2", ",", "f3"}], "}"}], ",", "\[IndentingNewLine]", 
    
    RowBox[{
     RowBox[{"f1", ":=", 
      RowBox[{"RandomReal", "[", 
       RowBox[{
        RowBox[{"{", 
         RowBox[{
          RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", "t"}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"f2", ":=", 
      RowBox[{
       RowBox[{"(", 
        RowBox[{
         RowBox[{"{", 
          RowBox[{
           RowBox[{"Cos", "[", "#", "]"}], ",", 
           RowBox[{"Sin", "[", "#", "]"}]}], "}"}], "&"}], ")"}], "/@", 
       RowBox[{"RandomReal", "[", 
        RowBox[{
         RowBox[{"{", 
          RowBox[{"0", ",", 
           RowBox[{"2", " ", "\[Pi]"}]}], "}"}], ",", "t"}], "]"}]}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"f3", ":=", 
      RowBox[{"Table", "[", 
       RowBox[{
        RowBox[{
         RowBox[{"Function", "[", 
          RowBox[{
           RowBox[{"{", 
            RowBox[{"\[Theta]", ",", "u"}], "}"}], ",", 
           RowBox[{"{", 
            RowBox[{
             RowBox[{
              RowBox[{"Cos", "[", "\[Theta]", "]"}], " ", 
              SqrtBox[
               RowBox[{"1", "-", 
                SuperscriptBox["u", "2"]}]]}], ",", 
             RowBox[{
              RowBox[{"Sin", "[", "\[Theta]", "]"}], " ", 
              SqrtBox[
               RowBox[{"1", "-", 
                SuperscriptBox["u", "2"]}]]}], ",", "u"}], "}"}]}], "]"}], "@@", 
         RowBox[{"{", 
          RowBox[{
           RowBox[{"RandomReal", "[", 
            RowBox[{"{", 
             RowBox[{"0", ",", 
              RowBox[{"2", " ", "\[Pi]"}]}], "}"}], "]"}], ",", 
           RowBox[{"RandomReal", "[", 
            RowBox[{"{", 
             RowBox[{
              RowBox[{"-", "1"}], ",", "1"}], "}"}], "]"}]}], "}"}]}], ",", 
        RowBox[{"{", "t", "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{"Which", "[", "\[IndentingNewLine]", 
      RowBox[{
       RowBox[{"dim", "\[Equal]", "1"}], ",", 
       RowBox[{"Accumulate", "[", "f1", "]"}], ",", "\[IndentingNewLine]", 
       RowBox[{"dim", "\[Equal]", "2"}], ",", 
       RowBox[{"Accumulate", "[", "f2", "]"}], ",", "\[IndentingNewLine]", 
       RowBox[{"dim", "\[Equal]", "3"}], ",", 
       RowBox[{"Accumulate", "[", "f3", "]"}]}], "\[IndentingNewLine]", 
      "]"}]}]}], "]"}]}]], "Input"],

Cell["Corrected in sources: Sat 21 Dec 2013 18:47:28", "TextFirst",
 FontColor->GrayLevel[0.5]]
}, Open  ]],

Cell[CellGroupData[{

Cell["Page 570, line 2 through 4", "Item"],

Cell[TextData[{
 "Each of the function definitions ",
 StyleBox["f1", "MR"],
 ", ",
 StyleBox["f2", "MR"],
 ", and ",
 StyleBox["f3", "MR"],
 " in ",
 StyleBox["offLatticeWalk", "MR"],
 " should be delayed definitions. Corrected code is:"
}], "TextFirst"],

Cell[BoxData[
 RowBox[{
  RowBox[{"offLatticeWalk", "[", 
   RowBox[{"t_", ",", "dim_"}], "]"}], ":=", 
  RowBox[{"Module", "[", 
   RowBox[{
    RowBox[{"{", 
     RowBox[{"f1", ",", "f2", ",", "f3"}], "}"}], ",", "\[IndentingNewLine]", 
    
    RowBox[{
     RowBox[{"f1", ":=", 
      RowBox[{"RandomReal", "[", 
       RowBox[{
        RowBox[{"{", 
         RowBox[{
          RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", "t"}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"f2", ":=", 
      RowBox[{
       RowBox[{"(", 
        RowBox[{
         RowBox[{"{", 
          RowBox[{
           RowBox[{"Cos", "[", "#", "]"}], ",", 
           RowBox[{"Sin", "[", "#", "]"}]}], "}"}], "&"}], ")"}], "/@", 
       RowBox[{"RandomReal", "[", 
        RowBox[{
         RowBox[{"{", 
          RowBox[{"0", ",", 
           RowBox[{"2", " ", "\[Pi]"}]}], "}"}], ",", "t"}], "]"}]}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"f3", ":=", 
      RowBox[{"Table", "[", 
       RowBox[{
        RowBox[{
         RowBox[{"Function", "[", 
          RowBox[{
           RowBox[{"{", 
            RowBox[{"\[Theta]", ",", "u"}], "}"}], ",", 
           RowBox[{"{", 
            RowBox[{
             RowBox[{
              RowBox[{"Cos", "[", "\[Theta]", "]"}], " ", 
              SqrtBox[
               RowBox[{"1", "-", 
                SuperscriptBox["u", "2"]}]]}], ",", 
             RowBox[{
              RowBox[{"Sin", "[", "\[Theta]", "]"}], " ", 
              SqrtBox[
               RowBox[{"1", "-", 
                SuperscriptBox["u", "2"]}]]}], ",", "u"}], "}"}]}], "]"}], "@@", 
         RowBox[{"{", 
          RowBox[{
           RowBox[{"RandomReal", "[", 
            RowBox[{"{", 
             RowBox[{"0", ",", 
              RowBox[{"2", " ", "\[Pi]"}]}], "}"}], "]"}], ",", 
           RowBox[{"RandomReal", "[", 
            RowBox[{"{", 
             RowBox[{
              RowBox[{"-", "1"}], ",", "1"}], "}"}], "]"}]}], "}"}]}], ",", 
        RowBox[{"{", "t", "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{"Which", "[", "\[IndentingNewLine]", 
      RowBox[{
       RowBox[{"dim", "\[Equal]", "1"}], ",", 
       RowBox[{"Accumulate", "[", "f1", "]"}], ",", "\[IndentingNewLine]", 
       RowBox[{"dim", "\[Equal]", "2"}], ",", 
       RowBox[{"Accumulate", "[", "f2", "]"}], ",", "\[IndentingNewLine]", 
       RowBox[{"dim", "\[Equal]", "3"}], ",", 
       RowBox[{"Accumulate", "[", "f3", "]"}]}], "\[IndentingNewLine]", 
      "]"}]}]}], "]"}]}]], "Input"],

Cell["Corrected in sources: Sat 21 Dec 2013 18:47:28", "TextFirst",
 FontColor->GrayLevel[0.5]]
}, Open  ]]
}, Open  ]]
},
ScreenStyleEnvironment->"Printout",
WindowSize->{
  Scaled[0.5], 
  Scaled[0.8]},
WindowMargins->{{Automatic, 636}, {Automatic, 35}},
PrintingCopies->1,
PrintingStartingPageNumber->1,
PrintingPageRange->{1, Automatic},
PageHeaders->{{
   Cell[
    TextData[
     StyleBox[
      CounterBox["Page"], "PageNumber"]], "Header", 
    CellMargins -> {{0, Inherited}, {Inherited, Inherited}}], None, None}, {
  None, None, 
   Cell[
    TextData[
     StyleBox[
      CounterBox["Page"], "PageNumber"]], "Header", 
    CellMargins -> {{Inherited, 0}, {Inherited, Inherited}}]}},
PageFooters->{{None, None, None}, {None, None, None}},
PageHeaderLines->{False, False},
PageFooterLines->{False, False},
PrintingOptions->{"FacingPages"->True,
"FirstPageFace"->Right,
"FirstPageFooter"->True,
"FirstPageHeader"->False,
"PrintCellBrackets"->False,
"PrintMultipleHorizontalPages"->False,
"PrintRegistrationMarks"->False,
"PrintingMargins"->54},
ShowSelection->True,
Magnification->2,
FrontEndVersion->"10.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (June 27, \
2014)",
StyleDefinitions->Notebook[{
   Cell[
    StyleData[
    StyleDefinitions -> 
     FrontEnd`FileName[{"PWM"}, "PWM.nb", CharacterEncoding -> "UTF-8"]]], 
   Cell[
    CellGroupData[{
      Cell[
       StyleData["TextFirst"]], 
      Cell[
       StyleData["TextFirst", "Printout"], CellMargins -> {{22, 0}, {2, 0}}, 
       PageBreakAbove -> False, FontFamily -> "DTL Albertina TOT", FontSize -> 
       10]}, Open]], 
   Cell[
    CellGroupData[{
      Cell[
       StyleData["AuthorInfo"], MenuSortingValue -> 10000], 
      Cell[
       StyleData["AuthorInfo", "Printout"], 
       CellMargins -> {{12, Inherited}, {0, Inherited}}, MenuSortingValue -> 
       10000, FontFamily -> "DTL Albertina TOT", FontSize -> 10]}, Closed]], 
   Cell[
    CellGroupData[{
      Cell[
       StyleData["PrefaceSection"]], 
      Cell[
       StyleData["PrefaceSection", "Printout"], 
       CellFrame -> {{0, 0}, {0, 0.5}}, CellMargins -> {{12, 0}, {2, 5}}, 
       CellFrameStyle -> Directive[
         GrayLevel[0.5]], FontFamily -> "DTL Albertina TOT", FontSize -> 14, 
       FontWeight -> "Plain"]}, Closed]], 
   Cell[
    CellGroupData[{
      Cell[
       StyleData["Item"], CellDingbat -> None, ShowGroupOpener -> True, 
       CellGroupingRules -> {"SectionGrouping", 60}], 
      Cell[
       StyleData["Item", "Printout"], CellDingbat -> 
       Cell["\[FilledSmallCircle]", FontSize -> 8], ShowGroupOpener -> False, 
       CellMargins -> {{22, 4}, {4, 8}}, FontFamily -> "DTL Albertina TOT", 
       FontSize -> 11, FontSlant -> "Italic"]}, Open]], 
   Cell[
    CellGroupData[{
      Cell[
       StyleData["TI"], StyleMenuListing -> None], 
      Cell[
       StyleData["TI", "Printout"], FontFamily -> "DTL Albertina TOT", 
       FontSlant -> "Italic"]}, Open]]}, 
  WindowMargins -> {{Automatic, 351}, {104, Automatic}}, Visible -> False, 
  FrontEndVersion -> 
  "10.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (June 27, 2014)", 
  StyleDefinitions -> "PrivateStylesheetFormatting.nb"]
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[579, 22, 290, 8, 101, "PrefaceSection"],
Cell[872, 32, 63, 0, 32, "AuthorInfo"],
Cell[938, 34, 135, 5, 111, "AuthorInfo"],
Cell[CellGroupData[{
Cell[1098, 43, 32, 0, 50, "Item"],
Cell[1133, 45, 901, 28, 28, "TextFirst"],
Cell[2037, 75, 95, 1, 28, "TextFirst"]
}, Open  ]],
Cell[CellGroupData[{
Cell[2169, 81, 43, 0, 50, "Item"],
Cell[2215, 83, 241, 10, 28, "TextFirst"],
Cell[2459, 95, 95, 1, 28, "TextFirst"]
}, Open  ]],
Cell[CellGroupData[{
Cell[2591, 101, 32, 0, 50, "Item"],
Cell[2626, 103, 300, 10, 28, "TextFirst"],
Cell[2929, 115, 95, 1, 28, "TextFirst"]
}, Open  ]],
Cell[CellGroupData[{
Cell[3061, 121, 32, 0, 50, "Item"],
Cell[3096, 123, 253, 11, 28, "TextFirst"],
Cell[3352, 136, 95, 1, 28, "TextFirst"]
}, Open  ]],
Cell[CellGroupData[{
Cell[3484, 142, 121, 6, 50, "Item"],
Cell[3608, 150, 232, 10, 32, "TextFirst"],
Cell[3843, 162, 95, 1, 28, "TextFirst"]
}, Open  ]],
Cell[CellGroupData[{
Cell[3975, 168, 148, 6, 50, "Item"],
Cell[4126, 176, 644, 22, 69, "TextFirst"],
Cell[4773, 200, 95, 1, 28, "TextFirst"]
}, Open  ]],
Cell[CellGroupData[{
Cell[4905, 206, 45, 0, 50, "Item"],
Cell[4953, 208, 255, 10, 56, "TextFirst"],
Cell[5211, 220, 2521, 70, 403, "Input"],
Cell[7735, 292, 95, 1, 28, "TextFirst"]
}, Open  ]],
Cell[CellGroupData[{
Cell[7867, 298, 42, 0, 50, "Item"],
Cell[7912, 300, 255, 10, 56, "TextFirst"],
Cell[8170, 312, 2521, 70, 403, "Input"],
Cell[10694, 384, 95, 1, 28, "TextFirst"]
}, Open  ]]
}, Open  ]]
}
]
*)

(* End of internal cache information *)
