Sei sulla pagina 1di 67

Schaums Outline of Mathematica

Supplement for Version 6



The recent introduction of Mathematica 6 has brought significant changes to many of the
commands which comprise the language. This supplement describes those changes most
relevant to this book, which was originally written to conform to versions 4 and 5. I have
included, page by page, those changes which must be made in order for the examples and
solved problems to work properly. If you are running Mathematica 6 on your computer
you will want to keep this supplement handy.

A complete listing of all the changes in Mathematica 6 can be found in the
documentation center that is included with your program. Most notably:

Some of the menus and dialogue boxes have changed. These changes are mostly
cosmetic and should not cause any confusion.

The BasicInput palette has been renamed BasicMathInput.

Graphics output has been enhanced in version 6. Consequently your plots,
particularly 3 dimensional plots, may look slightly different from those in the text.

In versions 4 and 5 a semicolon (;) was used merely to suppress an annoying line
of output when executing graphics commands. In version 6, the semicolon
suppresses graphics output completely and must therefore be deleted when using
commands such as Plot, Plot3D, Show, etc. Furthermore, since the semicolon
may now be used to suppress graphics, DisplayFunction Identity
and DisplayFunction $DisplayFunction are no longer needed.

Some of the commands which had previously been supplied in packages (and had
to be loaded prior to use) are now included in the kernel and may be used without
invoking Needs or <<. Some of the commands are located in different packages,
and some of them are available by downloading packages from the Wolfram
website. These changes are described in detail in this supplement.

Some of the commands in version 5 have been eliminated and put into legacy
packages, included with Mathematica 6. They will have to be loaded prior to use.

Some of the commands (e.g. ImplicitPlot) have been eliminated and their
functionality has been incorporated into other commands (e.g. ContourPlot)
These changes are described in detail in this supplement.

Animation has been significantly enhanced with the introduction of the Animate
command.

I hope you will find this supplement helpful in navigating through Mathematica 6. If you
find any errors not included in this supplement please feel free to email me at
mathematica.corrections@gmail.com

Eugene Don, Ph.D.
Chapter 1

Page 1
The examples used in this book were executed using Mathematica version 4. You may notice
some differences on your computer if you are using version 6, particularly when generating 3
dimensional graphics. Most of the enhancements to version 6, however, will be transparent to the
novice user.


Page 2



The picture in example 1 below shows the standard Mathematica display . The symbols on the
right hand side form the BasicMathInput palette and allow access by mouse-click to the most
common mathematical symbols. (If you don't see the palette on your screen, click on
PalettesBasicMathInput and it will appear.) Other palettes are available for specialized
purposes and can be accessed via the Palettes menu.
Page 3




Page 4
Occasionally you may introduce an instruction which takes an excessively long time to execute,
or you may inadvertently create an infinite loop. To abort a calculation, go to
EvaluationAbort Evaluation. Alternatively, you may press [ALT] + . to abort.
([COMMAND] + . on the Macintosh) If this does not work, you will have to terminate the
kernel by going to EvaluationQuit KernelLocal . However, by doing so, you will lose all
your defined symbols and values. Your Mathematica notebook will not be lost however, so they
can easily be restored.

Page 5
1.7 Compute 81 using the Sqrt function. What happens if you do not use a capital 'S' ?

SOLUTION
Sqrt[81]
9
sqrt[81]
sqr t [ 81]


Pages 5-6
1.8 Use parentheses to multiply the sum of 2 and 3 by the sum of 5 and 7. What happens if
you use square brackets?

SOLUTION
(2 + 3)(5 + 7)
60
[2 + 3][5 + 7]
(Click on the +to reveal the error)

[2 + 3][5 + 7]
Syntax::sntxb : Expression cannot begin with "[2+3][5+7]".
Syntax::tsntxi : "[2+3]" is incomplete; more input is needed.
Syntax::sntxi : Incomplete expression; more input is needed.


Page 8
Arithmetic Operations are performed in the obvious manner using the symbols +, , ,
and /. Exponentiation is represented by a caret, ^, so x^y means x
y
. J ust as in algebra, a missing
symbol implies multiplication so 2a is the same as 2a. Be careful, however, when multiplying
two symbols, since ab represents the single symbol beginning with a and ending with b. To
multiply a by b you must separate the two letters with or (on the BasicMathInput palette) or
a space: a

b a b or a b .

Page 9
EXAMPLE 12 ?a(continuation of example 11)

?a
Gl obal `a
a =3
?b
Gl obal `b

2
1+x
b=
3+2x



EXAMPLE 13?a (continuation of example 12)

Clear[a]
?a ?a recalls information about the symbol a

Gl obal `a

Remove[b]
?b
I nf or mat i on: : not f ound : Symbol b not f ound. >>

(clicking on >>gives more information about the error)

Page 10
EXAMPLE 15?a
The BasicInput palette has been renamed BasicMathInput. ; is a typo. It should read ;

Page 12
There are different types of cells for different purposes. Only input cells can be fed to the
kernel for evaluation. Text cells are used for descriptive purposes. Other cell types such as Title,
Subtitle, Section, Subsection, etc. can by found in the menu FormatStyle. The style will
display at the top of your notebook window.


Page 13
There are many sources of help in Mathematica. First and foremost is the Mathematica
manual. Second, and probably more convenient, is the documentation center built into the
software. There you will find all available commands grouped by topic; simply click to get the
information you need.

Page 13

?Plot
Plot[f,{x,x
min
,x
max
}] generates a plot of f as a function of x from x
min
to x
max
.
Plot[{f
1
,f
2
,},{x,x
min
,x
max
}] plots several functions f
i
.

??Plot

Plot[f,{x,x
min
,x
max
}] generates a plot of f as a function of x from x
min
to x
max
.
Plot[{f
1
,f
2
,},{x,x
min
,x
max
}] plots several functions f
i
.




Page 14



Page 15
EXAMPLE 20
(a) Find all the commands beginning with inv.

?Inv*


Page 16
(b) Find all commands ending with in.

?in*

(c) Find all commands with our in the middle


EXAMPLE 22

Remove[`*]
?`* Check to see if any symbols remain
Information::nomatch : No symbol matching `* found.
Page 16
? Simplify
Simplify[expr] performs a sequence of algebraic and other transformations on expr, and returns
the simplest form it finds.
Simplify[expr,assum] does simplification using assumptions.

?? Simplify
Simplify[expr] performs a sequence of algebraic and other transformations on expr, and returns
the simplest form it finds.
Simplify[expr,assum] does simplification using assumptions.
Attributes[Simplify]={Protected}

Options[Simplify]={Assumptions$Assumptions,
ComplexityFunctionAutomatic,ExcludedForms{},
TimeConstraint300,TransformationFunctionsAutomatic,TrigTrue}

Page 17
1.30 Obtain help on the Mathematica command Factor and then factor x
3
6x
2
+11x 6.

SOLUTION
?Factor

Factor[poly] factors a polynomial over the integers.
Factor[poly,Modulus->p] factors a polynomial modulo a prime p.
Factor[poly,Extension->{a
1
,a
2
,}] factors a polynomial allowing coefficients that are
rational combinations of the algebraic numbers a
i
.

Factor[x
3
6x
2
+ 11x 6]
( - 3 + x) ( - 2 + x) ( - 1 + x)

1.31 Find all Mathematica commands beginning with 'Abs' .
SOLUTION
?Abs *

1.32 Find all Mathematica commands beginning with 'Sin' and ending with 'al' .

SOLUTION
?Sin*al


1.33 Find all Mathematica commands beginning with 'Fi'.

SOLUTION
?Fi*

Page 18
1.34 Find all Mathematica commands beginning with 'Fi' and ending with 't'.

SOLUTION
?Fi*t


