schaum’s outline of mathematica - professional · pdf fileschaum’s outline of...

67
Schaum’s 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 [email protected] Eugene Don, Ph.D.

Upload: donhu

Post on 22-Feb-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Schaum’s 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 [email protected]

Eugene Don, Ph.D.

Page 2: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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 Palettes⇒BasicMathInput and it will appear.) Other palettes are available for specialized purposes and can be accessed via the Palettes menu.

Page 3: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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 Evaluation⇒Abort 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 Evaluation⇒Quit Kernel⇒Local . 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 4: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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] sqrt[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 xy. Just as in algebra, a missing symbol implies multiplication so 2a is the same as 2∗a. 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 5: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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

a = 3

?b

Global `b

21+x

b=3+2x

EXAMPLE 13?a (continuation of example 12) Clear[a]

?a ← ?a recalls information about the symbol a Global`a Remove[b]

?b

Information::notfound : Symbol b not found.>> (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 Format⇒Style. 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 6: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Page 13 ?Plot Plot[f,{x,xmin,xmax}] generates a plot of f as a function of x from xmin to xmax.

Plot[{f1,f2,…},{x,xmin,xmax}] plots several functions fi. ??Plot Plot[f,{x,xmin,xmax}] generates a plot of f as a function of x from xmin to xmax.

Plot[{f1,f2,…},{x,xmin,xmax}] plots several functions fi.

Page 7: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Page 14

Page 15 EXAMPLE 20 (a) Find all the commands beginning with ‘inv’. ?Inv*

Page 8: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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 9: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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, ComplexityFunction→Automatic,ExcludedForms→{}, TimeConstraint→300,TransformationFunctions→Automatic,Trig→True}

Page 17

1.30 Obtain help on the Mathematica command Factor and then factor x3 – 6x2 + 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->{a1,a2,…}] factors a polynomial allowing coefficients that are rational combinations of the algebraic numbers ai.

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

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

Page 10: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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 11: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Page 18 EXAMPLE 23

A bar graph can be constructed from a list of numbers using the command BarChart which is located in the package BarCharts. 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 BarCharts`

Names["BarCharts`*"]

{BarChart, BarChart3D, BarEdges, BarEdgeStyle, BargroupSpacing, BarLabels, BarOrientation, BarSpacing, BarStyle, BarValues, GeneralizedBarChart, GeneralizedBarChart3D, PercentileBarChart, StackedBarChart}

Page 12: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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[{year1, month1, day1}, {year2, month2, day2}] gives the number of days between

the dates {year1, month1, day1} and {year2, month2, day2}.

DaysBetween[{year1, month1, day1, hour1, minute1, second1}, {year2, month2, day2, hour2, minute2, second2}]

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 13: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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 January 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}]

Saturday

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 14: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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

ContourPlot[(x2+y2)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}]

Page 15: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Chapter 2 Page 25 2.3 ∞-∞ ¶::indet : Indeterminate expression -¶+¶ encountered. à

