(*^
::[ Information =
"This is a Mathematica Notebook file. It contains ASCII text, and can be
transferred by email, ftp, or other text-file transfer utility. It should
be read or edited using a copy of Mathematica or MathReader. If you
received this as email, use your mail application or copy/paste to save
everything from the line containing (*^ down to the line containing ^*)
into a plain text file. On some systems you may have to give the file a
name ending with ".ma" to allow Mathematica to recognize it as a Notebook.
The line below identifies what version of Mathematica created this file,
but it can be opened using any other version as well.";
FrontEndVersion = "Macintosh Mathematica Notebook Front End Version 2.2";
MacintoshStandardFontEncoding;
fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e8, 24, "Times";
fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e6, 18, "Times";
fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, e6, 14, "Times";
fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, a20, 18, "Times";
fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, a15, 14, "Times";
fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, a12, 12, "Times";
fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "";
fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times";
fontset = input, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, 12, "Courier";
fontset = output, output, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-4, 12, "Courier";
fontset = message, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, 12, "Courier";
fontset = print, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, 12, "Courier";
fontset = info, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, 12, "Courier";
fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, 12, "Courier";
fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, 10, "Times";
fontset = header, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "";
fontset = leftheader, inactive, L2, 12, "Times";
fontset = footer, inactive, nohscroll, noKeepOnOnePage, preserveAspect, center, M7, 12, "";
fontset = leftfooter, inactive, L2, 12, "Times";
fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times";
fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "";
fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Courier";
fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 14, "Times";
fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "";
fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "";
fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "";
fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "";
paletteColors = 128; automaticGrouping; currentKernel;
]
:[font = title; inactive; preserveAspect; startGroup]
Example 00
Introduction to a Mathematica Workshop for Macintosh and NeXTStep
;[s]
3:0,0;29,1;40,0;77,-1;
2:2,25,18,Times,1,24,0,0,0;1,25,18,Times,3,24,0,0,0;
:[font = subsubtitle; inactive; preserveAspect]
Copyright ã 1993 by Bill Titus, Carleton College,
Department of Physics and Astronomy, Northfield, MN 55057-4025
September 6, 1993
;[s]
3:0,0;10,1;11,0;133,-1;
2:2,16,12,Times,2,14,0,0,0;1,16,12,Symbol,0,14,0,0,0;
:[font = section; inactive; preserveAspect; startGroup]
Topics and Skills
:[font = special1; inactive; preserveAspect; endGroup]
1. A bit about Mathematica, including some references.
2. Workshop philosophy.
3. Index to the individual MMA examples.
;[s]
5:0,0;16,1;27,0;55,2;56,0;123,-1;
3:3,16,12,Times,0,14,0,0,0;1,16,12,Times,2,14,0,0,0;1,13,9,Times,0,12,0,0,0;
:[font = section; inactive; preserveAspect; startGroup]
What is Mathematica?
;[s]
3:0,0;7,2;19,1;21,-1;
3:1,19,14,Times,1,18,0,0,0;1,19,14,Times,2,18,0,0,0;1,19,14,Times,3,18,0,0,0;
:[font = subsection; inactive; preserveAspect; startGroup]
Mathematica is a system for doing mathematics by computer. Here are some of its capabilities:
;[s]
3:0,0;1,2;13,1;96,-1;
3:1,16,12,Times,2,14,0,0,0;1,16,12,Times,1,14,0,0,0;1,16,12,Times,3,14,0,0,0;
:[font = special1; inactive; preserveAspect; leftWrapOffset = 10; endGroup]
1. Allows you to do symbolical and numerical calculations.
2. Allows you to display two and three dimensional functions and data sets.
3. Has over 700 built-in functions, and the facility to allow you to write your own functions using MMA's programming language.
4. Has a notebook font end on a number of computer platforms which allows the integrated presentation of calculations, graphics, and documentation.
:[font = subsection; inactive; preserveAspect; startGroup]
Some Selected References
:[font = special1; inactive; preserveAspect; leftWrapOffset = 9]
1. Blachman, Mathematica: A Pratical Approach (Prentice-Hall, NJ, 1992).
;[s]
4:0,0;14,1;47,2;48,0;75,-1;
3:2,16,12,Times,0,14,0,0,0;1,16,12,Times,2,14,0,0,0;1,13,9,Times,0,12,0,0,0;
:[font = special1; inactive; preserveAspect; leftWrapOffset = 20]
A very well-organized, self-learning text which stresses the structure of MMA. It takes about a week to go through if you work all the exercises.
:[font = special1; inactive; preserveAspect; leftWrapOffset = 9]
2. Wolfram, Mathematica: A System for doing Mathematics by Computer, Second Edition (Addison-Wesley, 1989, 1991).
;[s]
5:0,0;13,1;71,0;86,2;87,0;118,-1;
3:3,16,12,Times,0,14,0,0,0;1,16,12,Times,2,14,0,0,0;1,13,9,Times,0,12,0,0,0;
:[font = special1; inactive; preserveAspect; leftWrapOffset = 19]
The bible -- treat it as a reference. It's not something you'd probably go through from cover to cover.
:[font = special1; inactive; preserveAspect; leftWrapOffset = 9]
3. User's Guide For the Macintosh and User's Guide For NeXT Computers (Wolfram Research, 1991, 1993).
;[s]
5:0,0;5,1;34,0;41,1;72,0;106,-1;
2:3,16,12,Times,0,14,0,0,0;2,16,12,Times,2,14,0,0,0;
:[font = special1; inactive; preserveAspect; leftWrapOffset = 18]
Contains detailed information about using the notebook front end on the Macintosh and under NeXTStep.
:[font = special1; inactive; preserveAspect; leftWrapOffset = 9]
4. Guide to Standard Mathematica Packages (Wolfram Research, 1993).
;[s]
3:0,0;4,1;42,0;69,-1;
2:2,16,12,Times,0,14,0,0,0;1,16,12,Times,2,14,0,0,0;
:[font = special1; inactive; preserveAspect; leftWrapOffset = 19]
A reference to the various packages which contains additional functions that can be used in MMA. These functions are written in MMA's own programming language.
:[font = special1; inactive; preserveAspect; leftWrapOffset = 9]
5. Abell and Braselton, Mathematica by Example (Academic Press, 1992).
;[s]
3:0,0;25,1;47,0;72,-1;
2:2,16,12,Times,0,14,0,0,0;1,16,12,Times,2,14,0,0,0;
:[font = special1; inactive; preserveAspect; leftWrapOffset = 19]
An example-driven text. A nice place to go to see how to use MMA to tackle both simple and sophisticated mathematics problems.
:[font = special1; inactive; preserveAspect; leftWrapOffset = 9]
6. Abell and Braselton, The Mathematica Handbook (Academic Press, 1992).
;[s]
3:0,0;25,1;49,0;74,-1;
2:2,16,12,Times,0,14,0,0,0;1,16,12,Times,2,14,0,0,0;
:[font = special1; inactive; preserveAspect; leftWrapOffset = 18]
A reference of the built-in MMA functions along with explicit examples of their use.
:[font = special1; inactive; preserveAspect; leftWrapOffset = 10]
7. Maeder, Programming in Mathematica, Second Edition (Addison-Wesley, 1991).
;[s]
3:0,0;12,1;38,0;79,-1;
2:2,16,12,Times,0,14,0,0,0;1,16,12,Times,2,14,0,0,0;
:[font = special1; inactive; preserveAspect; leftWrapOffset = 22]
An advanced book on programming in Mathematica which stresses creating your own MMA packages.
;[s]
3:0,0;35,1;46,0;94,-1;
2:2,16,12,Times,0,14,0,0,0;1,16,12,Times,2,14,0,0,0;
:[font = special1; inactive; preserveAspect; leftWrapOffset = 10; endGroup; endGroup]
8. Two journals: The Mathematica Journal and Mathematica in Education.
;[s]
5:0,0;19,1;42,0;47,1;71,0;73,-1;
2:3,16,12,Times,0,14,0,0,0;2,16,12,Times,2,14,0,0,0;
:[font = section; inactive; preserveAspect; startGroup]
Philosophy of this Workshop - Empowerment
:[font = special1; inactive; preserveAspect]
This set of interactive workshop examples is structured around a sequence of simple physics problems that require various MMA skills to solve. It's written for the notebook front end for Macintosh and NeXTStep platforms. In particular, participants
:[font = special1; inactive; preserveAspect]
1. Learn a subset of MMA by example.
2. Get a feeling for the structure of MMA and some of its potential.
3. Learn how to find out information about MMA and its various commands.
4. Hopefully develop the ability and confidence to pick MMA up again, even after they haven't used it for a while.
:[font = special1; inactive; preserveAspect; endGroup]
In general, participants load example notebooks that consist of a series of instructions and comments. Then, depending on the number of people in the workshop, the participants can go through the example notebooks together as a group (lead by the instructor), or individually (with an instructor circulating to respond to questions that arise). We have tried both techniques: the first with a group of five and the second with a group of twelve. It seems to take between fifteen to twenty hours to go through the set of sixteen examples. Be forewarned that the notebooks are not polished.
:[font = section; inactive; preserveAspect; startGroup]
Index
:[font = subsection; inactive; preserveAspect; startGroup]
Example 01: Mathematica as a Simple Calculator
;[s]
4:0,0;13,2;24,1;25,0;48,-1;
3:2,16,12,Times,1,14,0,0,0;1,19,14,Times,1,18,0,0,0;1,16,12,Times,3,14,0,0,0;
:[font = special1; inactive; preserveAspect; endGroup]
1. Launching MMA.
2. Opening a MMA notebook from within MMA.
3. Brief definition of the kernel and the notebook front end.
4. MMA as a calculator.
5. Simple arithmetic operators.
6. Basic information on input and output cells.
7. Editing contents of cells.
8. Special MMA objects (atomic types).
9. Saving a MMA notebook.
10. Opening a MMA notebook from a file name or icon.
:[font = subsection; inactive; preserveAspect; startGroup]
Example 02: Enhancing a MMA Notebook on the Macintosh
:[font = special1; inactive; preserveAspect; endGroup]
1. The ruler: cells types and alignment.
2. Cell styles.
3. Style and its attributes.
4. Editing and closing cells.
5. Printing a notebook or notebook selection.
;[s]
3:0,0;65,1;70,0;170,-1;
2:2,16,12,Times,0,14,0,0,0;1,15,11,Helvetica,0,14,0,0,0;
:[font = subsection; inactive; preserveAspect; startGroup]
Example 02: Enhancing a MMA Notebook on the NeXT
:[font = special1; inactive; preserveAspect; endGroup]
1. The ruler: cells types and alignment.
2. Cell styles.
3. The Style Inspector and its attributes.
4. Editing and closing cells.
5. Printing a notebook or notebook selection.
:[font = subsection; inactive; preserveAspect; startGroup]
Exericse 03: Set, Rule Assignments, and SetDelayed
:[font = special1; inactive; preserveAspect; endGroup]
1. Using symbols for calculations.
2. Immediate assignment with Set.
3. Multiple inputs in a single cell.
4. Semicolon to suppress output.
5. Help using ?
6. Immediate assignment with replacement rules.
7. Table[] and TableForm[].
8. Lists - a brief introduction.
9. Clear[].
10. MMA's symbol for the exponential constant e.
11. Assignment with SetDelayed.
;[s]
13:0,0;67,1;70,0;160,2;161,0;215,2;222,0;229,2;240,0;280,2;287,0;362,1;372,0;374,-1;
3:7,16,12,Times,0,14,0,0,0;2,15,11,Helvetica,0,14,0,0,0;4,15,11,Courier,0,14,0,0,0;
:[font = subsection; inactive; preserveAspect; startGroup]
Example 04: Functions
:[font = special1; inactive; preserveAspect; endGroup]
1. Properties of a function: square brackets and the head.
2. Using ?? for extended help.
3. Function attributes: Listable and Protected.
4. Sqrt[], N[], and Precision[].
5. Nesting MMA functions.
6. Trig functions and the MMA constant Pi.
7. Exp[], Log[], and BesselJ[].
8. Head[] and FullForm[].
9. List[].
10. User-defined functions with Set: patterns, SetAttributes[], Remove[], and usage statements.
;[s]
29:0,0;72,1;74,0;151,1;157,0;160,1;163,0;171,1;182,0;252,1;254,0;260,1;265,0;268,1;273,0;281,1;290,0;296,1;303,0;308,1;318,0;324,1;330,0;366,2;369,0;383,1;398,0;401,1;409,0;433,-1;
3:15,16,12,Times,0,14,0,0,0;13,15,11,Courier,0,14,0,0,0;1,15,11,Helvetica,0,14,0,0,0;
:[font = subsection; inactive; preserveAspect; startGroup]
Example 05: Two Dimensional Graphics Using Plot[]
;[s]
2:0,0;45,1;52,-1;
2:1,16,12,Times,1,14,0,0,0;1,15,11,Courier,1,14,0,0,0;
:[font = special1; inactive; preserveAspect; endGroup]
1. The bare Plot[] command.
2. The general function Options[].
3. Eliminating -Graphics- .
4. Resizing a plot area.
5. Reading out graph coordinates.
6. Displaying multiple graphs on a single plot using one Plot[] command.
7. The general structure of Plot[] options.
8. Curve options: Compiled, PlotPoints, PlotDivision,
MaxBend.
9. "Appearance" Options
a. Axes: Axes, AxesLabel, AxesOrigin, AxesStyle.
b. Frame: Frame, FrameStyle, FrameLabel, Ticks,
FrameTicks.
c. General: AspectRatio, PlotLabel, DefaultFont,
Background, DefaultColor, GridLines, PlotRange,
PlotStyle.
d. Graphics Directives: RGBColor[], Thickness[], GrayLevel[].
10. Assigning names to plots.
11. Plotting multiple graphs on a single plot using Show[].
12. Miscellaneous option: DisplayFunction.
13. GraphicsArray[].
14. Animation.
;[s]
65:0,0;15,1;21,0;59,1;68,0;88,1;98,0;224,1;230,0;272,1;278,0;310,1;318,0;321,1;331,0;334,1;346,0;354,1;361,0;406,1;410,0;413,1;422,0;425,1;435,0;438,1;447,0;468,1;473,0;476,1;486,0;489,1;499,0;501,1;506,0;520,1;530,0;553,1;564,0;567,1;576,0;579,1;590,0;605,1;615,0;619,1;631,0;634,1;643,0;646,1;655,0;669,1;678,0;713,1;723,0;726,1;737,0;740,1;751,0;838,1;844,0;874,1;889,0;896,1;911,0;929,-1;
2:33,16,12,Times,0,14,0,0,0;32,15,11,Courier,0,14,0,0,0;
:[font = subsection; inactive; preserveAspect; startGroup]
Example 06: Two Dimensional Parametric Plots and Graphics Primitives
:[font = special1; inactive; preserveAspect; endGroup]
1. ParametricPlot[].
2. The MMA constant Degree.
3. Two dimensional graphics primitives, including global and local options.
4. Removing input and output stored in memory.
;[s]
5:0,0;4,1;20,0;44,1;50,0;177,-1;
2:3,16,12,Times,0,14,0,0,0;2,15,11,Courier,0,14,0,0,0;
:[font = subsection; inactive; preserveAspect; startGroup]
Example 07: Symbolic Integration, Differentiation, and Equation Solving
:[font = special1; inactive; preserveAspect; endGroup]
1. Integrate[].
2. D[].
3. Solve[].
4. Simplify[] and related functions.
5. Postfix notation for functions.
6. Double bracket notation for parts of a list or expression.
;[s]
9:0,0;4,1;15,0;21,1;24,0;30,1;37,0;43,1;54,0;177,-1;
2:5,16,12,Times,0,14,0,0,0;4,15,11,Courier,0,14,0,0,0;
:[font = subsection; inactive; preserveAspect; startGroup]
Example 08: Series, Limits, Numerical Determination of Roots of Equations, and Numerical Integration
:[font = special1; inactive; preserveAspect; endGroup]
1. Finding limits using Limit[].
2. Determining Taylor Series expansions with Series[] and Normal[].
3. Using FindRoot[] to determine the roots of an equation numerically.
4. Other MMA "root" commands.
5. Numerical integration with NIntegrate[].
;[s]
11:0,0;26,1;33,0;82,1;90,0;97,1;105,0;118,1;128,0;244,1;256,0;258,-1;
2:6,16,12,Times,0,14,0,0,0;5,15,11,Courier,0,14,0,0,0;
:[font = subsection; inactive; preserveAspect; startGroup]
Example 09: Iterative Equations and Modular Programming
:[font = special1; inactive; preserveAspect; endGroup]
1. The For loop and its structure.
2. Print[].
3. ListPlot[], the option PlotJoined, and the graphics directive
PointSize[].
4. Comments using (* ... *).
5. Writing a function using Module[].
6. Aborting a calculation.
;[s]
15:0,0;9,1;12,0;42,1;49,0;56,1;66,0;80,1;90,0;127,1;138,0;160,1;169,0;201,1;209,0;241,-1;
2:8,16,12,Times,0,14,0,0,0;7,15,11,Courier,0,14,0,0,0;
:[font = subsection; inactive; preserveAspect; startGroup]
Example 10: Symbolic and Numerical Solutions to Differential Equations I
:[font = special1; inactive; preserveAspect; endGroup]
1. DSolve[].
2. Brief mention of anonymous functions.
3. NDSolve[].
4. InterpolatingFunction[].
5. Short[].
;[s]
9:0,0;4,1;12,0;60,1;69,0;75,1;98,0;106,1;113,0;115,-1;
2:5,16,12,Times,0,14,0,0,0;4,15,11,Courier,0,14,0,0,0;
:[font = subsection; inactive; preserveAspect; startGroup]
Example 11: Symbolic and Numerical Solutions to Differential Equations II
:[font = special1; inactive; preserveAspect; endGroup]
1. Packages: general information and loading packages with Needs[].
2. Manipulating complex exponentials: ComplexToTrig[] in the package "Algebra`Trigonometry`".
3. ParametricPlot3D[].
;[s]
9:0,0;62,1;69,0;111,1;126,0;144,1;167,0;173,1;191,0;193,-1;
2:5,16,12,Times,0,14,0,0,0;4,15,11,Courier,0,14,0,0,0;
:[font = subsection; inactive; preserveAspect; startGroup]
Example 12: Matrices Applied to Two Dimensional Translations and Rotations
:[font = special1; inactive; preserveAspect; endGroup]
1. Matrices as lists of lists.
2. Matrix multiplication and addition.
3. Formating with MatrixForm[].
4. Inverse[].
5. Chop[].
;[s]
7:0,0;92,1;104,0;110,1;119,0;125,1;131,0;133,-1;
2:4,16,12,Times,0,14,0,0,0;3,15,11,Courier,0,14,0,0,0;
:[font = subsection; inactive; preserveAspect; startGroup]
Example 13: Matrices Applied to the Moment of Inertia Tensor
:[font = special1; inactive; preserveAspect; endGroup]
1. Creating symbolic matrices using Array[].
2. Using line sequences of equal input to compact code.
3. Factor[].
4. Eigenvalues[] and Eigenvectors[].
;[s]
9:0,0;38,1;45,0;108,1;116,0;122,1;135,0;143,1;157,0;159,-1;
2:5,16,12,Times,0,14,0,0,0;4,15,11,Courier,0,14,0,0,0;
:[font = subsection; inactive; preserveAspect; startGroup]
Example 14: Importing One Dimensional Data Files and Formating Data
:[font = special1; inactive; preserveAspect; endGroup]
1. Reading in a file with ReadList[].
2. Formating with NumberForm[] and its options SignPadding, NumberSigns, and NumberPadding.
3. Formating with ScientificForm[].
;[s]
13:0,0;28,1;38,0;60,1;72,0;91,1;102,0;104,1;115,0;122,1;135,0;157,1;173,0;175,-1;
2:7,16,12,Times,0,14,0,0,0;6,15,11,Courier,0,14,0,0,0;
:[font = subsection; inactive; preserveAspect; startGroup]
Example 15: Importing and Manipulating Multi-Dimensional Data Files as Lists
:[font = special1; inactive; preserveAspect; endGroup]
1. Using !! to read a file without storing it.
2. List functions: Partition[], Transpose[], and Length[]
3. Extended argument for ReadList[].
4. Round[] to convert a real to an integer.
5. ScatterPlot3D[] in the package Graphics`Graphics3D`.
;[s]
17:0,0;11,1;13,0;71,1;82,0;85,1;96,0;104,1;112,0;140,1;150,0;156,1;163,0;202,1;217,0;235,1;255,0;257,-1;
2:9,16,12,Times,0,14,0,0,0;8,15,11,Courier,0,14,0,0,0;
:[font = subsection; inactive; preserveAspect; startGroup]
Example 16: Surface, Contour, and Density Plots
:[font = special1; inactive; preserveAspect; endGroup; endGroup; endGroup]
1. Plot3D[] with options: LightSource, AxesLabel, Boxed, Axes, PlotPoints, and ViewPoint.
2. ContourPlot[] with various options.
3. DensityPlot[] with various options.
;[s]
19:0,0;4,1;12,0;28,1;39,0;42,1;51,0;54,1;59,0;62,1;66,0;69,1;79,0;87,1;96,0;102,1;115,0;143,1;156,0;180,-1;
2:10,16,12,Times,0,14,0,0,0;9,15,11,Courier,0,14,0,0,0;
^*)