Page 18
EXAMPLE 23
A bar graph can be constructed from a list of numbers using the command Bar Char t which is
located in the package Bar Char t s. To load this command, simply type (note the ` at the end)

<<BarCharts`
The appropriate command can then be accessed.
BarChart[{1,2,3,4}]


Page 19
EXAMPLE 24
<<BarCharts` Loads the package Bar Char t s`
Names["BarCharts`*"]
{BarChart, BarChart3D, BarEdges, BarEdgeStyle,
BargroupSpacing, BarLabels, BarOrientation, BarSpacing,
BarStyle, BarValues, GeneralizedBarChart,
GeneralizedBarChart3D, PercentileBarChart,
StackedBarChart}

EXAMPLE 25
The package Calendar` includes some interesting calendar functions.
<<Calendar`
Names["Calendar`*"]
{Calendar, CalendarChange, DateQ, DayOfWeek, DaysBetween,
DaysPlus, EasterSunday, EasterSundayGreekOrthodox, Friday,
Gregorian, Islamic, Jewish, JewishNewYear, Julian, Monday,
Saturday, Sunday, Thursday, Tuesday, Wednesday}

?DaysBetween
DaysBetween[{year
1
, month
1
, day
1
}, {year
2
, month
2
, day
2
}] gives the number of days between
the dates {year
1
, month
1
, day
1
} and {year
2
, month
2
, day
2
}.
DaysBetween[{year
1
, month
1
, day
1
, hour
1
, minute
1
, second
1
}, {year
2
, month
2
, day
2
, hour
2
, minute
2
, second
2
}]
gives the number of days between the given dates.

DaysBetween[{2007,8,3},{2008,12,5}]
490

Pages 19-20
1.35 The package `Combinatorica` contains functions in combinatorics and graph
theory. One of these is KSubsets , which lists all subsets of size k of a given set. Load
the package and execute Ksubsets[{1,2,3,4,5},3].

SOLUTION
<<Combinatorica`
KSubsets[{1, 2, 3, 4, 5}, 3]
{{1, 2, 3}, {1, 2, 4}, {1, 2, 5}, {1, 3, 4}, {1, 3, 5},
{1, 4, 5}, {2, 3, 4}, {2, 3, 5}, {2, 4, 5}, {3, 4, 5}}

Page 20
1.36 The function DayOfWeek appears in the package Calendar` and gives the day of the
week of any date in the calendar. Load the package, obtain help to determine its syntax
and then determine which day of the week J anuary 1, 2000 was.

SOLUTION
<<Calendar`
? DayOfWeek
DayOfWeek[{year,month,day}] gives the day of the week on which the given date
{year,month,day} occurred.
DayOfWeek[{year,month,day,hour,minute,second}] gives the day of the week for the
given date.

DayOfWeek[{2000, 1, 1}]
Sat ur day

1.37 The function ElementData gives values of chemical and physical properties of
elements. Among the properties included are AtomicWeight and AtomicNumber,
whose definitions are self explanatory. Compute the atomic weight and atomic number of
titanium.

SOLUTION
ElementData["Titanium","AtomicWeight"]
47. 867
ElementData["Titanium","AtomicNumber"]
22

Page 21
1.42 Plot[Sin[x],{x, 0, 2}] or
In this and subsequent
examples the semicolon at
the end of the command
must be omitted or the
graph will be suppressed.
Plot[Sin[x],{x, 0, 2 * Pi}]

1.43 Plot[{Sin[x],Sin[2x],Sin[3x]},{x,0,2}] or
Plot[{Sin[x],Sin[2x],Sin[3x]},{x,0,2 * Pi}]

Page 22
1.44 Sketch the graph of , 1 x, y 1. ( ) x y x
2 2 2
+ = y

SOLUTION

ContourPlot[(x
2
+y
2
)
2
= = x
*
y,{x,-1,1},{y,-1,1}] or
ContourPlot[(x^2+y^2)^2 = = x
*
y,{x,-1,1},{y,-1,1}]


-1.0 -0.5 0.0 0.5 1.0
-1.0
-0.5
0.0
0.5
1.0


Page 23
1.45 or Plot3D[(x 3y )e ,{x, 3,3},y, 3,3}]
2 2 (x y )
2 2
+
+

Plot3D[(x^2 + 3y^2) * Exp[(x^2 + y^2)],{x,3,3},{y,3,3}]




Chapter 2
Page 25
2.3 -
::indet : Indeterminate expression -+ encountered.
I ndet er mi nat e

The BasicInput palette has been renamed BasicMathInput. (2 instances)

Standard mathematical functions can be accessed by name or by clicking on its symbol in a
Mathematica palette. For example, the square root of a number can be obtained using either the
function Sqrt or, alternatively, by using the symbol from the BasicMathInput palette.
Remember that the argument of a function must be contained within square brackets, [ ].

Higher order roots can be computed by recalling that x x
n n
=
1/
.The symbol

on the
BasicMathInput palette may also be used. Notice that higher order roots of negative numbers
are given in a special format.

Page 29

The function Exp[x] is the natural exponential function . Other equivalent forms
are E^x and E
x
. Lower case e cannot be used, but the special symbol from the
BasicMathInput palette may be used instead. Exponential functions to the base b
are computed by typing b^x or b
x
.
Page 30
Mathematica assumes the arguments of trigonometric functions to be in radians. Problems
involving degrees must first be converted to radians if trigonometric functions are involved. For
this purpose, one can use the built in constant, Degree, whose value is /180. The symbol
o
,
located on the BasicMathInput palette may be used as well.


Page 32
EXAMPLE 29

?PrimeQ
PrimeQ[expr] yields True if expr is a prime number, and yields False otherwise.



EXAMPLE 30

?PolynomialQQ
PolynomialQ[expr,var] yields True if expr is a polynomial in var, and yields False otherwise.
PolynomialQ[expr,{var1,}] tests whether expr is a polynomial in the vari.
Page 44
Sums and products are of fundamental importance in mathematics and Mathematica makes their
computation simple. Unlike many computer languages, initialization is automatic and the syntax
is easy to apply, particularly if the BasicMathInput palette is used. Any symbol may be used as
the index of summation. (i is used in the description below.) Negative increments are permitted
wherever increment is used.

Page 46
Double sums can be computed using the following syntax or, more conveniently, by clicking
twice on the symbol in the BasicMathInput palette. This also extends to triple sums,
quadruple sums, and so forth.


Page 52
- Gr aphi cs- should be eliminated, as well as the last sentence on the page (obsolete).

Page 53
2.59 Delete the emi colon (;) s
Plot[{x
2
,2 x + 10},{x, 5, 5}]

2.60 Delete the emi olo (;) s c n
Plot[{x
2
, x
3
, x
4
},{x, 0, 1}]

2.61 Delete the semi colon (;)
Plot[{x, -x, x Sin[x]},{x, -6, 6}]

Page 54
EXAMPLE 62
Delete the semi colon (;)
Plot[f[x], {x, 0, 4}]

Page 56
2.63 Delete the semi colon (;)
Plot[f[x], {x, -6, 6}]

2.64 Delete the semi colon (;)
Plot[extension[x],{x, 0, 10}]

Page 60
= + f[x_] 1 x ; 2.7





Chapter 3
Page 78
Using the BasicMathInput palette, the symbols and may be used to represent union and
intersection, respectively.

There are a number of useful set commands available in the package Combinatorica`.
Among them are CartesianProduct, Subsets and KSubsets.

EXAMPLE 32
<< Combinatorica` This loads the package. See chapter 1.

EXAMPLE 33
<< Combinatorica` Omit if you have already loaded the package

Page 80
3.29 << Combinatorica` The package must be loaded first

3.30 << Combinatorica`



3.5 TABLES AND MATRICES

Matrices and tables can also be conveniently entered by going to
Insert Table/Matrix New

Page 81

Page 81
Two special matrix generating commands are worth remembering because of their frequency in
applications. The commands generate a nested list. Use //MatrixForm to get a matrix.

EXAMPLE 35

IdentityMatrix[3]//MatrixForm DiagonalMatrix[{1, 2, 3}]//MatrixForm
1 0 0
0 1 0
0 0 1
F
H
G
G
I
K
J
J

1 0 0
0 2 0
0 0 3
F
H
G
G
I
K
J
J

Page 82
EXAMPLE 36
The matrix is input using Insert Table/Matrix New
Mathematica outputs the matrix as a nested list.

Page 83
EXAMPLE 40

lst = {{a, b, c}, {d, e, f},{g, h, i}};
TableForm[lst, TableHeadings Automatic]


1 2 3
1 a b c
2 d e f
3 g h i

Page 84
EXAMPLE 41 (Tables should look as shown below)

col umn1 Col umn2 Col umn3
r ow1 a b c
r ow2 d e f
r ow3 g h i



col umn1 Col umn2 Col umn3
a b c
d e f
g h i

r ow1 a b c
r ow2 d e f
r ow3 g h i


Page 87
3.33
SOLUTION

IdentityMatrix[5]//MatrixForm


Page 88

Table should look as shown below (headings underlined). There is a bug in Mathematica 6.0.1.0
which causes the output to be incorrectly displayed as left justified.

i nt eger s squar es cubes
1 1 1
2 4 8
3 9 27
4 16 64
5 25 125
6 36 216
7 49 343
8 64 512
9 81 729
10 100 1000



3.36 Table should look as shown in the text. There is a bug in Mathematica 6.0.1.0 which causes
the row labels and line to be repeated.

Page 89
3.37 Table should look as shown in the text. There is a bug in Mathematica 6.0.1.0 which causes
the row labels and line to be repeated.
Page 89
3.38 Table should look as shown below (column headings underlined).

per i od amount
1 1015.
2 1030. 22
3 1045. 68
4 1061. 36
5 1077. 28
6 1093. 44
7 1109. 84
8 1126. 49
9 1143. 39
10 1160. 54
11 1177. 95
12 1195. 62


Page 90
3.39 Table should look as shown below (column headings underlined).

year quar t er l y mont hl y dai l y cont i nuousl y
1 1061. 36 1061. 68 1061. 83 1061. 84
2 1126. 49 1126. 16 1127. 49 1127. 50
3 1195. 62 1196. 68 1197. 20 1197. 22
4 1268. 99 1270. 49 1271. 22 1271. 25
5 1346. 86 1348. 85 1349. 83 1349. 86
6 1429. 50 1432. 04 1433. 29 1433. 33
7 1517. 22 1520. 37 1521. 91 1521. 96
8 1610. 32 1614. 14 1616. 01 1616. 07
9 1709. 14 1713. 70 1715. 93 1716. 01
10 1814. 02 1819. 40 1822. 03 1822. 12


3.40 Table should look as shown below (column headings underlined).
r at e payment
0. 0600 1498. 88
0. 0625 1539. 29
0. 0650 1580. 17
0. 0675 1621. 50
0. 0700 1663. 26
0. 0725 1705. 44
0. 0750 1748. 04
0. 0775 1791. 03
0. 0800 1834. 41

Chapter 4
Page 91
EXAMPLE 1
- Gr aphi cs- should be eliminated, as well as the last sentence on the page (obsolete).

Page 92
EXAMPLE 2 Delete the se i colon (;) m
Plot[{x
2
, 9 x
2
}, {x, 3, 3}

Pages 92 93
EXAMPLE 3 Delete the semi colons (;)
g1 = Plot[x
2
9, {x, 4, 4}]
g2 = Plot[Sin[x], {x, 0, 2}]
Show[g1, g2]
Page 93
All references to Di spl ayFunct i on should be ignored. Graphics display can now be
controlled with a semicolon (;).

EXAMPLE 4

g1 = Plot[x
2
9, {x, 4, 4}];
g2 = Plot[Sin[x], {x, 0, 2}];
Show[g1, g2]

There is a missing left bracket ({) in the Gr aphi csAr r ay description. It should read

GraphicsArray[{{g11, g12, ...},{g21, g22, ...}}] plots a two-
dimensional array of graphics objects.


The last line (Note: . . .) on page 93 is not applicable to Mathematica 6 and should be deleted.

Page 94
g1=Plot[x,{x,-2,2}];
g2=Plot[-x,{x,-2,2}];
g3=Plot[x
2
,{x,-2,2}];
g4=Plot[-x
2
,{x,-2,2}];
GraphicsArray[{g1,g2,g3,g4}]


GraphicsArray[{{g1,g2},{g3,g4}}]
Page 95
EXAMPLE 6 Delete the semi colons (;)
Plot[x
3
, {x, 10, 10}] Plot[x
3
, {x, 10, 10}, PlotRange All]

EXAMPLE 7 Delete the semi colons (;)
Plot[x
2
, {x, 5, 5}] Plot[x
2
, {x, 5, 5},AspectRatio Automatic]


Page 96
EXAMPLE 8 Delete the se i colons (;) m
Plot[{-Sqrt[9 - x
2
], Sqrt[9 - x
2
]}, {x, -3, 3}]
Plot[{-Sqrt[9 - x
2
], Sqrt[9 - x
2
]}, {x, -3, 3}, AspectRatio Automatic]

Page 97
EXAMPLE 9 Delete the semi colons (;)
Plot[5 + x
4
, {x, 1, 2}]
Plot[5+x
4
, {x, 1, 2}, AxesOrigin {0, 0}]
0.5 1.0 1.5 2.0
5
10
15
20


The third example should be ignored as Mathematica 6 fixes the axis problem automatically.

Page 98
EXAMPLE 10 Delete the semi colons (;)
Plot[{Sin[x], Sin[2x], Sin[3x]}, {x, -, },
PlotStyle {GrayLevel[0.0], GrayLevel[0.5], GrayLevel[0.8]}]

EXAMPLE 11 Delete the semi colons (;)
Plot[{x
2
, 2x
2
, 3x
2
}, {x, -3, 3},
PlotStyle {Dashing[{.01}], Dashing[{.03}], Dashing[{.03, .1}]}]
Page 99
EXAMPLE 12 Delete the semi colons (;)
Plot[{x
2
, 2x
2
, 3x
2
}, {x, -3, 3}, PlotStyle
{Thickness[.005], Thickness[.01], Thickness[.02]}]

EXAMPLE 13 Delete the semi olons (;) c
Plot[{x
2
, 2x
2
, 3x
2
}, {x, -3, 3},
PlotStyle {RGBColor[1, 0, 0], RGBColor[0, 1, 0],
RGBColor[0, 0, 1]}]

Mathematica makes it easy to compute the RGB "formula" for custom colors. Simply go to
InsertColor and click on the color of your choice. The exact RGB combination for the color
selected will be placed into your Mathematica notebook at the cursor position.

Page 100
Ignore the last paragraph. Color names are now available in the new function Col or Dat a.
To see a list of all available colors type ColorData["Legacy","Names"]

Page 101
EXAMPLE 14
ColorData["Legacy","AliceBlue"]
RGBColor[0.941206,0.972503,1.]

EXAMPLE 15 Delete the semi colons (;)
Plot[Sin[x], {x, 0, 2},
AxesLabel{"Values of x", "Values of sin x"}]

EXAMPLE 16 Delete the semi colon (;) and replace <<Graphics`Legend with
<<PlotLegends`

<<PlotLegends`
Plot[{x
2
, 2x
2
, 3x
2
}, {x, -3, 3}, PlotStyle{Dashing[{.01}],
Dashing[{.03}], Dashing[{.03, .08}]}, PlotLegend{x
2
, 2x
2
, 3x
2
}]

Page 102
EXAMPLE 17 Delete the semi colon (;)
Plot[
1
x 1
2
+
, {x, 3, 3}, Frame True, Axes False]

EXAMPLE 18 Delete the semi colon (;)
Plot[Sin[x], {x, 0, 2},
GridLines {{0, /2, , 3/2, 2}, Automatic}]

Page 103
EXAMPLE 19 Delete the semi colons (;)


+
2
2
x
Plot[ ,{x, 3,3}]
x 1


+
2
2
x
Plot[ ,{x, 3,3},Ticks None]
x 1


+
2
2
x
Plot[ ,{x, 3,3},Ticks {{ 3, 3}, Automatic}]
x 1


Fi l l edPl ot is no longer available. Plot now has a new option, Fi l l i ng, which will plot a
shaded graph. Ignore everything below the three graphs on p.103. Replace with the following:

The option Fi l l i ng will plot a shaded graph.

Filling Axis fills from the curve to the x-axis
Filling Top fills from the curve to the top of the plot
Filling Bottom fills from the curve to the bottom of the plot
Filling y fills from the curve to value y in the vertical direction
Filling {m} fills to the m
th
curve
Filling {m{n}} fills from the m
th
curve to the n
th
curve
Filling {m{y,g}} fills from the m
th
curve to the value y using graphic directive g
Filling {m{{n},g}} fills from the m
th
curve to the n
th
curve using graphic
directive g

Page 104
EXAMPLE 20
Plot[1-x
2
,{x,-1,1},FillingAxis]
Plot[{1-x
2
,2-2x
2
},{x,-1,1},Filling{1{2}}]
Plot[{1-x
2
,2-2x
2
,3-3x
2
},{x,-1,1},Filling{1{2},2{3}}]




Page 104
The option Fi l l s is no longer available. Ignore this description below the three graphs in
Example 20 .

Example 21
Plot[{1-x
2
,2-2 x
2
,3-3 x
2
},{x,-1,1},
Filling{1{0,Orange},1{{2},Green},2{{3},Yellow}}]

-1.0 -0.5 0.5 1.0
0.5
1.0
1.5
2.0
2.5
3.0


Page 105
4.1 Delete the semi colon (;)
Plot[x Exp[x],{x,0,5}]

4.2 Delete the semi colon (;)
Page 105
Plot[Abs[1-Abs[x]], {x, -3, 3}]

4.3 Delete the semi colon (;)
f[x_]=1/(Sqrt[2*Pi])*Exp[(-1/2)x^2]; or f[x_]
1
2
Exp[
1
2
x ];
2
=


Plot[f[x], {x, 3, 3}]
4.4 Delete the semi colon (;)
Plot[{Sin[x], 2Sin[x], 3Sin[x]}, {x, 2, 2}]

4.5


=
=
=

2
g1 Plot[x ,{x,0,2}];
g2 Plot[ x ,{x,0,4}];
g3 Plot[x,{x,0,4},PlotStyle Dashing[{0.01}]];
Show[g1, g2,g3, AspectRatio Automatic]

Page 106
4.6 Delete the semi colon (;)
Plot[{x
2
, x
2
, x
2
Sin[10x]}, {x, 2, 2}, Frame True]

4.7 <<PlotLegends`
Plot[{ChebyshevT[2,x],ChebyshevT[3,x],ChebyshevT[4, x]},
{x, -2, 2}, PlotStyle {GrayLevel[0], GrayLevel[.4],
GrayLevel[.7]}, PlotLegend {T2,T3,T4}]

(ALTERNATE SOLUTION)
<<PlotLegends`
Plot[{ChebyshevT[2,x],ChebyshevT[3,x],ChebyshevT[4,x]},
{x, -2, 2}, PlotStyle {Red,Green,Blue},
PlotLegend {T2,T3,T4}]


Page 108

4.8 g1=Plot[1 + Sin[x], {x, 0, 2}];
g2=Plot[2 + Sin[x], {x, 2, 4}];
g3=Plot[3 + Sin[x], {x, 4, 6}];
Show[g1, g2, g3,PlotRange Automatic]
5 10 15
1
2
3
4



EXAMPLE 22 Delete the semi colon (;)

g1=Graphics[Circle[{0, 0}, 1]];
g2=Graphics[Line[{{-1, -1}, {-1, 1}, {1, 1}, {1, -1}, {-1, -1}}]];
g3=Graphics[Polygon[{{-1, 0}, {0, 1}, {1, 0}, {0, -1}}]];
Show[g1, g2, g3, AspectRatio Automatic]
Page 109
EXAMPLE 23 Delete the semi colon (;)
ParametricPlot[{t
3
-2t, t
2
-t}, {t, -2, 2}]


-4 -2 2 4
1
2
3
4
5
6





EXAMPLE 24 Delete the semi colon (;)
x[t_] = Cos[t]- Cos[100t]Sin[t];
y[t_] = 2 Sin[t]- Sin[100t];
ParametricPlot[{x[t],y[t]},{t,0,2},PlotPoints50,
AspectRatio]0.5;

Page 110
Disregard all references to I mpl i ci t Pl ot . It has been replaced by Cont our Pl ot in version 6.

Implicit functions can be plotted with the Cont our Pl ot command.

ContourPlot[equation, {x, xmin, xmax}, {y, ymin, ymax}] plots
equation by treating the equation as a function in three-dimensional space, and
generates a contour of the equation cutting through the plane where z equals zero.

equation must be of the form l hs==r hs. Note the double equal sign in the middle.
By default, Aspect Rat i o 1, AxesFal se and Fr ameTr ue.


EXAMPLE 25
ContourPlot[x
2
y
2
= =(y+1)
2
(4-y
2
),{x,-10,10},{y,-2,2},
AspectRatioAutomatic,FrameFalse,AxesTrue]
EXAMPLE 26
ContourPlot[x
3
+y
3
= =6 x y,{x,-4,4},{y,-6,6}]


-4 -2 0 2 4
-6
-4
-2
0
2
4
6



Ignore the last paragraph on page 110.
Page 111
EXAMPLE 27
ContourPlot[Cos[x-y] = = y Sin[x],{x,-2,2},{y,-2,2},
AxesTrue,FrameFalse]


Disregard the sentence immediately under the diagram of example 27


EXAMPLE 28 Delete the semi colon (;)
PolarPlot[3 (1 Cos[]), {, 0, 2}]


Page 112
EXAMPLE 29 Delete the semi colon (;) and omit <<Gr aphi cs`Gr aphi cs`
PolarPlot[{1, Sin[3]}, {, 0, 2}]

4.9 g1=Plot[x
2
-9,{x,-4,4}];
g2=Graphics[Circle[{0,0},3]];
g3=Graphics[Text["CIRCLE IN A PARABOLA",{0,6}]];
Show[g1,g2,g3,AspectRatio Automatic]

Page 113
4.10 Delete the semi colon (;)
ParametricPlot[{

Sin[], 1


Cos[]}, {, 0, 8}]

4.11 Delete the semi colon (;) in the Par amet r i cPl ot commands

ParametricPlot[{r -a Sin[], r-a Cos[]},{,0,8},
AxesOrigin {0,0},AspectRatio 1]


Page 114
4.12 Delete the semi colon (;) in the Par amet r i cPl ot commands.
Aspect Rat i o Aut omat i c is no longer necessary.

ParametricPlot[{x[], y[]}, {, 0, 2}]

ParametricPlot[{x[], y[]}, {, 0, 10}]


Page 115

4.13 Use Cont our Pl ot and delete the semi colon (;)

ContourPlot[y
2
x
3
(2-x),{x,0,2},{y,-1.4,1.4},
FrameFalse,AxesTrue]

Page 116
4.15 (cont) Delete the semi colon (;) and omit <<Gr aphi cs`Gr aphi cs`

PolarPlot[, {, 0, 10}]
PolarPlot[, {, - 10, 10}]

4.16 g1=PolarPlot[Sin[2 ],{,0,2 },Ticks False,
PlotLabel "n = 2"];
g2=PolarPlot[Sin[3 ],{,0,2 },Ticks False,
PlotLabel "n = 3"];
g3=PolarPlot[Sin[4 ],{,0,2 },Ticks False,
PlotLabel "n = 4"];
g4=PolarPlot[Sin[5 ],{,0,2 },Ticks False,
PlotLabel "n = 5"];
GraphicsArray[{{g1,g2},{g3,g4}}]

Page 117
4.17 Delete the semi colon (;) and omit <<Gr aphi cs`Gr aphi cs`

PolarPlot[{1-Cos[],1},{,0,2 }]


Page 118
4.18 Delete the semi colons (;) in the Li st Pl ot commands

squares = Table[k
2
, {k, 1, 20}];
ListPlot[squares];
ListPlot[squares, PlotStyle PointSize[.02]];

Fi l l edLi st Pl ot is no longer available in Mathematica 6. The text beginning with As an
alternative should be replaced with:

ListLinePlot[{y1, y2, ...}] plots a line through the points whose
ycoordinates are y1, y2, . . . The xcoordinates are taken to be the positive
integers, 1, 2, . . .

ListLinePlot[{{x1, y1}, {x2, y2}, ..., }] plots lines through the
points (x1, y1), (x2, y2), . . .

ListLinePlot[lst1,lst2, . . .] plots multiple sets of lines through
points defined by l st 1, l st 2, . . .

If we wish to create a filled polygon which describes the data, we can use the
option Fi l l i ngAxi s in the Li st Li nePl ot command.

EXAMPLE 31
randomintegers = Table[Random[Integer, {1, 20}], {k, 1, 30}];
ListPlot[randomintegers]
ListLinePlot[randomintegers, FillingAxis]

Page 119
Disregard the paragraphs at the top of the page. Mul t i pl eLi st Pl ot has been replaced by
Li st Pl ot and Li st Li nePl ot



EXAMPLE 32
lst1 = {{0, -4}, {1, 0}, {1, 3}, {5, 2}, {7, 7}};
lst2 = {{0, -1}, {2, -1}, {3, -5}, {4, 0}, {7, 5}};
lst3 = {{0, 0}, {3, 6}, {5, -4}, {6, 1}, {7, 1}};
ListPlot[{lst1, lst2, lst3}]
ListLinePlot[{lst1, lst2, lst3}]

1 2 3 4 5 6 7
-4
-2
2
4
6

1 2 3 4 5 6 7
-4
-2
2
4
6


(the plots of l st 1, l st 2 and l st 3 are distinguished by different colors)



Different types of bar graphs can be drawn with Mathematica , using commands which are
located in the package BarCharts`

Page 120
EXAMPLE 33
<<BarCharts`
dataset1={5,1,2,8,5};

dataset2={1,6,3,5,2};

g1=BarChart[dataset1,BarStyle{GrayLevel[.7]}];

g2=BarChart[dataset1,dataset2,
BarStyle{GrayLevel[.7],GrayLevel[0]}];

g3=StackedBarChart[dataset1,dataset2,
BarStyle{GrayLevel[.7],GrayLevel[0]}];

g4=PercentileBarChart[dataset1,dataset2,
BarStyle{GrayLevel[.7],GrayLevel[0]}];

GraphicsArray[{{g1,g2},{g3,g4}}]
Pages 120-121
EXAMPLE 34
<<BarCharts`

dataset1={5,1,2,8,5};

dataset2={1,6,3,5,2};

g1=BarChart[dataset1,dataset2,
BarLabels {"Mon.","Tues.","Wed.","Thurs.","Fri."},
BarSpacing .1,BarGroupSpacing .5,
BarStyle {GrayLevel[.7],GrayLevel[0]}];

g2=BarChart[dataset1,dataset2,
BarLabels {"Mon.","Tues.","Wed.","Thurs.","Fri."},
BarSpacing .1,BarGroupSpacing .5,
BarOrientation Horizontal,
BarStyle {GrayLevel[.7],GrayLevel[0]}];

GraphicsArray[{g1,g2}]

Page 121
Pie Charts may be constructed using the PieChart command, located in PieCharts.

EXAMPLE 35
<< PieCharts`
datalist = {1.5, 3, 4.5, 9};
PieChart[datalist, PieStyle
{GrayLevel[.6], GrayLevel[.7], GrayLevel[.8], GrayLevel[.9]}]

Page 122
EXAMPLE 36
<<PieCharts`

datalist={1.5,3,4.5,9};

labellist={"First","Second","Third","Fourth"};

g1=PieChart[datalist,
PieLabels labellist,
PieExploded All,
PieStyle
{GrayLevel[.6],GrayLevel[.7],GrayLevel[.8],GrayLevel[.9]}];

g2=PieChart[datalist,
PieLabels labellist,
PieExploded {2,3},
PieStyle
{GrayLevel[.6],GrayLevel[.7],GrayLevel[.8],GrayLevel[.9]}];

GraphicsArray[{g1,g2}]
4.18 Delete the semi colon (;)
ListPlot[primelist]

Page 123
4.19 Delete the semi colon (;)
ListPlot[lst, PlotJoinedTrue]

4.20 lst1=Table[n!,{n,1,5}];
lst2=Table[2
n
,{n,1,5}];
ListPlot[{lst1,lst2}]

2 3 4 5
20
40
60
80
100
120


ListLinePlot[{lst1,lst2}]
1 2 3 4 5
10
20
30
40
50
60
70


(points and lines are distinguished by different colors)

Page 124
4.21 <<BarCharts`
months={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug",
"Sep","Oct","Nov","Dec"};

salesdata={13.2,15.7,17.4,12.6,19.7,22.6,20.2,18.3,
16.2,15.0,12.1,8.6};

BarChart[salesdata,
BarLabels months,
BarValues True,
PlotRange {0,25},
TextStyle {FontFamily Helvetica,FontSize 9}]

Page 125
4.22 <<PieCharts`

months={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug",
"Sep","Oct","Nov","Dec"};

salesdata={13.2,15.7,17.4,12.6,19.7,22.6,20.2,18.3,
16.2,15.0,12.1,8.6};

PieChart[salesdata,PieLabels months,
PieStyle {GrayLevel[.8]}]


4.4 ANIMATION
Animation effects can be produced quickly and easily through the use of the Ani mat e
command. This command displays several different graphics displays rapidly in succession,
producing the illusion of movement.

The form of the command is

Animate[graphics_command[k], {k,m,n,i}]

where graphics_command[k] is any graphics command with parameter k which varies
from m to n in increments of i (optional; if omitted, i varies continuously from m to n )

The following example gives an interesting animated description of the behavior of the odd
powers of x
n
as n gets larger.

EXAMPLE 37

Animate[Plot[x
k
, {x, -1, 1},
PlotRange {-1, 1}, Ticks False], {k, 1, 19, 2}]




The speed of the animation and the direction are easily controlled by clicking on the

, ,
and buttons. The animation can be paused, using the button.

The graphics command may involve two or more parameters. In this case the form of the
command is

Animate[graphics_command[k1,k2,...],
{k1,m1,n1,i1},{k2,m2,n2,i2]...

Each parameter can be controlled independently (speed, direction, pause).

EXAMPLE 38

Animate[Plot[a Sin[b x],{x,0,2},
PlotRange{-10,10}],{a,0,10},{b,0,10}]



EXAMPLE 39
This animation shows a circle of varying radius whose center varies from (-1, -1) to (1,1). Pause
each variable (x, y, r ) to see the effect.

Animate[Graphics[Circle[{Sin[x],Cos[y]},r],AxesTrue,
PlotRange{{-2,2},{-2,2}}],
{x,0,2 },{y,0,2 },{r,0,1}]



SOLVED PROBLEMS

4.23 Construct an animation of the spiral of Archimedes, r = as varies from 8 to 10 .
SOLUTION
Animate[PolarPlot[, {, 0, 8 + }, Ticks False,
PlotRange {{-10, 10}, {-10, 10}}], {, 0, 2, /6}]







4.24 Construct an animation of a point "rolling" along a sine curve from 0 to 2.

SOLUTION
First we construct the sine curve.
sincurve = Plot[Sin[x], {x, 0, 2}, Ticks False];





Now we animate the sequence of points as disks with radii 0.05.

Animate[Show[sincurve, Graphics[Disk[{x, Sin[x]}, 0.05]],
PlotRange {{0, 2}, {-1, 1}},
AspectRatio Automatic], {x, 0, 2Pi, Pi/6}]

.



Chapter 5

Note: The default settings for 3-dimensional graphics have been changed somewhat in
Mathematica 6. Hence, graphs may look slightly different than in the text.

Page 128
EXAMPLE 1 Delete the semi colon (;)after the Pl ot 3D command.
Page 129
EXAMPLE 2 Delete the semi colons (;) after the Pl ot 3D commands.
Page 130
EXAMPLE 3 Delete the semi colons (;) after the Pl ot 3D commands.
Shadi ng is no longer an option in Mathematica 6 so the third example should
be deleted.
Page 131
EXAMPLE 4 Delete the semi colons (;) after the Pl ot 3D commands.
Shadi ng is no longer an option in Mathematica 6 so the second example should
be deleted.

Hi ddenSur f ace is no longer an option in Mathematica 6. It has been replaced
by the option PlotStyleFaceForm[]. The third example should read:

Plot3D[1-y
2
,{x,-5,5},{y,- 5,5}, BoxRatios{1, 1, 2},
BoxedFalse, AxesFalse,
PlotStyle FaceForm[]]

Pages 132-133
The Viewpoint selector has been eliminated in Mathematica 6. Thus all references to it in the
text should be ignored. A three dimensional graphics object may now be examined from any
viewpoint by clicking and dragging the mouse over the object.

Page 133
EXAMPLE 5 Delete the semi colons (;) after the Pl ot 3D commands.

Page 134
EXAMPLE 6 Delete the semi colons (;) after the Pl ot 3D commands.

Page 135
EXAMPLE 7 Delete the semi colons (;) after the Par amet r i cPl ot 3D commands.

Cyl i ndr i cal Pl ot 3D has been replaced by Revol ut i onPl ot 3D and both are now in the
kernel so no packages have to be loaded in order to access them.

RevolutionPlot3D[z[r, ], {r, rmin, rmax}] generates a plot of the surface
z z r = ( , ) described in cylindrical coordinates completely around the z-axis..
RevolutionPlot3D [z[r, ], {r, rmin, rmax}, {, min, max}]
generates a plot of the surface z z r = ( , ) for mi n max


EXAMPLE 8 Delete the semi colons (;) after the Pl ot 3D Commands
RevolutionPlot3D[r,{r,0,1},BoxRatios {1,1,1}]
SphericalPlot3D[1,{t,0,2 },{,0,}, BoxRatios {1,1,1}]

Page 136
5.1 Delete the semi colons (;) after the Pl ot 3D Command.
5.2 Delete the semi colons (;) after the Pl ot 3D Commands.
Page 137
5.3 Delete the semi colon (;) after the Pl ot 3D Command.
5.4 Delete the semi colon (;) after the Pl ot 3D Command.
Shading is no longer available in Mathematica 6
Plot3D[Abs[1-x
2
-y
2
],{x,-1,1},{y,-1,1},
AxesFalse, BoxedFalse]



Page 138
5.5 paraboloid = Plot3D[x
2
+ y
2
, {x, - 5, 5}, {y, - 5, 5}];
plane = Plot3D[12 - y, {x, - 5, 5}, {y, - 5, 5}];
Show[paraboloid, plane, BoxRatios {1, 1, 1},
PlotRange {0,20}]

Show[paraboloid,plane,BoxRatios {1,1,1},
ViewPoint{1.126,-1.800,2.634}, PlotRange{0,20}]
5.6 g1=ParametricPlot3D[{Cos[5t],Sin[3t],Sin[t]},{t,0,2}];
g2=ParametricPlot3D[{Cos[3t],Sin[3t],Sin[t]},{t,0,2}];
g3=ParametricPlot3D[{Cos[2t],Sin[5t],Sin[2t]},{t,0,2 }];
GraphicsArray[{g1,g2,g3}]

Page 139
5.7 Delete the semi colon (;) after the Par amet r i cPl ot Pl ot 3D command.
5.8 Delete the semi colon (;) after the Par amet r i cPl ot Pl ot 3D command.

Page 140
5.9 Delete the semi colon (;) after the Par amet r i cPl ot Pl ot 3D command.
5.10 cone=RevolutionPlot3D[3 r,{r,0,3},BoxRatios{1,1,1}];
hemisphere=RevolutionPlot3D[9 9 r
2
+ ],{r,0,3},
BoxRatios{1,1,.5}];

GraphicsArray[{cone,hemisphere}]
Show[cone,hemisphere,PlotRangeAll,BoxRatios {1,1,2}]

Page 141
5.11 SphericalPlot3D[1+Sin[4]Sin[],{,0,},{,0,2}]

Page 142
EXAMPLE 9 Delete the semi colons (;) after the Densi t yPl ot commands.

DensityPlot[f[x, y], {x, xmin, xmax}, {y, ymin, ymax}] draws
a density plot of f (x,y) in a rectangle determined by xmi n, xmax, ymi n, and
ymax. The option Mesh True draws a rectangular mesh which separates the
shaded regions.

Pages 142-143
EXAMPLE 10
DensityPlot[x
2
+ y
2
,{x,- 10,10},{y,- 10,10}, Mesh True];
DensityPlot[x
2
+ y
2
, {x, - 10, 10}, {y, - 10, 10}];


Page 143
In Mathematica 6, MeshRange has been replaced by Dat aRange

DataRange {{xmin, xmax}, {ymin, ymax}} labels the x and y axes
from xmi n to xmax and from ymi n to ymax. respectively.

EXAMPLE 11 lst=Table[Random[],{x,1,10},{y,1,10}];
ListContourPlot[lst,DataRange {{-5,5},{3,7}}]
ListDensityPlot[lst,DataRange {{-5,5},{3,7}}]



EXAMPLE 12
ContourPlot3D[z-x
2
-y
2
,{x,-5,5},{y,-5,5},{z,0,10},
Contours {0.,5.},BoxRatios {1,1,1}]

Page 144 Delete the last description and replace with the following:

ListPlot3D[array, MeshShading shades]generates a surface shaded
according to the descriptions in the array shades (Gr ayLevel , Hue,
RGBCol or , etc). If ar r ay has dimensions mn, then shades must have
dimension ( m1) ( n1) .
Page 145
EXAMPLE 13
lst={{1,5,2,2},{3,6,1,4},{3,1,7,2}};
shades={{Red,Blue,Green},{Cyan,Yellow,Magenta}};
ListPlot3D[lst]
ListPlot3D[lst,MeshShadingshades]


Pages 145-146
EXAMPLE 13 MeshRange has been replaced by Dat aRange

lst=Table[x
2
+y
2
+z
2
,{z,-1,1,.25},{y,-1,1,.25},{x,-1,1,.25}];

ListContourPlot3D[lst,DataRange{{-1,1},{-1,1},{-1,1}},
Contours{.5,1.5},Axes True]


5.12 Delete the semi colons (;). PlotPoints50 may also be safely eliminated.


Plot3D[Sin[x]+Sin[y],{x,-4,4},{y,-4,4}]
ContourPlot[Sin[x]+Sin[y],{x,-4,4},{y,-4,4}]

Pages 146-147
5.13 Delete the semi colons (;). PlotPoints50 may also be safely eliminated.

ContourPlot[Sin[x y], {x, - , }, {y, - , }]
DensityPlot[Sin[x y], {x, - , }, {y, - , }]


Page 147
5.14 Delete the semicolons (;) after the Li st Cont our Pl ot commands.


Page 148
5.15 Remove <<Graphics`ContourPlot3D` Delete the semicolons (;) after the
Li st Cont our Pl ot commands. The option PlotPoints5 may be safely removed.
The default for BoxRatios is {1,1,1}


ContourPlot3D[5x
2
+ 2y
2
+ z
2
, {x, - 5, 5}, {y, 0, 5},
{z, - 5, 5},Contours {1, 4, 9, 16, 25}]

5.16 Delete the semicolon (;) after the Li st Pl ot 3D command.

Page 149
5.17 Delete <<Gr aphi cs`Cont our Pl ot 3D` Replace MeshRange with Dat aRange
and delete the semicolon (;) in the Li st Cont our Pl ot 3D command.

lst=Table[x
2
-y
2
, {z,5,5}, {y,-5,5}, {x,-5,5}];
ListContourPlot3D[lst,Contours{0.,2.,5.},
AxesTrue, DataRange{{-5,5},{-5,5},{5,5}}]

The first sentence in section 5.3 should be changed. <<Bar Char t s` should be loaded to
access the Bar Chart commands. Also XSpaci ng and YSpaci ng have been replaced by
Bar Spaci ng which controls the spacing in both the x and y directions.

Page 150
EXAMPLE 15
<<BarCharts`
lst={{1,2,3,4},{5,6,7,8},{9,10,11,12}};
BarChart3D[lst,AxesLabel{"x","y","z"}]
BarChart3D[lst,BarSpacing.5,
AxesLabel{"x","y","z"}]


Pl ot J oi ned is no longer an option for the Scat t er Pl ot 3D command.

EXAMPLE 16
lst=Table[Random[Integer,{1,10}],{50},{3}];
ListPointPlot3D[lst]
ListPointPlot3D[lst,PlotStyle PointSize[.02]]


2
4
6
8
10
2
4
6
8
10
0
5
10

2
4
6
8
10
2
4
6
8
10
0
5
10


Page 151
EXAMPLE 17 Delete <<Gr aphi cs`Gr aphi cs3D` and delete the semicolon (;) in the
Li st Sur f acePl ot 3D command.


Sur f aceof Revol ut i on has been replaced by Revol ut i onPl ot 3D which is now in the
kernel and does not have to be loaded as a separate package.

Page 152
EXAMPLE 18
RevolutionPlot3D[x
2
,{x,0,3},BoxRatios {1,1,1}]
RevolutionPlot3D[x
2
,{x,0,3},{,0,3 /2},
BoxRatios {1,1,1}]

EXAMPLE 19
SurfaceOfRevolution is no longer available. RevolutionPlot3D does not allow the
axis of rotation to be other than the z-axis.

Page 153
5.18 Bar Char t 3D is now located in the package Bar Char t s`

<<BarCharts`
c[n_,k_]
n!
k!(n k)!
=

; Note: C[ n, k] =0 if k >n
lst = Table[c[n, k], {k, 0, 5}, {n, 0, 5}];
BarChart3D[lst, AxesLabel {"k", "n", "c[n, k]"},
Ticks {Range[0, 5], Range[0, 5], Range[0, 10]}]

Pages 153-154
5.19 Scat t er Pl ot 3D has been replaced by Li st Poi nt Pl ot 3D

lst=Table[{Sin[2t],Cos[2t],t},{t,0,10,.25}];
ListPointPlot3D[lst,PlotStylePointSize[.03],
AxesFalse, BoxRatios{1,1,3}]

5.20 SurfaceOfRevolution is no longer available. RevolutionPlot3D does not
allow the axis of rotation to be other than the z-axis.

RevolutionPlot3D[Sin[x],{x,0,2 },TicksFalse,
AxesLabel{"x","y","z"}]


5.21 SurfaceOfRevolution is no longer available. RevolutionPlot3D does not
allow the axis of rotation to be other than the z-axis.


Page 155
EXAMPLE 20 The Show command is no longer necessary in Mathematica 6.

Graphics3D[{Cuboid[{0,0,0}],Cuboid[{1,1,1},{2,3,4}]},
AxesTrue,
Ticks {{0,1,2},{0,1,2,3},{0,1,2,3,4}}]
EXAMPLE 21 The Show command is no longer necessary in Mathematica 6.

vertices={{0,0,0},{2,2,0},{0,2,1},{0,0,2}};
Graphics3D[Polygon[vertices],Axes True,
Ticks {{0,1,2},{0,1,2},{0,1,2}}]

Page 156
EXAMPLE 22 Only Cylinder and Sphere are available in the Mathematica 6 kernel.
Cone, DoubleHelix, Helix, OutlinePolygons, PerforatePolygons,
RotateShape, ShrinkPolygons, Sphere, Torus, TranslateShape, and
WireFrame were available in previous versions of Mathematica and are now available on the
web at library.wolfram.com/infocenter/MathSource/6793. Torus and MoebiusStrip are
available in the kernel function ExampleData.

The Show command is no longer necessary in Mathematica 6.

Page 157
EXAMPLE 23 WireFrame was available in previous versions of Mathematica and is now
available on the web at library.wolfram.com/infocenter/MathSource/6793

ExampleData[{"Geometry3D","Torus"}]

Page 158
EXAMPLE 24 Only Cylinder and Sphere are available in the Mathematica 6 kernel.
Cone, DoubleHelix, Helix, OutlinePolygons, PerforatePolygons,
RotateShape, ShrinkPolygons, Sphere, Torus, TranslateShape, and
WireFrame were available in previous versions of Mathematica and are now available on the
web at library.wolfram.com/infocenter/MathSource/6793.

The Show command is no longer necessary in Mathematica 6.

Page 159
Cyl i nder has been changed in Mathematica 6. The new form is:

Cylinder[{{x1,y1,z1},{x2,y2,z2}},r] represents a cylinder of
radius r whose axis is the line connecting points (x1, y1, z1 ) and (x2, y2, z2 ).

Cylinder[{{x1,y1,z1},{x2,y2,z2}}] represents a cylinder of radius
1 whose axis is the line connecting points (x1, y1, z1 ) and (x2, y2, z2 ).

Cyl i nder can be viewed using Graphics3D

5.22 cyl1=Graphics3D[Cylinder[{{0,-1,0},{0,1,0}},.2]];
cyl2=Graphics3D[Cylinder[{{0,0,-1},{0,0,1}},.2]];
Show[cyl1,cyl2]


Spher e has been changed in Mathematica 6. The new form is:

Sphere[{{x1,y1,z1},r] represents a sphere of radius r whose center is the
point (x, y, z ).

Sphere[{{x1,y1,z1}] represents a sphere of radius 1 whose center is the
point (x, y, z ).

Spher e can be viewed using Graphics3D

5.23 In order for the cylinder to be visable, we use the Opaci t y directive with Spher e

Opaci t y[ a] specifies that graphical objects which follow are to be displayed,
if possible, with opacity a, 0 a 1

cyl=Graphics3D[Cylinder[{{0,0,-1},{0,0,1}},.2]];
sphere=Graphics3D[{Opacity[.5],Sphere[{0,0,0}]}];
Show[cyl,sphere]





Page 160
5.24 The commands Tor us, Tr ansl at eShape and Rot at eShape are no longer
available in Mathematica 6. They are included in the package Shapes` which can be
downloaded from the web at library.wolfram.com/infocenter/MathSource/6793. The
downloaded package, Shapes.m, should be placed in the folder

C:\Program Files\Wolfram Research\Mathematica\6.0\AddOns\LegacyPackages

Note: Warnings will be displayed when loading this package. They may be safely
ignored.

<<Graphics`Shapes`
tor1 = Graphics3D[Torus[]];
tor2 = Graphics3D[TranslateShape[
RotateShape[Torus[], 0, /2, /2], {0, .5, 0}]];
Show[tor1, tor2, ViewPoint {1.75, - 2.8, 0.75},
Boxed False]


5.25 The Hel i x command is no longer available in Mathematica 6. It can be downloaded
from the web at library.wolfram.com/infocenter/MathSource/6793. The downloaded
package, Shapes.m, should be placed in the folder

C:\Program Files\Wolfram Research\Mathematica\6.0\AddOns\LegacyPackages

Note: Warnings will be displayed when loading this package. They may be safely
ignored.

<<Graphics`Shapes`
helx = Helix[];
Animate[Graphics3D[RotateShape[helx,k,0,0],
BoxedFalse],{k,0,11 /6}]

Chapter 6
Page 165
Example 11 Miscellaneous`RealOnly` was available as an add-on package in previous
versions of Mathematica and is now available on the web at
library.wolfram.com/infocenter/MathSource/6771.

Page 169
6.8 Delete the semicolon (;) at the end of the Pl ot command.

Page 170
Example 16 Delete the semicolon (;) at the end of the Pl ot command.

Page 174
Example 26 ImplicitPlot has been replaced by ContourPlot
ContourPlot[{Exp[x]+Log[y]==2,Sin[x]+Cos[y]==1},
{x,0,2},{y,0,3},PlotRange{0,3}]

6.11 Delete the semicolon (;) at the end of the Pl ot command.

Page 176
6.13 Delete the semicolon (;) at the end of the Pl ot command.

6.14 g1=Graphics[Circle[{0,0},5]];
g2=Plot[x
2
+x-10,{x,-5,5}];
Show[g1,g2,PlotRange{-10,10},AxesTrue]

Page177
6.15 <<Gr aphi cs`Gr aphi cs is unnecessary

limacon=PolarPlot[5-4 Cos[t],{t,0,2 }];
parabola=Plot[x
2
,{x,-3,3}];
Show[limacon,parabola,PlotRangeAll]

6.16 I mpl i ci t Pl ot has been replaced by Cont our Pl ot
spiral=PolarPlot[,{,0,6 }];
ellipse=ContourPlot[4x
2
+9y
2
400,
{x,-10,10},{y,-20,20},
ContourStyle Thickness[.01]];

Show[spiral,ellipse]
Chapter 8
Page 200
EXAMPLE 12 Delete the semicolon (;) at the end of the Pl ot command.

Page 202
8.11 <<Gr aphi cs`Legend` is obsolete

<<PlotLegends`
f[x_]=x
4
-50 x
2
+300;
Plot[{f[x],f'[x]},{x,-10,10},
PlotLegend{"f(x)", "f'(x)"},
PlotRange{-1200,1200},
PlotStyle{GrayLevel[0],Dashing[0.015]}]

Page 203
8.12 Delete the semicolon (;) at the end of the Pl ot command.

Page 204
8.14 Delete the semicolon (;) at the end of the Pl ot command.

Page 205
8.15 Delete the semicolon (;) at the end of the Pl ot command.

Page 208
EXAMPLE 16 Delete the semicolon (;) at the end of the Pl ot command.

8.16 Delete the semicolon (;) at the end of the Pl ot command.

Page 210
8.18 circ=ContourPlot[x
2
+y
2
-2 x-4 y==0,{x,-5,5},{y,-1,5}];
p=Graphics[{PointSize[.02],Point[{4,4}]}];
Show[circ,p,AspectRatioAutomatic,FrameFalse]

Page 216
8.23 Delete the semicolon (;) at the end of the Pl ot command.

Page 217
8.26 Delete the semicolon (;) at the end of the Pl ot command.

Chapter 9
Page 224
9.7 f[x_]=1-x^2;
g[x_]=x^4-3 x^2;
Plot[{f[x],g[x]},{x,-2,2},Filling {1{2}}]


Page 228
9.14 Delete the semicolon (;) at the end of the Pl ot command.

Page 229
9.15 (cont) Delete the semicolon (;) at the end of the Pl ot command.

Page 230
9.17 Delete the semicolon (;) at the end of the Pl ot command.

Page 231
9.18 (cont) Delete the semicolon (;) at the end of the Pl ot command.

Page 232
9.19 (cont) Delete the semicolon (;) at the end of the Pl ot command.

Page 233
9.20 Delete the semicolon (;) at the end of the Pl ot command.

Chapter 10
Page 242
10.6 f[x_,y_] 10-x
2
-2 y
2
;
z=f[1,2]+Derivative[1,0][f][1,2](x-1)+
Derivative[0,1][f][1,2] (y-2)//Expand

g1=Plot3D[f[x,y],{x,-5,5},{y,-5,5}];
g2=Plot3D[z,{x,-5,5},{y,-5,5}];
Show[g1,g2,ViewPoint {2.330,-2.223,1.040},
PlotRangeAll]


Page 243
10.7 f[x_,y_,z_]=x
2
+y
2
+z
2
-14;
g1=Graphics3D[Sphere[{0,0,0}, 14]];
a=Derivative[1,0,0][f][1,2,3];
b=Derivative[0,1,0][f][1,2,3];
c=Derivative[0,0,1][f][1,2,3];
Solve[a(x-1)+b(y-2)+c(z-3)==0,z]
g2=Plot3D[
1
3
(14-x-2y),{x,-5,5},{y,-5,5}];
Show[g1,g2]

Page 244
EXAMPLE 6 Delete the semicolon (;) at the end of the Pl ot 3D command.


Page 246
10.8 Delete the semicolon (;) at the end of the Pl ot 3D command.

Page 247
10.9 Delete the semicolons (;) at the end of the Pl ot 3D commands.

Page 248
10.10 circ=ContourPlot[x^2+y^2-2 x-4 y0,{x,-5,5},{y,-5,5}];
p=Graphics[{PointSize[.02],Point[{4,4}]}];
Show[circ,p,AxesTrue,FrameFalse,
PlotRange{{-1.5,4},{-1.5,4.5}}]

Page 253
10.16 Delete the semicolon (;) at the end of the Pl ot command.

Page 253-254
10.17 Delete the semicolon (;) at the end of the Pl ot command.



Page 256
10.20 Ignore <<Gr aphi cs`Gr aphi cs` and delete the semicolon (;) at the end of the
PolarPl ot command.

10.21 s1=Graphics3D[Cylinder[{{1,0,0},{1,0,8}}]];
s2=Plot3D[x
2
+y
2
,{x,-2,2},{y,-2,2}];
Show[s1,s2,PlotRange{0,4},
ViewPoint{1.217,-3.125,0.447}]

Page 257
10.21 (cont) ContourPlot[(x-1)
2
+y
2
1,
{x,0,2},{y,-1,1},FrameFalse,AxesTrue]

Page 258
10.23 cone=RevolutionPlot3D[3 r,{r,0,3},{,0,2 }];
hemisphere=RevolutionPlot3D[9+
2
9 - r ,
{r,0,3},{,0,2}];
Show[cone,hemisphere,PlotRangeAll,BoxRatios{1,1,2}]

Page 259
10.24 cyl=Graphics3D[Cylinder[{{0,0,0},{0,0,9}},3]];
cap= RevolutionPlot3D[9+
2
9 - r ,
{r,0,3},{,0,2}];
Show[cyl,cap]

Chapter 11
Page 263-264
EXAMPLE 8 Delete the semicolon (;) at the end of the Pl ot command.

Page 264
EXAMPLE 8 (cont) Delete the semicolon (;) at the end of the Pl ot command.


Pl ot Vect or Fi el d has been changed to Vect or Fi el dPl ot and is located in the
package Vect or Fi el dPl ot s`


Page 265
EXAMPLE 9
<<VectorFieldPlots`
VectorFieldPlot[{-y,x},{x,-5,5},{y,-5,5},
AxesAutomatic]
EXAMPLE 10
<<VectorFieldPlots`
VectorFieldPlot[{1,2 x},{x,-1,1},{y,-1,1},
AxesAutomatic]
Pages 265-266
EXAMPLE 11
The option Headl engt h is no longer available. The option Scal eFact or 0 effectively
suppresses the vector heads.

<<VectorFieldPlots`
vf=VectorFieldPlot[{1,2 x+y},{x,-2,1},{y,-4,6},
AxesAutomatic,
ScaleFactor0,
AspectRatio1/GoldenRatio];
sols=Table[DSolve[{y'[x]2 x+y[x],y[0]k},y[x],x],
{k,-2,2}];
Do[g[k]=Plot[sols[[k,1,1,2]],{x,-2,1},
PlotRangeAll],{k,1,5}];
Show[g[1],g[2],g[3],g[4],g[5],vf]

Pages 266-267
11.1 Delete the semicolon (;) at the end of the Pl ot command.

Page 267
11.2 The option Headl engt h is no longer available.

<<VectorFieldPlots`
VectorFieldPlot[{1,xy},{x,-2,2},{y,-10,10},
AspectRatio 1/GoldenRatio,
ScaleFactor2, AxesAutomatic]




11.3 The option Headl engt h is no longer available.

<<VectorFieldPlots`
vf=VectorFieldPlot[{1,x
2
+y},{x,0,1},{y,0,12},
AxesAutomatic, ScaleFactor0.25,
AspectRatio 1/GoldenRatio];
sols=Table[DSolve[{y'[x]x
2
+y[x],y[0]k},y[x],x],
{k,0,4}];
Do[g[k]=Plot[sols[[k,1,1,2]],{x,0,1},PlotRange All],
{k,1,5}]

Show[g[1],g[2],g[3],g[4],g[5],vf]


Page 270
11.7 Delete the semicolon (;) at the end of the Par amet r i cPl ot command.
Include AspectRatio.5 to size the graph to agree with the text.

Pages 270-271
11.8 Delete the semicolon (;) at the end of the Show command.
Warning messages will look slightly different.

Clear[]
g=32;h=3;v0=100;
solution == DSolve[{x''[t]==0, y''[t]== -g,
x'[0]==v0 Cos[], y'[0] == v0 Sin[], x[0] ==0,
y[0] ==h}, {x[t], y[t]}, t];
horiz[t_] = solution[[1,1,2]]
vert[t_] = solution[[1,2,2]]
temp = Solve[horiz[t] == 200, t]
height[_] = vert[t] /. temp
NSolve[height[ Degree] == 35, ]
= 30.6357 Degree;
horiz[t_] = solution[[1,1,2]];
vert[t_] = solution[[1,2,2]];
graph1 = ParametricPlot[{horiz[t],vert[t]},{t,0,6}];
= 68.4546 Degree;
horiz[t_] = solution[[1,1,2]];
vert[t_] = solution[[1,2,2]];
graph2 = ParametricPlot[{horiz[t], vert[t]}, {t,0,6}];
graph3 = Graphics[Line[{{200,0}, {200,35}}]];
Show[graph1, graph2, graph3, PlotRange {-50, 150},
AxesLabel {"x", "y"}]

Page 272
11.10 Delete the semicolon (;) at the end of the Pl ot command.

Page 273
11.11 (cont) Delete the semicolon (;) at the end of the Pl ot command.

11.12 Delete the semicolon (;) at the end of the Pl ot command.

Page 274
11.13 Delete the semicolon (;) at the end of the Pl ot command.

Page 275
EXAMPLE 15 Delete the semicolon (;) at the end of the Pl ot command.

Page 278
11.17 Delete the semicolon (;) at the end of the Show command.

Page 279
Ignore the boxed text

Pages 280-281
EXAMPLE 20 Delete the semicolon (;) at the end of the Pl ot command.

Page 281
EXAMPLE 21 Delete the semicolon (;) at the end of the Pl ot command.

Pages 282-283
EXAMPLE 24 Delete the semicolon (;) at the end of the Pl ot command.

Pages 284-285
11.20 Delete the semicolon (;) at the end of the Pl ot command.

Pages 286-287
11.22 Delete the semicolons (;) at the end of the Pl ot commands.

Page 287
11.23 m = 1; a = 2; k = 1;
equation = m y''[t] + a y'[t] + k y[t] == Exp[-t];
(*without impulse*)
temp = LaplaceTransform[equation, t, s];
temp2 = Solve[temp, LaplaceTransform[y[t], t, s]] /.
{y'[0] 0, y[0] 0};
temp3 = temp2[[1,1,2]] // Expand;
Print["Solution Without Impulse (dashed)"]
f1[t_] = InverseLaplaceTransform[temp3, s, t]
g1 = Plot[f1[t],{t,0,10},PlotStyle Dashing[{.01}]];
equation = m y''[t] + a y'[t] + k y[t] ==
Exp[ - t] + DiracDelta[t - 1];(* with impulse *)
temp = LaplaceTransform[equation, t, s];
temp2 = Solve[temp, LaplaceTransform[y[t], t, s]] /.
{y'[0]0, y[0]0};
temp3 = temp2[[1,1,2]] // Expand;
Print["Solution With Impulse (solid)"]
f2[t_] = InverseLaplaceTransform[temp3, s, t]
g2 = Plot[f2[t], {t,0,10}];
Show[g1, g2, PlotRangeAll]

" Sol ut i on Wi t hout I mpul se ( dashed) "
2
1

- t
t
2

" Sol ut i on Wi t h I mpul se ( sol i d) "
2
1

- t
( t
2
+ 2( - 1 + t ) Heavi si deThet a[ - 1 + t ] )



Chapter 12


Page 289
InputCreate Matrix/Table/Palette has been changed to Insert Table/Matrix New
The resulting display looks like this:




Page 290
InputCreate Matrix/Table/Palette has been changed to Insert Table/Matrix New

Page 292
6.8 The output resulting from m+m is obsolete. Since mis a list, so is m+m.

m+m
{{2,2},{2,4}}

Pages 302 and beyond
Loading and using <<LinearAlgebra`MatrixManipulation` is obsolete. Several of the
functions in the old package have been replaced by new kernel functions. AppendColumns,
AppendRows, BlockMatrix are available in Mathematica kernel functions Join and
ArrayFlatten. TakeRows, TakeColumns, TakeMatrix, SubMatrix are available
in the Mathematica kernel function Take. HankelMatrix and HilbertMatrix are now
available as kernel functions. The functionality of ZeroMatrix can be obtained using the new
kernel function ConstantArray

Join[list
1
,list
2
,] concatenates lists or other expressions that share the same head.
Join[list
1
,list
2
,,n] joins the objects at level n in each of the list
i
.
ArrayFlatten[{{m
11
,m
12
,},{m
21
,m
22
,},}]
creates a single flattened matrix from a matrix of matrices m
i j
.

Page 302
Example 10 <<LinearAlgebra`MatrixManipulation is no longer necessary.

m1= ;





a b c
d e f
g h i
m2= ;





aa bb cc
dd ee ff
gg hh ii

Join[m1,m2]//MatrixForm
a b c
d e f
g h i
aa bb cc
dd ee f f
gg hh i i












Join[m1,m2,2]//MatrixForm
a b c aa bb cc
d e f dd ee f f
g h i gg hh i i







ArrayFlatten[{{m1,m2},{m2,m1}}]//MatrixForm

a b c aa bb cc
d e f dd ee f f
g h i gg hh i i
aa bb cc a b c
dd ee f f d e f
gg hh i i g h i












Page 303
Take[list,n] gives the first n elements of list.
Take[list,-n] gives the last n elements of list.
Take[list,{m,n}]gives elements m through n of list.
Take[list,seq
1
,seq
2
,] gives a nested list in which elements specified by seq
i
are taken
at level i in list.

Example 11 <<LinearAlgebra`MatrixManipulation is no longer necessary.


m
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
; =
F
H
G
G
G
G
I
K
J
J
J
J


Take[m,3]//MatrixForm
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
F
H
G
G
I
K
J
J


Take[m,{1,4},{3,5}]//MatrixForm
3 4 5
8 9 10
13 14 15
18 19 20
F
H
G
G
G
G
I
K
J
J
J
J


Take[m, {2, 3}] // MatrixForm
6 7 8 9 10
11 12 13 14 15
F
H
G
I
K
J


Take[m,4,{2,3}]//MatrixForm
2 3
7 8
12 13
17 18
F
H
G
G
G
G
I
K
J
J
J
J




Take[m,{2,3},{2,4}]//MatrixForm
7 8 9
12 13 14
F
H
G
I
K
J


Take[m,{2,3},{3,4}]//MatrixForm
8 9
13 14
F
H
G
I
K
J


Page304
UpperDiagonalMatrix and LowerDiagonalMatrix are no longer included in
Mathematica 6. They are available in the package MatrixManipulation` which can be downloaded at
library.wolfram.com/infocenter/MathSource/6770

ZeroMatrix has been replaced by ConstantArray

ConstantArray[c,n] generates a list of n copies of the element c.

HankelMatrix and HilbertMatrix are now located in the kernel.

Example 12 <<LinearAlgebra`MatrixManipulation is no longer necessary.

ConstantArray[0,{3,5}]//MatrixForm

0 0 0 0 0
0 0 0 0 0
0 0 0 0 0






Page 316
Loading and using LinearAlgebra`Orthogonalization` is obsolete.
Orthogonalize, Normalize and Projection have been added to the built-in
Mathematica kernel.

Example 21 Omit <<LinearAlgebra`Orthogonalization`

Page 317
Example 24 Omit <<LinearAlgebra`Orthogonalization`

Page 318
12.30 Omit <<LinearAlgebra`Orthogonalization`

Page 319
12.31 Omit <<LinearAlgebra`Orthogonalization`

12.32 Omit <<LinearAlgebra`Orthogonalization`

12.33 Omit <<LinearAlgebra`Orthogonalization`

Page 320
12.34 Omit <<LinearAlgebra`Orthogonalization`

Page 328-329
12.43 Omit <<LinearAlgebra`Orthogonalization`
Omit <<LinearAlgebra`MatrixManipulation`
Gr amSchmi dt has been replaced by the built in kernel function Or t hogonal i ze
AppendCol umns is replaced by J oi n.

a =








3 1 0 0 0
1 3 0 0 0
0 0 2 1 1
0 0 1 2 1
0 0 1 1 2
{values,vectors}=Eigensystem[a]
{{4,4,2,1,1},{{0,0,1,1,1},{1,1,0,0,0},{-1,1,0,0,0},
{0,0,-1,0,1},{0,0,-1,1,0}}}

eigenspace1={vectors[[1]],vectors[[2]]};
eigenspace2={vectors[[3]]};
eigenspace3={vectors[[4]],vectors[[5]]};
v1=Orthogonalize[eigenspace1];
v2=Orthogonalize[eigenspace2];
v3=Orthogonalize[eigenspace3];
orthogonalmatrix=Transpose[Join[v1,v2,v3]];
orthogonalmatrix//MatrixForm

1 1
0 0
2 2
1 1
0 0
2 2
1 1
0 0
3 2
1 2
0 0 0
3 3
1 1
0 0
3 2



0
0
1
6
1
6


p=orthogonalmatrix;
Transpose[p].p//MatrixForm

1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1










d=DiagonalMatrix[values];
p.d.Transpose[p]//MatrixForm

3 1 0 0 0
1 3 0 0 0
0 0 2 1 1
0 0 1 2 1
0 0 1 1 2










MatrixForm[a]MatrixForm[p].MatrixForm[d].
MatrixForm[Transpose[p]]

1 1
0 0 0
2 2
1 1
0 0 0
2 2
1 1 1
0 0
3 2 6
1 2
0 0 0
3 3
1 1 1
0 0
3 2 6
1 1 1
0 0
3 3 3
1 1
3 1 0 0 0 4 0 0 0 0
0 0 0
2 2
1 3 0 0 0 0 4 0 0 0
1 1
0 0 0
0 0 2 1 1 0 0 2 0 0 . .
2 2
0 0 1 2 1 0 0 0 1 0
1 1
0 0 0
0 0 1 1 2 0 0 0 0 1
2 2
1 2 1
0 0
3 6 6










==















Appendix

Page 332
A.5 DSolve[{y''[x]+y[x]0,y[0]1,y'[0]1},y,x]
{{yFunction[{x},Cos[x]+Sin[x]]}}
solution=%[[1,1,2]]
Function[{x},Cos[x]+Sin[x]]
solution[/4]
2

Page 333
EXAMPLE 4 atomicnumber`au=79;
atomicweight`au=196.967;
$Context="atomicnumber`";
au
79
$Context="atomicweight`";
au
196.967
$Context="Global`";
au
au

Page 334
EXAMPLE 6
au="gold";
atomicnumber`au=79;
atomicweight`au=196.967;
$ContextPath
{" Pacl et Manager `" , " WebSer vi ces`" , " Syst em`" , " Gl obal `" }

$ContextPath=Join[$ContextPath,{"atomicweight`"},
{"atomicnumber`"}]
{" Pacl et Manager `" , " WebSer vi ces`" , " Syst em`" , " Gl obal `" , "
at omi cwei ght `" , " at omi cnumber `" }
au
" gol d"
Remove[Global`au]
au
196. 967`

Remove[atomicweight`au]
au
79

Remove[atomicnumber`au]
au
au
Page 334
EXAMPLE 7 This example is obsolete due to the fact that Gl obal ` no longer takes
precedence in the context path. The following is a substitute which illustrates some important
points:

The function DaysBet ween, located in the package Cal endar ` gives the number of days
between two specified dates given in the form {year , mont h, day}. Suppose we define
another function with the same name.

DaysBetween[a_,b_]=a-b;

If we now load Cal endar `, we have two symbols with the same name. We are given a
warning message.

<<Calendar`
DaysBetween::shdw: Symbol DaysBetween appears in
multiple contexts {Calendar`,Global`}; definitions
in context Calendar` may shadow or be shadowed by
other definitions.

If we simply call DaysBetween, we get Calendar`DaysBetween

DaysBetween[{1999,1,1},{2000,1,1}]
365

This is because Cal endar ` comes first in the context path.

$ContextPath
{Calendar`,PacletManager`,WebServices`,System`,Global`}

If we want our original DaysBet ween back, we must specify its context.

Global`DaysBetween[{1999,1,1},{2000,1,1}]
{-1,0,0}

Page 335
EXAMPLE 11

Fact[5.5]
287. 885

Potrebbero piacerti anche