(*^ ::[ 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 02 Enhancing a MMA Notebook on the Macintosh :[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;134,-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. 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 = section; inactive; preserveAspect; startGroup] Exercise :[font = subsection; inactive; preserveAspect] Step 1 - Create a new MMA notebook by going to the MMA menu and selecting File \ New. Move windows around until both Ex02.ma and your new notebook can be seen simultaneously. ;[s] 5:0,0;76,1;86,0;120,1;127,0;178,-1; 2:3,16,12,Times,1,14,0,0,0;2,15,11,Helvetica,1,14,0,0,0; :[font = subsection; inactive; preserveAspect] Step 2 - Add a ruler to the top of your new notebook by selecting Style \ Show Ruler. Describe what you see. ;[s] 3:0,0;68,1;86,0;112,-1; 2:2,16,12,Times,1,14,0,0,0;1,15,11,Helvetica,1,14,0,0,0; :[font = subsection; inactive; preserveAspect; startGroup] Comment 1 :[font = special1; inactive; preserveAspect; endGroup] 1. The popup menu contains different types of cells. The important ones are Input, Output, Graphics, and various documentation cells. The default cell is Input. Why? 2. Different documentation cells have different styles (font, alignment, ...). Select Styles \ Editing Styles and look through the various possibilities. Then close the Style cell that just came up. 3. What do you think the three rectangles do in the ruler? 4. Note the margin symbols and the paper marker triangles. ;[s] 11:0,0;78,1;83,0;86,1;92,0;95,1;103,0;159,1;164,0;261,1;285,0;496,-1; 2:6,16,12,Times,0,14,0,0,0;5,15,11,Helvetica,0,14,0,0,0; :[font = subsection; inactive; preserveAspect] Step 3 - Add the title "Mathematica Workshop" to your new notebook. To do so, produce a new cell and type in "Mathematica Workshop". Then highlight the cell bracket, go to the popup menu on the ruler, and select Title. What happens? Play with the alignment rectangles. ;[s] 5:0,0;24,1;36,0;216,2;221,0;275,-1; 3:3,16,12,Times,1,14,0,0,0;1,16,12,Times,3,14,0,0,0;1,15,11,Helvetica,1,14,0,0,0; :[font = subsection; inactive; preserveAspect; startGroup] Comment 3 :[font = special1; inactive; preserveAspect; endGroup] 1. Note that when you type "Mathematica" it automatically becomes italicized. ;[s] 3:0,0;29,1;40,0;79,-1; 2:2,16,12,Times,0,14,0,0,0;1,16,12,Times,2,14,0,0,0; :[font = subsection; inactive; preserveAspect] Step 4 - Add the Subtitle "Notebook Enhancement - Example 2" to your notebook. ;[s] 3:0,0;19,1;27,0;82,-1; 2:2,16,12,Times,1,14,0,0,0;1,15,11,Helvetica,1,14,0,0,0; :[font = subsection; inactive; preserveAspect] Step 5 - Add a Subsubtitle to your notebook which consists of your name and the date. ;[s] 3:0,0;16,1;27,0;88,-1; 2:2,16,12,Times,1,14,0,0,0;1,15,11,Helvetica,1,14,0,0,0; :[font = subsection; inactive; preserveAspect] Step 6 - Add a Section to your notebook with the title "Arithmetic Examples". ;[s] 3:0,0;17,1;24,0;82,-1; 2:2,16,12,Times,1,14,0,0,0;1,15,11,Helvetica,1,14,0,0,0; :[font = subsection; inactive; preserveAspect] Step 7 - In the next two cells in your new notebook, type in "Addition" and "Multiplication", respectively. Select both cell simultaneously by clicking and dragging on the cell brackets. Then convert the cells to Subsection. ;[s] 3:0,0;218,1;228,0;230,-1; 2:2,16,12,Times,1,14,0,0,0;1,15,11,Helvetica,1,14,0,0,0; :[font = subsection; inactive; preserveAspect; startGroup] Comment 7 :[font = special1; inactive; preserveAspect; endGroup] 1. You can also select a consecutive range of cells by clicking on the first cell bracket and shift clicking on the last one. 2. For selecting nonconsecutive cells, use -click. ;[s] 3:0,0;173,1;188,0;190,-1; 2:2,16,12,Times,0,14,0,0,0;1,15,11,Helvetica,0,14,0,0,0; :[font = subsection; inactive; preserveAspect] Step 8 - Add some descriptive text to a new cell just below the "Addition" subsection; for example, "Here's an example that illustrates addition.". Transform the cell into a Text cell. Now adjust the left margin of the cell so that it's at 1.25 inches. ;[s] 3:0,0;176,1;180,0;256,-1; 2:2,16,12,Times,1,14,0,0,0;1,15,11,Helvetica,1,14,0,0,0; :[font = subsection; inactive; preserveAspect] Step 9 - Add in addition and multiplication examples below the respective subsections. Send the results to the MMA kernel. :[font = subsection; inactive; preserveAspect] Step 10 - Use the menu selection Style to gain greater control of cell appearance and type. To do so, simply select Style. Describe what you see. ;[s] 5:0,0;34,1;39,0;120,1;125,0;151,-1; 2:3,16,12,Times,1,14,0,0,0;2,15,11,Helvetica,1,14,0,0,0; :[font = subsection; inactive; preserveAspect; startGroup] Comment 10 :[font = special1; inactive; preserveAspect; endGroup] 1. Examine the organization of the Style menu: Cell Style, Attributes, Font, Face, Size, Leading, Alignment, Text Color, Background Color, Page Breaks, Formatter, Evaluator, Show Ruler, Edit Styles, Uniform Styles, and All Default Styles. 2. Note the Help button. ;[s] 35:0,0;49,1;59,0;62,1;72,0;75,1;79,0;82,1;86,0;89,1;93,0;96,1;103,0;106,1;115,0;118,1;128,0;131,1;147,0;150,1;161,0;164,1;173,0;176,1;185,0;188,1;198,0;201,1;212,0;215,1;229,0;237,1;255,0;271,1;275,0;285,-1; 2:18,16,12,Times,0,14,0,0,0;17,15,11,Helvetica,0,14,0,0,0; :[font = subsection; inactive; preserveAspect] Step 11 - Play with Style. Make your title cell have red text and a light blue background. To do so, first highlight the title cell. Then for the text color, go to Style \ Text Color \ Red. Do a similar procedure to get the desire background color for the cell itself. ;[s] 5:0,0;20,1;25,0;168,1;192,0;274,-1; 2:3,16,12,Times,1,14,0,0,0;2,15,11,Helvetica,1,14,0,0,0; :[font = subsection; inactive; preserveAspect] Step 12 - Go to one of your output cells, center the output, add a light yellow background to the cell, and put a page break below it. To see the page break, select File \ Print Setting \ Show Page Breaks. Change the font size for this cell output to 24 points. ;[s] 3:0,0;168,1;207,0;266,-1; 2:2,16,12,Times,1,14,0,0,0;1,15,11,Helvetica,1,14,0,0,0; :[font = subsection; inactive; preserveAspect; startGroup] Comment 12 :[font = special1; inactive; preserveAspect; endGroup] 1. Pagebreaks: soft versus hard. There's a dash at the very top. 2. Note that you can't select the text in an output cell; you can only select the cell itself. Why? :[font = subsection; inactive; preserveAspect] Step 13 - Convert one of your output cells to an input cell. What do you observe happening when you do this conversion? :[font = subsection; inactive; preserveAspect; startGroup] Comment 13 :[font = special1; inactive; preserveAspect; endGroup] 1. Why might such a conversion process be useful? :[font = subsection; inactive; preserveAspect] Step 14 - Remove the cell you just converted by selecting the cell and using -x. This process actually saves the cell to the clipboard and you can press -v to bring it back. Do so, but then remove the cell again. Finally, reactivate the original input cell so you end up two input and two output cells in your notebook. ;[s] 5:0,0;80,1;91,0;167,1;178,0;346,-1; 2:3,16,12,Times,1,14,0,0,0;2,15,11,Helvetica,1,14,0,0,0; :[font = subsection; inactive; preserveAspect] Step 15 - Double-click on the cell bracket surrounding "Addition" and its associated input and output cells. What do you find? To the same with the "Multiplication" section. Now double-click on the cells again. What happens? :[font = subsection; inactive; preserveAspect; startGroup] Comment 15 :[font = special1; inactive; preserveAspect; endGroup] 1. Why might grouping cells be useful? :[font = subsection; inactive; preserveAspect] Step 16 - Close all cell groupings in your notebook except for the title. To reopen all the cells in a single move, go to Edit and choose Select All Cells. Then select Cell \ Open All Subgroups. What happens? ;[s] 7:0,0;125,1;129,0;143,1;159,0;175,1;200,0;217,-1; 2:4,16,12,Times,1,14,0,0,0;3,15,11,Helvetica,1,14,0,0,0; :[font = subsection; inactive; preserveAspect; startGroup] Comment 16 :[font = special1; inactive; preserveAspect; endGroup] 1. You can also use this process to close all the cells at once. :[font = subsection; inactive; preserveAspect] Step 17 - Now you're going to print your notebook. To do so, simply select Print \ Print. You might also want to play with the options in File \ Print Setting. ;[s] 5:0,0;77,1;90,0;142,1;162,0;164,-1; 2:3,16,12,Times,1,14,0,0,0;2,15,11,Helvetica,1,14,0,0,0; :[font = subsection; inactive; preserveAspect; startGroup] Comment 17 :[font = special1; inactive; preserveAspect; endGroup; endGroup] 1. What do you think Print \ Print Selection does? Try it out. 2. When working in notebooks, you should save frequently. Why? ;[s] 3:0,0;23,1;46,0;132,-1; 2:2,16,12,Times,0,14,0,0,0;1,15,11,Helvetica,0,14,0,0,0; :[font = section; inactive; preserveAspect; startGroup] Save Your Notebook :[font = special1; inactive; preserveAspect; endGroup; endGroup] Use Save to save the notebook you just created under the name myEx02_NoteBook. ;[s] 5:0,0;5,1;9,0;65,1;80,0;82,-1; 2:3,16,12,Times,0,14,0,0,0;2,15,11,Helvetica,0,14,0,0,0; ^*)