Indeterminate 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 xn 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 Ex . 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 bx.

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 16: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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 “-Graphics-“ should be eliminated, as well as the last sentence on the page (obsolete). Page 53 2.59 Delete the emi colon (;) s Plot[{x2,2 x + 10},{x, –5, 5}] 2.60 Delete the emi olo (;) s c n Plot[{x2, x3, x4},{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

Page 17: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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 18: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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

HGG

I

KJJ

1 0 0

0 2 0

0 0 3

F

HGG

I

KJJ

Page 82 EXAMPLE 36 Page 83 EXAMPLE 40

lst = {{a, b, c},

TableForm[lst, T

Page 84 EXAMPLE 41 (Tables s

The matrix is input using Insert ⇒Table/Matrix ⇒ New … Mathematica outputs the matrix as a nested list.

{d, e, f},{g, h, i}};

ableHeadings → Automatic]

1 2 31 a b c2 d e f3 g h i

hould look as shown below)

column1 Column2 Column3row1 a b c row2 d e f row3 g h i

column1 Column2 Column3a b c d e f g h i

Page 19: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

row1 a b crow2 d e frow3 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.

integers squares cubes1 1 12 4 83 9 274 16 645 25 1256 36 2167 49 3438 64 5129 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 20: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Page 89 3.38 Table should look as shown below (column headings underlined).

period 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 quarterly monthly daily continuously 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).

rate 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

Page 21: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Chapter 4 Page 91 EXAMPLE 1 “-Graphics-“ should be eliminated, as well as the last sentence on the page (obsolete). Page 92 EXAMPLE 2 Delete the se i colon (;) m Plot[{x2, 9 – x2}, {x, –3, 3} Pages 92 – 93 EXAMPLE 3 Delete the semi colons (;)

g1 = Plot[x2 – 9, {x, –4, 4}]

g2 = Plot[Sin[x], {x, 0, 2π}]

Show[g1, g2]

Page 93 All references to DisplayFunction should be ignored. Graphics display can now be controlled with a semicolon (;). EXAMPLE 4

g1 = Plot[x2 – 9, {x, –4, 4}];

g2 = Plot[Sin[x], {x, 0, 2π}];

Show[g1, g2]

There is a missing left bracket ({) in the GraphicsArray 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[x2,{x,-2,2}]; g4=Plot[-x2,{x,-2,2}]; GraphicsArray[{g1,g2,g3,g4}] GraphicsArray[{{g1,g2},{g3,g4}}]

Page 22: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Page 95 EXAMPLE 6 Delete the semi colons (;) Plot[x3, {x, –10, 10}] Plot[x3, {x, –10, 10}, PlotRange → All]

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

Page 96 EXAMPLE 8 Delete the se i colons (;) m

Plot[{-Sqrt[9 - x2], Sqrt[9 - x2]}, {x, -3, 3}]

Plot[{-Sqrt[9 - x2], Sqrt[9 - x2]}, {x, -3, 3}, AspectRatio → Automatic] Page 97 EXAMPLE 9 Delete the semi colons (;)

Plot[5 + x4, {x, 1, 2}]

Plot[5+x4, {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[{x2, 2x2, 3x2}, {x, -3, 3}, PlotStyle →{Dashing[{.01}], Dashing[{.03}], Dashing[{.03, .1}]}]

Page 23: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Page 99 EXAMPLE 12 Delete the semi colons (;)

Plot[{x2, 2x2, 3x2}, {x, -3, 3}, PlotStyle → {Thickness[.005], Thickness[.01], Thickness[.02]}]

EXAMPLE 13 Delete the semi olons (;) c

Plot[{x2, 2x2, 3x2}, {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 Insert⇒Color 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 ColorData. 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[{x2, 2x2, 3x2}, {x, -3, 3}, PlotStyle→{Dashing[{.01}], Dashing[{.03}], Dashing[{.03, .08}]}, PlotLegend→{x2, 2x2, 3x2}]

Page 102 EXAMPLE 17 Delete the semi colon (;)

Plot[1

x 12 +, {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

Page 24: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

EXAMPLE 19 Delete the semi colons (;)

−+

2

2

xPlot[ ,{x, 3,3}]

x 1

− →+

2

2

xPlot[ ,{x, 3,3},Ticks None]

x 1

− → −+

2

2

xPlot[ ,{x, 3,3},Ticks {{ 3, 3}, Automatic}]

x 1

FilledPlot is no longer available. Plot now has a new option, Filling, which will plot a shaded graph. Ignore everything below the three graphs on p.103. Replace with the following: The option Filling 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 mth curve Filling→ {m→{n}} fills from the mth curve to the nth curve Filling→ {m→{y,g}} fills from the mth curve to the value y using graphic directive g Filling→ {m→{{n},g}} fills from the mth curve to the nth curve using graphic

directive g Page 104 EXAMPLE 20 Plot[1-x2,{x,-1,1},Filling→Axis] Plot[{1-x2,2-2x2},{x,-1,1},Filling→{1→{2}}] Plot[{1-x2,2-2x2,3-3x2},{x,-1,1},Filling→{1→{2},2→{3}}]

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

Page 25: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Example 21 Plot[{1-x2,2-2 x2,3-3 x2},{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_] 12

Exp[12x ];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

=

== →

2g1 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[{x2, –x2, x2Sin[10x]}, {x, –2π, 2π}, Frame → True]

Page 26: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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 27: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Page 109 EXAMPLE 23 Delete the semi colon (;)

ParametricPlot[{t3-2t, t2-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π},PlotPoints→50, AspectRatio]→0.5;

Page 110 Disregard all references to ImplicitPlot. It has been replaced by ContourPlot in version 6. Implicit functions can be plotted with the ContourPlot 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 lhs==rhs. Note the double equal sign in the middle. By default, AspectRatio→ 1,Axes→False and Frame→True. EXAMPLE 25

ContourPlot[x2 y2 = =(y+1)2(4-y2),{x,-10,10},{y,-2,2}, AspectRatio→Automatic,Frame→False,Axes→True]

Page 28: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

EXAMPLE 26 ContourPlot[x3+y3= =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}, Axes→True,Frame→False]

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 <<Graphics`Graphics`

PolarPlot[{1, Sin[3θ]}, {θ, 0, 2π}]

Page 29: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

4.9 g1=Plot[x2-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 ParametricPlot 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 ParametricPlot commands. AspectRatio → Automatic is no longer necessary.

ParametricPlot[{x[θ], y[θ]}, {θ, 0, 2π}] ParametricPlot[{x[θ], y[θ]}, {θ, 0, 10π}]

Page 115 4.13 Use ContourPlot and delete the semi colon (;)

ContourPlot[y2 x3 (2-x),{x,0,2},{y,-1.4,1.4}, Frame→False,Axes→True]

Page 116 4.15 (con’t) Delete the semi colon (;) and omit <<Graphics`Graphics`

PolarPlot[θ, {θ, 0, 10π}]

PolarPlot[θ, {θ, - 10π, 10π}]

Page 30: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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 <<Graphics`Graphics` PolarPlot[{1-Cos[θ],1},{θ,0,2 π}] Page 118 4.18 Delete the semi colons (;) in the ListPlot commands

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

FilledListPlot 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 y–coordinates are y1, y2, . . . The x–coordinates 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 lst1,lst2, . . .

If we wish to create a filled polygon which describes the data, we can use the option Filling→Axis in the ListLinePlot command.

EXAMPLE 31

randomintegers = Table[Random[Integer, {1, 20}], {k, 1, 30}]; ListPlot[randomintegers] ListLinePlot[randomintegers, Filling→Axis]

Page 31: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Page 119 Disregard the paragraphs at the top of the page. MultipleListPlot has been replaced by ListPlot and ListLinePlot 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 lst1, lst2 and lst3 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}}]

Page 32: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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 33: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Page 123 4.19 Delete the semi colon (;) ListPlot[lst, PlotJoined→True] 4.20 lst1=Table[n!,{n,1,5}]; lst2=Table[2n,{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 34: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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 Animate 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 xn as n gets larger. EXAMPLE 37

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

Page 35: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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}]

Page 36: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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],Axes→True, PlotRange→{{-2,2},{-2,2}}], {x,0,2 π},{y,0,2 π},{r,0,1}]

Page 37: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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];

Page 38: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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}]

.

Page 39: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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 Plot3D command.

Page 129 EXAMPLE 2 Delete the semi colons (;) after the Plot3D commands.

Page 130 EXAMPLE 3 Delete the semi colons (;) after the Plot3D commands.

Shading 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 Plot3D commands.

Shading is no longer an option in Mathematica 6 so the second example should be deleted.

HiddenSurface is no longer an option in Mathematica 6. It has been replaced by the option PlotStyle→FaceForm[]. The third example should read:

Plot3D[1-y2,{x,-5,5},{y,- 5,5}, BoxRatios→{1, 1, 2}, Boxed→False, Axes→False, 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 Plot3D commands.

Page 134 EXAMPLE 6 Delete the semi colons (;) after the Plot3D commands.

Page 135 EXAMPLE 7 Delete the semi colons (;) after the ParametricPlot3D commands.

Page 40: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

CylindricalPlot3D has been replaced by RevolutionPlot3D 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 θmin ≤ θ ≤ θmax

EXAMPLE 8 Delete the semi colons (;) after the Plot3D 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 Plot3D Command.

5.2 Delete the semi colons (;) after the Plot3D Commands.

Page 137 5.3 Delete the semi colon (;) after the Plot3D Command.

5.4 Delete the semi colon (;) after the Plot3D Command. Shading is no longer available in Mathematica 6 Plot3D[Abs[1-x2-y2],{x,-1,1},{y,-1,1}, Axes→False, Boxed→False]

Page 138 5.5 paraboloid = Plot3D[x2 + y2, {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π}];

Page 41: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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 ParametricPlotPlot3D command.

5.8 Delete the semi colon (;) after the ParametricPlotPlot3D command.

Page 140 5.9 Delete the semi colon (;) after the ParametricPlotPlot3D command.

5.10 cone=RevolutionPlot3D[3 r,{r,0,3},BoxRatios→{1,1,1}];

hemisphere=RevolutionPlot3D[9 9 r2+ − ],{r,0,3}, BoxRatios→{1,1,.5}];

GraphicsArray[{cone,hemisphere}]

Show[cone,hemisphere,PlotRange→All,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 DensityPlot commands.

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

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

Page 42: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Page 143 In Mathematica 6, MeshRange has been replaced by DataRange

• DataRange → {{xmin, xmax}, {ymin, ymax}} labels the x and y axes from xmin to xmax and from ymin 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-x2-y2,{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 (GrayLevel, Hue, RGBColor,etc). If array has dimensions m×n, then shades must have dimension (m–1)×(n–1).

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,MeshShading→shades]

Page 43: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Pages 145-146 EXAMPLE 13 MeshRange has been replaced by DataRange

lst=Table[x2+y2+z2,{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 (;). PlotPoints→50 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 (;). PlotPoints→50 may also be safely eliminated.

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

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

Page 147

Page 44: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

5.14 Delete the semicolons (;) after the ListContourPlot commands.

Page 148 5.15 Remove <<Graphics`ContourPlot3D` Delete the semicolons (;) after the ListContourPlot commands. The option PlotPoints→5 may be safely removed. The default for BoxRatios is {1,1,1}

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

5.16 Delete the semicolon (;) after the ListPlot3D command. Page 149 5.17 Delete <<Graphics`ContourPlot3D` Replace MeshRange with DataRange

and delete the semicolon (;) in the ListContourPlot3D command.

lst=Table[x2-y2, {z,–5,5}, {y,-5,5}, {x,-5,5}]; ListContourPlot3D[lst,Contours→{0.,2.,5.}, Axes→True, DataRange→{{-5,5},{-5,5},{–5,5}}] The first sentence in section 5.3 should be changed. <<BarCharts` should be loaded to access the Bar Chart commands. Also XSpacing and YSpacing have been replaced by BarSpacing 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"}]

Page 45: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

PlotJoined is no longer an option for the ScatterPlot3D command. EXAMPLE 16

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

24

68

102

4

68

10

0

5

10

24

68

102

4

6

810

0

5

10

Page 151 EXAMPLE 17 Delete <<Graphics`Graphics3D` and delete the semicolon (;) in the ListSurfacePlot3D command. SurfaceofRevolution has been replaced by RevolutionPlot3D which is now in the kernel and does not have to be loaded as a separate package. Page 152 EXAMPLE 18 RevolutionPlot3D[x2,{x,0,3},BoxRatios→ {1,1,1}] RevolutionPlot3D[x2,{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 46: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Page 153 5.18 BarChart3D is now located in the package BarCharts`

<<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 ScatterPlot3D has been replaced by ListPointPlot3D lst=Table[{Sin[2t],Cos[2t],t},{t,0,10,.25}];

ListPointPlot3D[lst,PlotStyle→PointSize[.03], Axes→False, 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 π},Ticks→False, 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}]}, Axes→True, Ticks → {{0,1,2},{0,1,2,3},{0,1,2,3,4}}]

