# Errata for Mathematica Cookbook

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date Submitted Date Corrected
Printed
Page iv
middle

The free 30 day trial license code printed on page iv is missing a 5 at the end.

Anonymous  May 14, 2010  Dec 16, 2011
PDF
Page xvii
3rd paragraph

Reference to the programming language "Mathlab" should be to "MATLAB".

Marvin Schaefer  May 21, 2010  Dec 16, 2011
PDF
Page xxi
last paragraph

Michael Trott's last name is mispelled - you have "Trot", it should be "Trott".

Bill White  May 23, 2010  Dec 16, 2011
Printed
Page vii

Three-Dimensional Plots and Graphics => Three-Dimensional Graphics and Plots

Nellie McKesson

May 24, 2011  Dec 16, 2011
Printed
Page Index

AbsoluteTiming and Timing should be added

Note from the Author or Editor:
Yes, I agree. Production: Can you add these to the index for next printing.

Nellie McKesson

May 24, 2011  Jan 06, 2012
Printed
Page 1
Paragraph 2 or 3, line 5 or 6 or 3

1.2^8 is 1.2*1.2*1.2*1.2*1.2*1.2*1.2*1.2 It is not 1.2*10^8 but this works 1.2*^8

Note from the Author or Editor:
Yes, this is a typo.

William G. Fish  May 14, 2010  Dec 16, 2011
PDF
Page 8
10 lines from bottom

is: \$MinPrecision, whose default value is minus infinity should be: \$MinPrecision, whose default value is 0

Note from the Author or Editor:
Yes, this is a mistake. \$MinPrecision, whose default value is 0.

dario.buttari  May 12, 2010  Dec 16, 2011
Printed
Page 8
last paragraph

Mathematica also defines two internal variables: \$MinPrecision, whose default value is minus infinity, and \$MaxPrecision, whose default value is plus infinity. ==> zero

Note from the Author or Editor:
\$MinPrecision, whose default value is zero and \$MaxPrecision, whose default value is plus infinity.

Nellie McKesson

May 24, 2011  Dec 16, 2011
Printed
Page 13

"Recipe 1.5 ..." should be "Recipe 1.4 ..."

Morton Goldberg  Dec 08, 2010  Jan 06, 2012
Other Digital Version
15
at In[80] and In[81]

In the mobi [kindle] version, the instances of "IntegerDigits[43210]" have a space in the middle of the number ("IntegerDigits[43 210]") that would convert the argument to the product of 43 and 210.

Note from the Author or Editor:
This is due to the way Mathematica formats numbers longer than 4 digits. I'll see if O'Reilly can tweak the converter. However, the electronic edition comes with notebooks so that is your best option for actually evaluating expressions.

Tom Bradley  Dec 03, 2010  Dec 16, 2011
Printed
Page 38
last paragraph, last sentence

It's not the "first 100 primes." It's the primes in the first 100 positive integers. Count the frames, only 25 primes are identified. Change the last sentence to: "Here is a slick little demonstration borrowed from the Mathematica PrimeQ documentation for visually identifying the primes in the first 100 positive integers."

William G. Fish  May 19, 2010  Dec 16, 2011
Printed
Page 48

"Also see Recipe 2.12 in which I use it for a ..." should be "Also see Recipe 2.11 in which I use ListConvolve for a ..." The section reference is not only problem; It is important to change "it" to "ListConvolve" because "it" has no unambiguous referent in the previous sentence.

Morton Goldberg  Dec 08, 2010  Dec 16, 2011
Printed
Page 50
4th paragraph, line 3

Change "last value of somePrime[500]." to "last value of somePrimes[500]."

William G. Fish  May 18, 2010  Dec 16, 2011
PDF
Page 51
1st paragraph

The printed example appears to show values for Prefix and Postfix as though they were undefined functions: In[108]:= Prefix[f[1]] Out[108]= Prefix[1] In[109]:= Postfix[f[1]] Out[109]= Postfix[1] The correct outputs should be: Out[108]:=f@1 and Out[109]:=1//f

Marvin Schaefer  May 23, 2010  Dec 16, 2011
PDF
Page 51
2nd paragraph under Section 2.8 Solution

In the invocation of the indexed functions f, the dummy variable i is superflous. Printed as Table[f[RandomInteger[{1, 3}]][3, 2], {i,6}] is equivalent to, but perhaps less clear than Table[f[RandomInteger[{1, 3}]][3, 2], {6}] i.e., Table[x,{i,6}] == Table[x,{6}] == {x, x, x, x, x, x} so long as x is free of the dummy variable i

Marvin Schaefer  May 23, 2010  Dec 16, 2011
Printed
Page 53
~3rd paragraph

Change: "In[135]:= mySum[{1,2,3,4,5}]" to: "In[135]:= mySum2[{1,2,3,4,5}]"

William G. Fish  May 23, 2010  Dec 16, 2011
PDF
Page 53
1st paragraph under Discussion

There is a closing bracket missing in g[{}] = x g[l_] = f[First[l], g[Rest[l]] which should read g[{}] = x g[l_] = f[First[l], g[Rest[l]]]

Marvin Schaefer  May 23, 2010  Dec 16, 2011
Printed
Page 64
Out[191]

Out[191] seems to serve no purpose. Suggest removing it.

Morton Goldberg  Dec 08, 2010  Dec 16, 2011
Printed
Page 67
1st paragraph

Change "folllowing" to "following".

William G. Fish  May 25, 2010  Dec 16, 2011
Printed
Page 77
Second paragraph

You will be impressed by the expressiveness of Mathematica by comparing the amount of code in this recipe with the code to implement implicit currying in scheme ( http://bit.ly/otB90 ). ==> Scheme

Note from the Author or Editor:
Fix case "Scheme"

Nellie McKesson

May 24, 2011  Dec 16, 2011
Other Digital Version
120
1st paragraph, section 3.10

(*Perform bitwise OR of two vectors.*) bitvec /: BitOr[bitvec[n1_, l1_], bitvec[n2_, l2_]] := bitvec[BitAnd[n1, n2], Max[l1, l2]] I run the code with some binary vector, and feel this code "bitvec[BitAnd[n1, n2], Max[l1, l2]]" may be "bitvec[BitOr[n1, n2], Max[l1, l2]]" Please check it.

Note from the Author or Editor:
Yes, this is a cut and paste typo. Should be bitvec /: BitOr[bitvec[n1_, l1_], bitvec[n2_, l2_]] := bitvec[BitOr[n1, n2], Max[l1, l2]]

CS  Jun 03, 2010  Dec 16, 2011
Printed
Page 126
Last line of code

In the second definition of the "balance" function for the Red-Black tree, the variable "left2" appears twice in the right hand side of the assignment. The second appearance of "left2" should be replaced by "right1". This mistake causes the "balance" function to destroy the integrity of the tree.

Note from the Author or Editor:
Correct. Last line on pg. 399 should be: {red, {black,left1,elem1,left2}, elem2, {black,right1, elem3,right2}}

Yonatan Most  Aug 16, 2011  Dec 16, 2011
Printed
Page 142
Last paragraph

A directed graph with no cycles is called a directed acyclic graph (DAG). The transitive closer of a DAG is the supergraph that adds directed edges from ancestors to descendants. ==> closure Chapter4 Patterns and Rule-Based Programming

Note from the Author or Editor:
change 'closer' to 'closure'

Nellie McKesson

May 24, 2011  Dec 16, 2011
Other Digital Version
148
last paragraph

f[p : Longests@PatternSequence[a,b]..,rest___] (*The longest repeated sequence of a,b*) "Longests" should be "Longest" mathematica function.

CS  Jun 07, 2010  Dec 16, 2011
Printed
Page 157
In[78] and Out[78]

What is purpose of evaluating In[78]?

Note from the Author or Editor:
Some stray nonsense got stuck in there!

Morton Goldberg  Dec 08, 2010  Dec 16, 2011
Printed
Page 162
In[107

Don't you think it a serious violation of the spirit of functional programming to have an expression like FixedPoint[(graph2 = ReplaceAll[#, pat1])&, graph2] in In[107]? And it's so unnecessary! The function hasPath can be better written as hasPath[graph_, from_, from_] := True hasPath[graph_, from_, to_] := Module[{g=graph,rule}, rule = p:{a___, from->x_, b___, x_->y_, c___} :> {from->x, x->y, from->y, a, b, c} /; ! MemberQ[p, from->y]; MemberQ[FixedPoint[# /. rule &, g], from->to]]

Morton Goldberg  Dec 06, 2010  Dec 16, 2011
Printed
Page 162
In[111]

The expression graph2 /. Rule[v_->_] :> v used to extract the symbolic names of graph2's nodes in In[111] is incorrect. It will fail to extract e because this node had no outgoing edges, which this expression requires. Better to write: List @@@ graph2 // Flatten // Union

Morton Goldberg  Dec 06, 2010  Dec 16, 2011
Printed
Page 162
In[107]

This is a following on to my previously submitted question about In[107]. On further thought, there is no need for the local variable g in the revised version hasPath. hasPath[graph_, from_, to_] := Module[{rule}, rule = p:{a___, from->x_, b___, x_->y_, c___} :> {from->x, x->y, from->y, a, b, c} /; ! MemberQ[p, from->y]; MemberQ[FixedPoint[# /. rule &, graph], from->to]] To me, this is better example of the power of pattern match and rules than what appears in the book. I even think it's easier to understand.

Morton Goldberg  Dec 06, 2010  Dec 16, 2011
Printed
Page 164
In[116]

The definition of hasPath2 given in In[116] can be simplified by 1) eliminating the local variable graph2 and 2) making better use of Catch and Throw. hasPath2[graph_, from_, from_] := True hasPath2[graph_, from_, to_] := Module[{rule1, rule2}, rule1 = {___, from->to, ___} :> Throw[True]; rule2 = p:{a___, from->x_, b___, x_->y_, c___} :> {from->x, x->y, from->y, a, b, c} /; ! MemberQ[p, from->y]; Catch[FixedPoint[# /. {rule1, rule2}&, graph]; False]]

Note from the Author or Editor:
This is a minor technical improvement but the code in book is correct. Note to production: For the upcoming reprint I recommend staying with existing code. I'll consider this if we ever do a second edition.

Morton Goldberg  Dec 07, 2010
Printed
Page 192
above section 5.3

See Recipe 2.4 for use of StringPosition[], which returns sequence specification that can be fed into StringReplacePart[] and StringDrop[]. See Recipes 2.8 and 2.9 for more sophisticated forms of XML processing. 2.4 ==> 5.5, 2.8==>5.8, 2.9==>5.9

Note from the Author or Editor:
Yes, fix references.

Nellie McKesson

May 24, 2011  Dec 16, 2011
PDF, Other Digital Version
Page 197
first paragraph

stringDup2[seed_, n_] := StringTake[Nest[# <> # &, seed, Ceiling[Log[2, n]] ], n] Code will not working properly if you run this: stringDup2["CS", 4], and you get the output "CSCS".Only 2 duplicate of "CS". It's need to modify the n parameter of StringTake function because it gives only first n "characters", not full "string".

Note from the Author or Editor:
Yes. This is a bug. Can be fixed by multiplying by length of seed. stringDup2[seed_, n_] := StringTake[Nest[# <> # &, seed, Ceiling[Log[2, n]] ], n*StringLength[seed]]

CS  Jun 27, 2010  Dec 16, 2011
PDF, Other Digital Version
Page 199
first paragraph

classify[word_String /; StringMatchQ[ word, {"and", "or", "nor", "after," "although," "as," "because," "before," "how," "if," \ "once," "since," "than," "that," "though," "till," "until," "when," \ "where," "whether,", "while"}]] := conjunction[word] This code will cause StringExpression::invld: error. There are some typo like this ("after,") , and it should be ("after",).

CS  Jun 28, 2010  Dec 16, 2011
Other Digital Version
199
second paragraph

I have bought this book with Mathmetica form *.nb files, but there didn't contain greptest.txt which mentioned in In[102]. Please check it.

Note from the Author or Editor:

CS  Jun 29, 2010
Printed
Page 207
In[128]

I think the assignment nf1 = Nearest[Dictionary[]]; would be much clearer to the reader if the author mentioned that it returns a function that, when applied to <word> and an integer <n>, returns a list containing the n words in the integrated dictionary considered to be closest to <word>. Without this additional clarification, unless the reader is already familiar with Nearest, the reader must interrupt his/her reading and spend some looking up Nearest before being able to understand how SpellCheck works. I would also point out that SpellChecker violates the Mathematica convention that user-defined symbols should start with lowercase letters, a convention the author ordinarily respects.

Note from the Author or Editor:
Add the additional clarification as a comment in code. (* returns a function that, when applied to <word> and an integer <n>, returns a list containing the n words in the integrated dictionary considered to be closest to <word> *) nf1 = Nearest[Dictionary[]];

Morton Goldberg  Dec 15, 2010  Dec 16, 2011
Printed
Page 212
text between Out[152] and In[153]

"... we use //. (ReplaceAll) ..." should be "... we use //. (ReplaceRepeated) ..."

Morton Goldberg  Dec 08, 2010  Dec 16, 2011
PDF, Other Digital Version
Page 213/214
last paragraph

If apply In[155] with //FullForm, the "age" and "ht" was not transformed to numbers. This part of code "{n_, s_, age_, ht_} -> {n, s, ToExpression[age], ToExpression[ht]}" may be modified to "{n_, s_, age_, ht_} :> {n, s, ToExpression[age], ToExpression[ht]}" In[159] has the same issue.

Note from the Author or Editor:
In this case, I observe that code actually works: In[282]:= Cases[data , XMLElement["item", _, _], Infinity] /. XMLElement[_,_ ,{val_}] :> val /. XMLElement["item",_,list_] :> list /. {n_, s_, age_, ht_} -> {n, s, ToExpression[age], ToExpression[ht]}//FullForm Out[282]//FullForm= List[List["Leonardo","male","8","4.7"],List["Salvatore","male","5","4.1"],List["Alexis","female","6","4.4"]] However, it is safer to make the suggested change or to make sure to Clear[] the variables before evaluation.

CS  Jul 05, 2010  Dec 16, 2011
Printed
Page 219
In[168]

In the definition transform[XMLObject["Document"][decl_, content_, rest_]] := Module[{},XMLObject[type][decl, transform[content], rest]] 'type' should be replaced by '"Document"'

Morton Goldberg  Dec 14, 2010  Dec 16, 2011
Printed
Page 225
1st paragraph, last sentenceHelper functions define ... for Sort and OrderQ, respectively, ... should be Helper functions define ... for Sort and Split, respectively, ...

Helper functions define ... for Sort and OrderQ, respectively, ... should be Helper functions define ... for Sort and Split, respectively, ...

Morton Goldberg  Dec 14, 2010  Dec 16, 2011
Printed
Page 228
In[236] and Out[236]

In[236] and Out[236] don't make sense in the context of Section 5.11. I suggest they be removed.

Note from the Author or Editor:
remove stray code

Morton Goldberg  Dec 15, 2010  Dec 16, 2011
Printed
Page 257
Paragraph preceding In[33]

"... into pairs with overhand of 1 ..." should be "... into pairs with overhang of 1 ..." or better yet "... into pairs with offset of 1 ..."

Note from the Author or Editor:
into pairs with overhang of 1

Morton Goldberg  Dec 17, 2010  Dec 16, 2011
Printed
Page 263
Last paragraph on page

In "Mathematica has ... primitives: Text, Polygon, ... , Point, ...,Raster, and Point can be ...." Point appears twice.

Morton Goldberg  Dec 17, 2010  Jan 06, 2012
Printed
Page 270
In[51]

The y-axis label Amplitude does not appear in the sine wave plot because the plot range does not extend enough to the left of x = 0 to allow it to show. This can be fixed by using the option PlotRangePadding or by actually extending the plot range to be {\[Theta],-1,2 \[Pi]}

Note from the Author or Editor:
Plot[0.5 Sin[2 \[Theta]], {\[Theta], 0, 2 \[Pi]}, PlotLabel -> Style[0.5 Sin[2 \[Theta]], FontSize -> 20, FontFamily -> "Arial"], AxesLabel -> {"Radians", "Amplitude"}, LabelStyle -> Directive[Bold, FontFamily -> "Arial", FontSize -> 12], Frame -> True, FrameLabel -> Style["Sine Wave", FontSlant -> Italic], ImageSize -> Medium, PlotRangePadding -> 1]

Morton Goldberg  Dec 17, 2010  Dec 16, 2011
Printed
Page 276

In Recipe 18.5, I discuss how the attributes of 3D graphics can be controlled through stylesheets. If you intend to create publication-quality documents in Mathematica, you should familiarize yourself with stylesheets. ==> 18.6

Note from the Author or Editor:
yes, correct reference

Nellie McKesson

May 24, 2011  Dec 16, 2011
Printed
Page 278
In[4] & Out[4]

In[4] and Out[4] should be removed. They take up space but serve no purpose.

Morton Goldberg  Dec 23, 2010  Dec 16, 2011
Printed
Page 302
Code at top of page

In[314],Out[314] should be 36

Note from the Author or Editor:
This was caused by out of order execution.

Nellie McKesson

May 24, 2011
Printed
Page 314
Text at top of page

In the sentence, "Please try the code on your own to see the effect.) Both the cylinder and the sphere have a green color, but the sphere also has a green glow. ", "sphere" should be "cylinder".

Morton Goldberg  Dec 29, 2010  Dec 16, 2011
Printed
Page 321
last paragraph

If you call PolyhedronData[poly], where poly is the name of the polyhedron, it will return the graphic. The code given here creates a labeled grid of a random selection of 24 polyhedra known to Mathematica 7. Here StringSplit uses a regular expression to parse the names on CamelCase boundaries and inserts a new line so the names fit inside the grid cells. ==> 20

Note from the Author or Editor:
Yes, change to 20.

Nellie McKesson

May 24, 2011  Dec 16, 2011
Printed
Page 346

Recipe 8.3 shows how histograms can be used to match one image's contrast to that of a reference image. ==> 8.4

Note from the Author or Editor:
Make change.

Nellie McKesson

May 24, 2011  Dec 16, 2011
Printed
Page 347
First paragraph

To match a histogram of one image to another, you produce the equalization transform of the input image as in Recipe 8.1. You then produce the equalization transform of the target image, and from that and the input transform, derive the final specification transform. Next, map the input through the specification transform to yield an image that approaches the target image's histogram. Since you need to build the equalization transform for each image, it makes sense to factor that logic into a separate function. Here I call it buildEqualizationMap. You will recognize the basic logic from Recipe 8.2. ==> the both should be 8.2 and 8.3

Note from the Author or Editor:
Make change

Nellie McKesson

May 24, 2011  Dec 16, 2011
Printed
Page 349
First paragraph

In Recipe 8.2 we saw how histograms can be used to automatically equalize an image's contrast. However, sometimes it is preferable to equalize based on a reference histogram rather than a uniform distribution. This often arises when transformations are applied to an image and have side effects that reduce contrast[LongDash]side effects we wish to undo by shifting the image back to the grayscale distribution of the original image (see Recipe 8.4). ===>8.5

Note from the Author or Editor:
Yes, change to 8.5

Nellie McKesson

May 24, 2011  Dec 16, 2011
Printed
Page 350
In[258]

Needs["PlotLegends`"] is not needed.

Note from the Author or Editor:
Needs["PlotLegends`"] is only needed in Mathematica 6. Could put a note in comments in code: (*Needs[:PlotLegends`] *) (* uncomment in Mathematic 6 or earlier*)

Nellie McKesson

May 24, 2011  Dec 16, 2011
Printed
Page 352
Last phrase

Here we want to see more fine detail of the craters in an image of the moon. The transform achieves this but we lose contrast. We can readjust contrast using the histogramSpecification algorithm from Recipe 8.3. ==>8.4

Note from the Author or Editor:
Change to 8.4

Nellie McKesson

May 24, 2011  Dec 16, 2011
Printed
Page 356
Figure 8.6

In[] and Out[] numbers are not properly sequenced (there are many similar parts in the latter half of the book)

Note from the Author or Editor:
Production: This is the result of out of order execution. Reevaluate the entire chapter before printing.

Nellie McKesson

May 24, 2011
Printed
Page 362
First paragraph

Recipe 3.3 with a Gaussian smoothing to reduce the sensitivity of the Laplacian to noise. See the "Discussion" section on page 364 for further details. This implementation uses transformation rules that map intermediate gray levels to either white or black to emphasize the edges. ==> 8.5

Note from the Author or Editor:
Yes, 3.3 -> 8.5

Nellie McKesson

May 24, 2011  Dec 16, 2011
Printed
Page 399
Out[90]

This only repeats what was already shown in Out[753]. It should be removed.

Note from the Author or Editor:
Yes, the image is duplicated. Artifact of reevaluation.

Morton Goldberg  Oct 16, 2011
Printed
Page 401
First paragraph

As explained above, tuning instruments in the modern Western world is based on dividing the octave into 12 equal segments. If the ratio of the semitone C to C# is called &#945;, then the ratio of the octave from C3 to C4 is &#945;^12 and should equal 2.0. Therefore you can calculate &#945; to be the 12th root of 20. ==> 2.0

Note from the Author or Editor:
yes, 2.0

Nellie McKesson

May 24, 2011  Jan 06, 2012
Printed
Page 405
First paragraph

Focus on the three wavelets between 900 and 1,300. ==>900,000 and 1,300,000?

Note from the Author or Editor:
Yes, make change as above

Nellie McKesson

May 24, 2011  Jan 06, 2012
Printed
Page 415
Third paragraph

FindRoot is appropriate when you are looking for numerical solutions and have provided a starting point where you want Mathematica to search. FindRoot is a numerical method, so it can solve a larger class of expressions then Solve, although it is not guaranteed to converge. ==> than?

Note from the Author or Editor:
Yes, change then to than

Nellie McKesson

May 24, 2011  Jan 06, 2012
Printed
Page 417
2nd paragraph

The statements about the timings "over a minute" and "just over a second" are in conflict with the timings reported in Out[15] and Out[16].

Note from the Author or Editor:
The problem here is that the result is sensitive to the hardware. Replace with: "but FullSimplify takes considerably longer than Simplify as shown by Timing."

Morton Goldberg  Oct 16, 2011  Jan 06, 2012
Printed
Page 433
In box

in the box the following ones shoul be deleted (f^(1,1))[x,y] (f^(1,1))[x,y] (f^(1,2))[x,y] (f^(1,2))[x,y]

Note from the Author or Editor:
Yes, the output is duplicated twice for f(1,1) and f(1,2)

Nellie McKesson

May 24, 2011  Jan 06, 2012
Printed
Page 450
First paragraph

the first paragraph, all x's should be n's Here is an unconventional application for Sum, but one that is sometimes used in discrete math to introduce the idea of a generating function. You can use Sum to construct a generating function for solutions to problems like x1+x2+x3 == 12 subject to x1 >= 4, x2 >= 2, and 5 >= x3 >= 2. Each Sum is constructed from the smallest number the associated variable can take to the largest, by considering the smallest the other variables can take. For example, x1 must be at least 4 but can't be greater than 12[Dash]2[Dash]2 = 8, since x2 and x3 must each be at least 2. Here we use Expand to generate the polynomial and Cases to find the exponents that sum to 12, thus giving all solutions.

Note from the Author or Editor:
yes, change x1, and so on to n1, ...

Nellie McKesson

May 24, 2011  Jan 06, 2012
PDF
Page 460
1st paragraph

"You can visualize distributions using BinCounts and BarChar." should read "You can visualize distributions using BinCounts and BarChart."

Marvin Schaefer  Jun 05, 2010  Jan 06, 2012
Printed
Page 495
the paragraph above In[152]

Quantile plots are used to visualize whether two data sets come from the same population. If so, the data lies along a straight line reference line. ???

Note from the Author or Editor:
"If so, the data lies along a straight line reference line." Change to: The closeness of fit to a straight line indicates the degree to which the data comes from the same population.

Nellie McKesson

May 24, 2011  Jan 06, 2012
Printed
Page 499
In[160]

In[160] With[{N=500}, GraphicsRow[{ ListPlot[Table[halton[n,2,0.01],{n,N}], PlotStyle->Black,Frame->True,AspectRatio-> 1,ImageSize->Small], ListPlot[Table[Halton[n,2,0.05],{n,N}], ---> halton PlotStyle->Black,Frame->True,AspectRatio-> 1,ImageSize->Small]}]]

Note from the Author or Editor:
Yes, fix case. Halton -> halton

Nellie McKesson

May 24, 2011  Dec 16, 2011
Printed
Page 530
Beneath 2nd paragraph

The defined matrix has the mass values set to "2" without any explanation. Why? Why not have the masses set to "m" as explained in the preceding paragraph or as used in the following n-mass discussion?

Note from the Author or Editor:
Yes, the hard coded 2's are a typo there. You are correct that they should have been m's. In the expanded solution on the next page I do use m.

John Cromer  Nov 12, 2010  Dec 16, 2011
Printed
Page 535
In[104]

In[104]:= this line should be deleted

Nellie McKesson

May 24, 2011  Dec 16, 2011
Printed
Page 558
In[23]

In[23] printed form is corrupted strikePriceCode[strike_Real] := FromCharacterCode[ToCharacterCode["U"]+Floor[Mod[(strike - 2.5) /5 -1, 6]]]

Note from the Author or Editor:
This is some kind of printing problem? Should appear as suggested above.

Nellie McKesson

May 24, 2011  Jan 06, 2012
Printed
Page 559
In[31]

In[31] needless? In[31]:= 1/((1 + r)^t)//TraditionalForm

Note from the Author or Editor:
Delete this stray expression and associated output.

Nellie McKesson

May 24, 2011  Dec 16, 2011
Printed
Page 560

In[34] should be placed after In[32]? In[32]:= pvPerpetuity[cash_Real,rate_Real] := cash/rate An annuity is a set of fixed cash flows X that repeat for a specified number of periods T. In[33]:= Simplify[Sum[X/(1 + r)^t, {t, 1, T}]] Out[33]= (X-(1+r)^-T X)/r In[34]:= pvPerpetuity[100.00,0.03] Out[34]= 3333.33 ==> In[31]:= pvPerpetuity[cash_Real,rate_Real] := cash/rate In[32]:= pvPerpetuity[100.00,0.03] Out[32]= 3333.33 An annuity is a set of fixed cash flows X that repeat for a specified number of periods T. In[34]:= Simplify[Sum[X/(1 + r)^t, {t, 1, T}]] Out[34]= (X-(1+r)^-T X)/r

Note from the Author or Editor:
YEs, make change as suggested.

Nellie McKesson

May 24, 2011  Dec 16, 2011
Printed
Page 560 & 562

In[45] and In[47], no descriptions for the following expression.

Note from the Author or Editor:
These plots visually illustrate different convexities.

Nellie McKesson

May 24, 2011
Printed
Page 575
In[100]

In[100]:= Off[NDSolve::"eerri",NDSolve::"eerr"] -->:: {timePut2,put2}= makePutEuropeanAdaptive[50,0, 250, 1] //Timing

Note from the Author or Editor:
remove space in :<space>:

Nellie McKesson

May 24, 2011  Dec 16, 2011
Printed
Page 578-579

In[108] and In[113] should be corrected as follows In[110]:= strike=X = 100.; sigma=&#963; = 0.2; tau=&#964; = 1.0; rate=r = 0.05 In[115]:= &#948;S = (2*X)/n; S = NestList1 + &#948;S & , 0, n; V = (Max1 - X, 0 & ) /@ S;

Nellie McKesson

May 24, 2011  Jan 06, 2012
Printed
Page 580
In[119]

pf =pricingFunc[V,S,X,r,&#948;S,&#948;t,&#963;,nt]; -->should be pricingFunc[X,r,&#948;t,&#963;,nt] S0 = 100.; (price of the stock at valuation time) pf[S0]

Nellie McKesson

May 24, 2011  Dec 16, 2011
Printed, PDF, Safari Books Online
Page 591

The Mathematica Notebook for Hull White Trees can be found at http://mathematicacookbook.com/downloads/index.dot

Sal Mangano

Jul 25, 2010  Jan 06, 2012
PDF, Other Digital Version
Page 591
2nd paragraph

This link for the Hull White Trees does not work for me The Mathematica Notebook for Hull White Trees can be found at http://mathematicacookbook.com/downloads/index.dot Sal Mangano Jul 25, 2010 Jan 06, 2012

Note from the Author or Editor:

Anonymous  Feb 20, 2012
Printed
Page 594
2nd paragraph

Broken Link, the URL http://oreilly.com/catalog/9780596520991 fails with "resource not available" error.

Note from the Author or Editor:
All the notebooks are available as an upgrade to the print book for just 4.99. See below... You can use our ebook upgrade to purchase the ebook version for \$4.99. Register your book at https://epoch.oreilly.com/register/, and then use code 499UP when you purchase via oreilly.com.

Lewis Robinson  Jul 06, 2010
Printed
Page 610

In/Out[31] should be deleted

Note from the Author or Editor:
Remove In/Out [31]. Stray input.

Nellie McKesson

May 24, 2011  Dec 16, 2011
Printed
Page 616

In[40]&In[41] are not needed?

Note from the Author or Editor:
Remove duplicates.

Nellie McKesson

May 24, 2011  Dec 16, 2011
Printed
Page 619

In/Out[47] are needed?

Note from the Author or Editor:
Remove. Duplicated from above.

Nellie McKesson

May 24, 2011  Dec 16, 2011
Printed
Page 621
In[49] & Out[49]

The expression given in In[50] makes no sense as it has no dynamic content. It's output can be reproduced perfectly well with the following quite ordinary Mathematica code. With[{cf="SunsetColors",c=5,n=6,p=110}, Module[{p1,p2,data}, data=Table[i+Sin[i^n+j^n],{i,-4,4,0.03},{j,-4,4,0.03}]; p1=ListContourPlot[data, ContourShading->None, Contours->c, ContourStyle->{Opacity[0.5],Opacity[0.8]}]; p2=ReliefPlot[data, MaxPlotPoints->p,ColorFunction->cf]; Show[{p2,p1},ImageSize->400]]] I can only infer that the author, while he was playing with Out[49], found a set of parameters that produced an output he particularly liked and created a kludged-up edit of In[49] specialized to reproduce that one output. However, In[50] is an egregious way to do that, and including In[49] and Out[49] in the book with absolutely no explanation is no favor to the reader.

Note from the Author or Editor:
This is not a serious technical mistake. However, what is missing is the following explanation: "The expression in In[50] was generated using Manipulate's Paste Snapshot feature. Paste Snapshot creates a static expression fron the current dynamic control settings." Note to production: "Paste Snapshot" should be in the font used for commands.

Morton Goldberg  Oct 10, 2011  Dec 16, 2011
Printed
Page 653
In[31]

In[31]:= parallelMapIndexed[#1^First2&,Range[10]] --> Range[10],{}]

Note from the Author or Editor:
The suggested correction works but does not address the real problem. In[29] needs to be: parallelMapIndexed[func_, expr_, opts : OptionsPattern[]] := Parallelize[MapIndexed[func, expr], FilterRules[{opts}, Options[Parallelize]]] parallelMapIndexed[func_, expr_, levelspec_, opts : OptionsPattern[]] := Parallelize[MapIndexed[func, expr, levelspec], FilterRules[{opts}, Options[Parallelize]]] NOTE: opts was changed to {opts} in FilterRules

Nellie McKesson

May 24, 2011  Dec 16, 2011
Printed
Page 653

In[34] are needed?

Note from the Author or Editor:
Remove In[34] and Out[34]. Stray expression.

Nellie McKesson

May 24, 2011  Jan 06, 2012
PDF
Page 725
Bottom

The Function Unique is missing a pair of parenthesis, and should be: Unique[list_List] := Module[{once}, once[x_] := (once[x] = Sequence[]; x); once /@ list]

Brad Rubin  Jun 29, 2010  Dec 16, 2011
Printed
Page 741
last line

Change: "...debugger provide by Wolfram Workbench." to "...debugger provided by Wolfram Workbench."

William G. Fish  May 19, 2010  Dec 16, 2011
Printed
Page 748

Out[44] and Out[189] should be deleted

Note from the Author or Editor:
Yes. These are redundant.

Nellie McKesson

May 24, 2011  Jan 06, 2012
PDF
Page 778
Column 2 under B

"Bar Char, 460" should read "Bar Chart, 460"

Marvin Schaefer  Jun 05, 2010  Jan 06, 2012