Page 47: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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 48: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Page 159 Cylinder 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 ). Cylinder 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]

Sphere 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 ). Sphere can be viewed using Graphics3D

Page 49: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

5.23 In order for the cylinder to be visable, we use the Opacity directive with Sphere

Opacity[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 Torus, TranslateShape and RotateShape 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]

Page 50: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

5.25 The Helix 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],

Boxed→False],{k,0,11 π/6}]

Page 51: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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 Plot command. Page 170 Example 16 Delete the semicolon (;) at the end of the Plot 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 Plot command. Page 176 6.13 Delete the semicolon (;) at the end of the Plot command. 6.14 g1=Graphics[Circle[{0,0},5]];

g2=Plot[x2+x-10,{x,-5,5}];

Show[g1,g2,PlotRange→{-10,10},Axes→True] Page177

6.15 <<Graphics`Graphics is unnecessary

limacon=PolarPlot[5-4 Cos[t],{t,0,2 π}];

parabola=Plot[x2,{x,-3,3}];

Show[limacon,parabola,PlotRange→All]

6.16 ImplicitPlot has been replaced by ContourPlot

spiral=PolarPlot[θ,{θ,0,6 π}];

ellipse=ContourPlot[4x2+9y2 400, {x,-10,10},{y,-20,20}, ContourStyle → Thickness[.01]];

Show[spiral,ellipse]

Page 52: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Chapter 8 Page 200 EXAMPLE 12 Delete the semicolon (;) at the end of the Plot command. Page 202 8.11 <<Graphics`Legend` is obsolete <<PlotLegends`

f[x_]=x4-50 x2+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 Plot command. Page 204 8.14 Delete the semicolon (;) at the end of the Plot command. Page 205 8.15 Delete the semicolon (;) at the end of the Plot command. Page 208 EXAMPLE 16 Delete the semicolon (;) at the end of the Plot command. 8.16 Delete the semicolon (;) at the end of the Plot command. Page 210 8.18 circ=ContourPlot[x2+y2-2 x-4 y==0,{x,-5,5},{y,-1,5}];

p=Graphics[{PointSize[.02],Point[{4,4}]}];

Show[circ,p,AspectRatio→Automatic,Frame→False] Page 216 8.23 Delete the semicolon (;) at the end of the Plot command. Page 217 8.26 Delete the semicolon (;) at the end of the Plot command.

Page 53: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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 Plot command. Page 229 9.15 (cont) Delete the semicolon (;) at the end of the Plot command. Page 230 9.17 Delete the semicolon (;) at the end of the Plot command. Page 231 9.18 (cont) Delete the semicolon (;) at the end of the Plot command. Page 232 9.19 (cont) Delete the semicolon (;) at the end of the Plot command. Page 233 9.20 Delete the semicolon (;) at the end of the Plot command.

Page 54: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Chapter 10 Page 242 10.6 f[x_,y_] 10-x2-2 y2;

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}, PlotRange→All] Page 243 10.7 f[x_,y_,z_]=x2+y2+z2-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 Plot3D command. Page 246 10.8 Delete the semicolon (;) at the end of the Plot3D command. Page 247 10.9 Delete the semicolons (;) at the end of the Plot3D commands. Page 248 10.10 circ=ContourPlot[x^2+y^2-2 x-4 y 0,{x,-5,5},{y,-5,5}];

p=Graphics[{PointSize[.02],Point[{4,4}]}];

Show[circ,p,Axes→True,Frame→False, PlotRange→{{-1.5,4},{-1.5,4.5}}] Page 253 10.16 Delete the semicolon (;) at the end of the Plot command. Page 253-254 10.17 Delete the semicolon (;) at the end of the Plot command.

Page 55: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Page 256 10.20 Ignore <<Graphics`Graphics` and delete the semicolon (;) at the end of the PolarPlot command. 10.21 s1=Graphics3D[Cylinder[{{1,0,0},{1,0,8}}]];

s2=Plot3D[x2+y2,{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+y2 1, {x,0,2},{y,-1,1},Frame→False,Axes→True] Page 258 10.23 cone=RevolutionPlot3D[3 r,{r,0,3},{θ,0,2 π}];

hemisphere=RevolutionPlot3D[9+ 29 - r , {r,0,3},{θ,0,2π}]; Show[cone,hemisphere,PlotRange→All,BoxRatios→{1,1,2}] Page 259 10.24 cyl=Graphics3D[Cylinder[{{0,0,0},{0,0,9}},3]];

cap= RevolutionPlot3D[9+ 29 - r , {r,0,3},{θ,0,2π}]; Show[cyl,cap]

Page 56: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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

PlotVectorField has been changed to VectorFieldPlot and is located in the package VectorFieldPlots`

Page 265 EXAMPLE 9

<<VectorFieldPlots` VectorFieldPlot[{-y,x},{x,-5,5},{y,-5,5},

Axes→Automatic] EXAMPLE 10

<<VectorFieldPlots` VectorFieldPlot[{1,2 x},{x,-1,1},{y,-1,1},

Axes→Automatic] Pages 265-266 EXAMPLE 11 The option Headlength is no longer available. The option ScaleFactor→0 effectively suppresses the vector heads.

<<VectorFieldPlots` vf=VectorFieldPlot[{1,2 x+y},{x,-2,1},{y,-4,6},

Axes→Automatic, ScaleFactor→0, AspectRatio→1/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}, PlotRange→All],{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 Plot command. Page 267 11.2 The option Headlength is no longer available.

<<VectorFieldPlots` VectorFieldPlot[{1,xy},{x,-2,2},{y,-10,10},

AspectRatio →1/GoldenRatio, ScaleFactor→2, Axes→Automatic]

Page 57: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

11.3 The option Headlength is no longer available.

<<VectorFieldPlots` vf=VectorFieldPlot[{1,x2+y},{x,0,1},{y,0,12},

Axes→Automatic, ScaleFactor→0.25, AspectRatio → 1/GoldenRatio];

sols=Table[DSolve[{y'[x] x2+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 ParametricPlot 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.

Page 58: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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 Plot command. Page 273 11.11 (cont) Delete the semicolon (;) at the end of the Plot command. 11.12 Delete the semicolon (;) at the end of the Plot command. Page 274 11.13 Delete the semicolon (;) at the end of the Plot command. Page 275 EXAMPLE 15 Delete the semicolon (;) at the end of the Plot 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 Plot command.

Page 59: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Page 281 EXAMPLE 21 Delete the semicolon (;) at the end of the Plot command. Pages 282-283 EXAMPLE 24 Delete the semicolon (;) at the end of the Plot command. Pages 284-285 11.20 Delete the semicolon (;) at the end of the Plot command. Pages 286-287 11.22 Delete the semicolons (;) at the end of the Plot 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, PlotRange→All] "Solution Without Impulse (dashed)"

21 -t t2 "Solution With Impulse (solid)"

21 -t (t2 + 2 (-1 + t) HeavisideTheta[-1 + t])

Page 60: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Chapter 12 Page 289 Input⇒Create Matrix/Table/Palette … has been changed to Insert ⇒Table/Matrix ⇒ New … The resulting display looks like this:

Page 290 Input⇒Create Matrix/Table/Palette … has been changed to Insert ⇒Table/Matrix ⇒ New … Page 2926.8 The output resulting from m+m is obsolete. Since m is a list, so is m+m. m+m {{2,2},{2,4}} Pages 302 and beyondLoading 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[list1,list2,…] concatenates lists or other expressions that share the same head.

Page 61: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Join[list1,list2,…,n] joins the objects at level n in each of the listi. ArrayFlatten[{{m11,m12,…},{m21,m22,…},…}]

creates a single flattened matrix from a matrix of matrices mi 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 ff

gg hh ii

⎛ ⎞⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎝ ⎠

Join[m1,m2,2]//MatrixForm a b c aa bb cc

d e f dd ee ff

g h i gg hh ii

⎛ ⎞⎜ ⎟⎜ ⎟⎜ ⎟⎝ ⎠

ArrayFlatten[{{m1,m2},{m2,m1}}]//MatrixForm a b c aa bb cc

d e f dd ee ff

g h i gg hh ii

aa bb cc a b c

dd ee ff d e f

gg hh ii g h i

⎛ ⎞⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎝ ⎠

Page 62: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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,seq1,seq2,…] gives a nested list in which elements specified by seqi 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

GGGG

I

K

JJJJ

Take[m,3]//MatrixForm

1 2 3 4 5

6 7 8 9 10

11 12 13 14 15

F

HGG

I

KJJ

Take[m,{1,4},{3,5}]//MatrixForm

3 4 5

8 9 10

13 14 15

18 19 20

F

H

GGGG

I

K

JJJJ

Take[m, {2, 3}] // MatrixForm

6 7 8 9 10

11 12 13 14 15FHG

IKJ

Take[m,4,{2,3}]//MatrixForm

2 3

7 8

12 13

17 18

F

H

GGGG

I

K

JJJJ

Page 63: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Take[m,{2,3},{2,4}]//MatrixForm

7 8 9

12 13 14FHG

IKJ

Take[m,{2,3},{3,4}]//MatrixForm

8 9

13 14FHG

IKJ

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 64: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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` GramSchmidt has been replaced by the built in kernel function Orthogonalize AppendColumns is replaced by Join.

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 10 0

2 21 1

0 02 2

1 10 0

3 2

1 20 0 0

331 1

0 03 2

⎛ ⎞−⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟−⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟−⎜ ⎟⎝ ⎠

0

0

16

16

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

Page 65: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

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 10 0 0

2 2

1 10 0 0

2 2

1 1 10 0

3 2 6

1 20 0 0

33

1 1 10 0

3 2 6

1 1 10 0

3 3 31 13 1 0 0 0 4 0 0 0 0 0 0 02 21 3 0 0 0 0 4 0 0 01 1

0 0 00 0 2 1 1 0 0 2 0 0. .2 2

0 0 1 2 1 0 0 0 1 0 1 10 0 00 0 1 1 2 0 0 0 0 1 2 2

1 2 10 0

36 6

⎛⎛ ⎞⎜⎜ ⎟

⎜ ⎟⎜ ⎟⎛ ⎞ ⎛ ⎞⎜ ⎟⎜ ⎟ ⎜ ⎟⎜ ⎟⎜ ⎟ ⎜ ⎟⎜ ⎟ −⎜ ⎟ ⎜ ⎟==⎜ ⎟⎜ ⎟ ⎜ ⎟⎜ ⎟⎜ ⎟ ⎜ ⎟⎜ ⎟ −⎜ ⎟ ⎜ ⎟

⎝ ⎠ ⎝ ⎠⎜ ⎟⎜ ⎟⎜ ⎟ − −⎜ ⎟⎝ ⎠ ⎝

⎞⎟

⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟⎜ ⎟

Page 66: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

Appendix Page 332 A.5 DSolve[{y''[x]+y[x] 0,y[0] 1,y'[0] 1},y,x] {{y→Function[{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 {"PacletManager`","WebServices`","System`","Global`"}

$ContextPath=Join[$ContextPath,{"atomicweight`"}, {"atomicnumber`"}]

{"PacletManager`","WebServices`","System`","Global`","atomicweight`","atomicnumber`"}

au "gold" Remove[Global`au] au 196.967`

Remove[atomicweight`au] au 79

Remove[atomicnumber`au] au au

Page 334

Page 67: Schaum’s Outline of Mathematica - Professional · PDF fileSchaum’s Outline of Mathematica Supplement for Version 6 The recent introduction of Mathematica 6 has brought significant

EXAMPLE 7 This example is obsolete due to the fact that Global` no longer takes precedence in the context path. The following is a substitute which illustrates some important points: The function DaysBetween, located in the package Calendar` gives the number of days between two specified dates given in the form {year,month,day}. Suppose we define another function with the same name.

DaysBetween[a_,b_]=a-b; If we now load Calendar`, 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 Calendar` comes first in the context path.

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

If we want our original DaysBetween 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